Example #1
0
        public void TestCommandExecutes()
        {
            var parameters = new ParameterParser().Parse("-one two");

            var command = new FakeCommand();

            command.BindParameters(parameters);

            Assert.NotNull(command.GetOptions());
        }
Example #2
0
        public void TestCommandDoesntExecutesWithMinus()
        {
            var parameters = new ParameterParser().Parse(@"-three ""-two""");

            var command = new FakeCommand();

            command.BindParameters(parameters);

            Assert.Null(command.GetOptions());
        }
Example #3
0
        /// <summary>
        /// Runs this console application.
        /// </summary>
        /// <param name="args">The args.</param>
        /// <returns>The exit code (0 for success)</returns>
        public int Run(string[] args)
        {
            // Get the command line arguments
            Arguments = new ParameterParser().Parse(args, Switches);

            // Check user input
            var exitCode = Main();

            // Pause if in debug mode
            PauseIfInDebuggerAttached();

            return(exitCode);
        }
Example #4
0
        /// <summary>
        /// Runs this console application.
        /// </summary>
        /// <param name="args">The args.</param>
        /// <returns>The exit code (0 for success)</returns>
        public int Run(string[] args)
        {
            // Get the command line arguments
            Arguments = new ParameterParser().Parse(args, Switches);

            // Check user input
            var exitCode = Main();

            // Pause if in debug mode
            PauseIfInDebuggerAttached();

            return exitCode;
        }
Example #5
0
        /// <summary>
        /// Formats an incoming command with the alias with the given name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="original">The original.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public string FormatAlias(string name, string original)
        {
            var parameters = new ParameterParser().Parse(original);

            var result = ConfigService.GetValue("Aliases", name, "") ?? string.Empty;

            for (int i = 0; i < parameters.Count; i++)
            {
                var parameter = parameters[i];

                if (parameter.Contains(" "))
                {
                    parameter = @"""" + parameter + @"""";
                }

                result = result.Replace("%" + i, parameter);
            }

            return result;
        }
Example #6
0
 public void TestParseRead()
 {
     parser = new ParameterParser();
 }
Example #7
0
 public void SetUp()
 {
     parser  = new ParameterParser();
     printer = new ParameterPrinter();
 }
Example #8
0
 public void SetUp()
 {
     parser = new ParameterParser();
 }
Example #9
0
 /// <summary>
 /// Sets the console arguments.
 /// </summary>
 /// <param name="args">The arguments.</param>
 /// <param name="switches">The command switches, e.g. a leading "-", "--" or "/".</param>
 protected void SetArguments(string args, IList <string> switches)
 {
     Arguments = new ParameterParser().Parse(args, switches);
 }
Example #10
0
 /// <summary>
 /// Sets the console arguments.
 /// </summary>
 /// <param name="args">The arguments.</param>
 protected void SetArguments(string args)
 {
     Arguments = new ParameterParser().Parse(args, Switches);
 }
Example #11
0
 public void TestParseRead()
 {
     parser = new ParameterParser();
 }