public static ISapiCommand ParseArguments(string[] args)
        {
            string       invokedVerb;
            ISapiCommand invokedVerbInstance = null;

            var options = new Options();

            if (CommandLine.Parser.Default.ParseArguments(args, options,
                                                          (verb, subOptions) =>
            {
                // if parsing succeeds the verb name and correct instance
                // will be passed to onVerbCommand delegate (string,object)

                invokedVerb = verb;
                if (subOptions != null)
                {
                    invokedVerbInstance = (ISapiCommand)subOptions;
                }
            }) == false)
            {
                //Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
                return(null);
            }

            return(invokedVerbInstance);
        }
 public Controller(ISapiCommand command)
 {
     _command = command;
     if (command !=null)
         _command.SetLog(this);
     else
         ToConsole("Invalid command line arguments", LogLevel.error);
 }
Example #3
0
 public Controller(ISapiCommand command)
 {
     _command = command;
     if (command != null)
     {
         _command.SetLog(this);
     }
     else
     {
         ToConsole("Invalid command line arguments", LogLevel.error);
     }
 }