public CommandResult Execute()
 {
     var options = new ArgUsageOptions { ShowPosition = false, ShowType = false };
     var usage = ArgUsage.GetUsage<ScriptCsArgs>(options: options);
     _logger.Info(usage);
     return CommandResult.Success;
 }
Beispiel #2
0
        private static int Main(string[] args)
        {
            SetProfile();

            ArgumentParseResult arguments;
            var console = new ScriptConsole();

            try
            {
                var parser = new ArgumentHandler(new ArgumentParser(), new ConfigFileParser(console), new FileSystem());
                arguments = parser.Parse(args);
            }
            catch (Exception ex)
            {
                console.WriteLine(ex.Message);
                var options = new ArgUsageOptions {
                    ShowPosition = false, ShowType = false
                };
                var usage = ArgUsage.GetUsage <ScriptCsArgs>(options: options);
                console.WriteLine(usage);
                return(1);
            }
            finally
            {
                console.Exit();
            }

            var scriptServicesBuilder = ScriptServicesBuilderFactory.Create(arguments.CommandArguments, arguments.ScriptArguments);
            var factory = new CommandFactory(scriptServicesBuilder);
            var command = factory.CreateCommand(arguments.CommandArguments, arguments.ScriptArguments);

            return((int)command.Execute());
        }
Beispiel #3
0
        private static int Main(string[] args)
        {
            SetProfile();

            ArgumentParseResult arguments;
            var console = new ScriptConsole();
            try
            {
                var parser = new ArgumentHandler(new ArgumentParser(), new ConfigFileParser(console), new FileSystem());
                arguments = parser.Parse(args);
            }
            catch(Exception ex)
            {
                console.WriteLine(ex.Message);
                var options = new ArgUsageOptions { ShowPosition = false, ShowType = false };
                var usage = ArgUsage.GetUsage<ScriptCsArgs>(options: options);
                console.WriteLine(usage);
                return 1;
            }

            var scriptServicesBuilder = ScriptServicesBuilderFactory.Create(arguments.CommandArguments, arguments.ScriptArguments);
            var factory = new CommandFactory(scriptServicesBuilder);
            var command = factory.CreateCommand(arguments.CommandArguments, arguments.ScriptArguments);
            return (int)command.Execute();
        }
Beispiel #4
0
        public CommandResult Execute()
        {
            var options = new ArgUsageOptions {
                ShowPosition = false, ShowType = false
            };
            var usage = ArgUsage.GetUsage <ScriptCsArgs>(options: options);

            _logger.Info(usage);
            return(CommandResult.Success);
        }