Ignore:
Timestamp:
8/4/2010 10:26:21 AM (22 months ago)
Author:
lowjoel
Message:

Define the eraser erase command that is shorthand for eraser addtask /schedule=now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser/Program.cs

    r2235 r2236  
    7777        { 
    7878            /// <summary> 
     79            /// Constructor. 
     80            /// </summary> 
     81            public ConsoleArguments() 
     82            { 
     83            } 
     84 
     85            /// <summary> 
     86            /// Copy constructor. 
     87            /// </summary> 
     88            /// <param name="arguments">The <see cref="ConsoleArguments"/> to use as a template 
     89            /// for this instance.</param> 
     90            protected ConsoleArguments(ConsoleArguments arguments) 
     91            { 
     92                Action = arguments.Action; 
     93                PositionalArguments = arguments.PositionalArguments; 
     94            } 
     95 
     96            /// <summary> 
    7997            /// The Action which this handler is in charge of. 
    8098            /// </summary> 
     
    88106        } 
    89107 
    90         class AddTaskArguments : ConsoleArguments 
    91         { 
     108        class EraseArguments : ConsoleArguments 
     109        { 
     110            /// <summary> 
     111            /// Constructor. 
     112            /// </summary> 
     113            public EraseArguments() 
     114            { 
     115            } 
     116 
     117            /// <summary> 
     118            /// Copy constructor. 
     119            /// </summary> 
     120            /// <param name="arguments">The <see cref="EraseArguments"/> to use as a template 
     121            /// for this instance.</param> 
     122            protected EraseArguments(EraseArguments arguments) 
     123                : base(arguments) 
     124            { 
     125                ErasureMethod = arguments.ErasureMethod; 
     126            } 
     127 
    92128            /// <summary> 
    93129            /// The erasure method which the user specified on the command line. 
     
    95131            [Arg("method", "The erasure method to use", typeof(string), false, null, null)] 
    96132            public string ErasureMethod { get; set; } 
     133        } 
     134 
     135        class AddTaskArguments : EraseArguments 
     136        { 
     137            /// <summary> 
     138            /// Constructor. 
     139            /// </summary> 
     140            public AddTaskArguments() 
     141            { 
     142            } 
     143 
     144            /// <summary> 
     145            /// Constructs Add Task arguments from Erase arguments. 
     146            /// </summary> 
     147            /// <param name="arguments">The <see cref="EraseArguments"/> to use as a template 
     148            /// for this instance.</param> 
     149            internal AddTaskArguments(EraseArguments arguments) 
     150                : base(arguments) 
     151            { 
     152            } 
    97153 
    98154            /// <summary> 
     
    260316                    program.Handlers.Add("help", 
    261317                        new ConsoleActionData(CommandHelp, new ConsoleArguments())); 
     318                    program.Handlers.Add("erase", 
     319                        new ConsoleActionData(CommandErase, new EraseArguments()));  
    262320                    program.Handlers.Add("addtask", 
    263321                        new ConsoleActionData(CommandAddTask, new AddTaskArguments())); 
     
    319377where action is 
    320378  help                Show this help message. 
     379  erase               Erases items specified on the command line. This is 
     380                      equivalent to addtask, with the schedule set to ""now"". 
    321381  addtask             Adds a task to the current task list. 
    322382  importtasklist      Imports an Eraser Task list to the current user's Task 
     
    331391  no parameters to set. 
    332392 
    333 parameters for addtask: 
     393parameters for erase and addtask: 
     394  eraser erase [/method=(<methodGUID>|<methodName>)] <target> [target [...]] 
    334395  eraser addtask [/method=(<methodGUID>|<methodName>)] [/schedule=(now|manually|restart)] <target> [target [...]] 
    335396 
     
    346407                      is next restarted. 
    347408 
     409                      This parameter is only valid for use with ""addtask"". 
     410 
    348411  target is one or more of: 
    349412{1} 
     
    376439 
    377440            PrintCommandHelp(); 
     441        } 
     442 
     443        /// <summary> 
     444        /// Parses the command line for tasks and adds them to run immediately 
     445        /// using the <see cref="RemoveExecutor"/> class. 
     446        /// </summary> 
     447        /// <param name="arg">The command line parameters passed to the program.</param> 
     448        private static void CommandErase(ConsoleArguments arg) 
     449        { 
     450            AddTaskArguments arguments = new AddTaskArguments((EraseArguments)arg); 
     451            arguments.Schedule = "NOW"; 
     452 
     453            CommandAddTask(arguments); 
    378454        } 
    379455 
Note: See TracChangeset for help on using the changeset viewer.