Inheritance: IOptions
Esempio n. 1
0
 protected override Options CreateOptions()
 {
     Options options = new Options();
     options.AddOption("file", false, "Indicates the application will store data into files.");
     options.AddOption("dir", true, "The application directory.");
     return options;
 }
Esempio n. 2
0
 private static Options GetOptions()
 {
     Options options = new Options();
     options.AddOption("c", "conf", true, "A file containing the configurations to make the " +
                       "instance of the network simulator.");
     options.AddOption("");
     return options;
 }
Esempio n. 3
0
        public static void SetToObject(Options options, ICommandLine cmdLine, object obj)
        {
            if (obj == null)
                return;

            var type = obj.GetType();
            MemberInfo[] members = type.FindMembers(MemberTypes.Field | MemberTypes.Property,
                                        BindingFlags.Public | BindingFlags.Instance,
                                        FilterMember, null);

            foreach (var member in members) {
                SetOptionsToMember(member, options, cmdLine);
            }
        }
Esempio n. 4
0
        public void LongWithEqualSingleDash()
        {
            if (style == ParserStyle.Basic)
                return;

            String[] args = new String[] { "-foo=bar" };

            Options options = new Options();
            options.AddOption(OptionBuilder.New().WithLongName("foo").HasArgument().Create('f'));

            ICommandLine cl = parser.Parse(options, args);

            Assert.AreEqual("bar", cl.GetOptionValue("foo").Value);
        }
Esempio n. 5
0
        public static Options Parse(String pattern)
        {
            char opt = ' ';
            bool required = false;
            OptionType type = OptionType.None;

            Options options = new Options();

            for (int i = 0; i < pattern.Length; i++) {
                char ch = pattern[i];

                // a value code comes after an option and specifies
                // details about it
                if (!IsValueCode(ch)) {
                    if (opt != ' ') {
                        OptionBuilder builder = new OptionBuilder();
                        builder.HasArgument(type != OptionType.None);
                        builder.IsRequired(required);
                        builder.WithType(type);

                        // we have a previous one to deal with
                        options.AddOption(builder.Create(opt));
                        required = false;
                        type = OptionType.None;
                        opt = ' ';
                    }

                    opt = ch;
                } else if (ch == '!') {
                    required = true;
                } else {
                    type = getValueClass(ch);
                }
            }

            if (opt != ' ') {
                OptionBuilder builder = new OptionBuilder();
                builder.HasArgument(type != OptionType.None);
                builder.IsRequired(required);
                builder.WithType(type);

                // we have a final one to deal with
                options.AddOption(builder.Create(opt));
            }

            return options;
        }
Esempio n. 6
0
        protected override String[] Flatten(Options options, string[] arguments, bool stopAtNonOption)
        {
            Init();

            int argc = arguments.Length;

            for (int i = 0; i < argc; i++) {
                // get the next command line token
                string token = arguments[i];

                // handle long option --foo or --foo=bar
                if (token.StartsWith("--")) {
                    int pos = token.IndexOf('=');
                    String opt = pos == -1 ? token : token.Substring(0, pos); // --foo

                    if (!options.HasOption(opt)) {
                        ProcessNonOptionToken(token, stopAtNonOption);
                    } else {
                        currentOption = options.GetOption(opt);

                        tokens.Add(opt);
                        if (pos != -1) {
                            tokens.Add(token.Substring(pos + 1));
                        }
                    }
                }

                // single hyphen
                else if ("-".Equals(token)) {
                    tokens.Add(token);
                } else if (token.StartsWith("-")) {
                    if (token.Length == 2 || options.HasOption(token)) {
                        ProcessOptionToken(options, token, stopAtNonOption);
                    }
                        // requires bursting
                    else {
                        BurstToken(options, token, stopAtNonOption);
                    }
                } else {
                    ProcessNonOptionToken(token, stopAtNonOption);
                }

                Gobble(arguments, ref i);
            }

            return (String[])tokens.ToArray(typeof(String));
        }
Esempio n. 7
0
        protected override String[] Flatten(Options options, string[] arguments, bool stopAtNonOption)
        {
            ArrayList tokens = new ArrayList();

            bool eatTheRest = false;

            for (int i = 0; i < arguments.Length; i++) {
                String arg = arguments[i];

                if ("--".Equals(arg)) {
                    eatTheRest = true;
                    tokens.Add("--");
                } else if ("-".Equals(arg)) {
                    tokens.Add("-");
                } else if (arg.StartsWith("-")) {
                    String opt = Util.StripLeadingHyphens(arg);

                    if (options.HasOption(opt)) {
                        tokens.Add(arg);
                    } else {
                        if (opt.IndexOf('=') != -1 && options.HasOption(opt.Substring(0, opt.IndexOf('=')))) {
                            // the format is --foo=value or -foo=value
                            tokens.Add(arg.Substring(0, arg.IndexOf('='))); // --foo
                            tokens.Add(arg.Substring(arg.IndexOf('=') + 1)); // value
                        } else if (options.HasOption(arg.Substring(0, 2))) {
                            // the format is a special properties option (-Dproperty=value)
                            tokens.Add(arg.Substring(0, 2)); // -D
                            tokens.Add(arg.Substring(2)); // property=value
                        } else {
                            eatTheRest = stopAtNonOption;
                            tokens.Add(arg);
                        }
                    }
                } else {
                    tokens.Add(arg);
                }

                if (eatTheRest) {
                    for (i++; i < arguments.Length; i++) {
                        tokens.Add(arguments[i]);
                    }
                }
            }

            return (String[]) tokens.ToArray(typeof (string));
        }
Esempio n. 8
0
 private static Options GetOptions()
 {
     Options options = new Options();
     options.AddOption("nodeconfig", true, "The node configuration file (default: node.conf).");
     options.AddOption("netconfig", true, "The network configuration file (default: network.conf).");
     options.AddOption("host", true, "The interface address to bind the socket on the local machine " +
                       "(optional - if not given binds to all interfaces)");
     options.AddOption("port", true, "The port to bind the socket.");
     options.AddOption("install", false, "Installs the node as a service in this machine");
     options.AddOption("user", true, "The user name for the authorization credentials to install/uninstall " +
                      "the service.");
     options.AddOption("password", true, "The password credential used to authorize installation and " +
                      "uninstallation of the service in this machine.");
     options.AddOption("service", false, "Starts the node as a service (used internally)");
     options.AddOption("uninstall", false, "Uninstalls a service for the node that was previously installed.");
     options.AddOption("storage", true, "The type of storage used to persist node information and data");
     options.AddOption("protocol", true, "The connection protocol used by this node to listen connections");
     return options;
 }
Esempio n. 9
0
        public void Ant()
        {
            Options options = new Options();
            options.AddOption("help", false, "print this message");
            options.AddOption("projecthelp", false, "print project help information");
            options.AddOption("version", false, "print the version information and exit");
            options.AddOption("quiet", false, "be extra quiet");
            options.AddOption("verbose", false, "be extra verbose");
            options.AddOption("debug", false, "print debug information");
            options.AddOption("logfile", true, "use given file for log");
            options.AddOption("logger", true, "the class which is to perform the logging");
            options.AddOption("listener", true, "add an instance of a class as a project listener");
            options.AddOption("buildfile", true, "use given buildfile");
            options.AddOption(OptionBuilder.New().WithDescription("use value for given property")
                                            .HasArguments()
                                            .WithValueSeparator()
                                            .Create('D'));
            //, null, true, , false, true );
            options.AddOption("find", true, "search for buildfile towards the root of the filesystem and use it");

            String[] args = new String[]{ "-buildfile", "mybuild.xml",
            "-Dproperty=value", "-Dproperty1=value1",
            "-projecthelp" };

            // use the GNU parser
            ICommandLineParser parser = new GnuParser();

            ICommandLine line = parser.Parse(options, args);

            // check multiple values
            String[] opts = line.GetOptionValues("D");
            Assert.AreEqual("property", opts[0]);
            Assert.AreEqual("value", opts[1]);
            Assert.AreEqual("property1", opts[2]);
            Assert.AreEqual("value1", opts[3]);

            // check single value
            Assert.AreEqual("mybuild.xml", line.GetOptionValue("buildfile").Value);

            // check option
            Assert.IsTrue(line.HasOption("projecthelp"));
        }
Esempio n. 10
0
        public static Options CreateFromType(Type type)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            //if (!Attribute.IsDefined(type, typeof(OptionsAttribute)))
            //	throw new ArgumentException("The type '" + type + "' is not marked as options");

            MemberInfo[] members = type.FindMembers(MemberTypes.Field | MemberTypes.Property,
                                                    BindingFlags.Public | BindingFlags.Instance,
                                                    FilterMember, null);

            var groups = new Dictionary<string, OptionGroup>();
            var requiredGroups = new List<string>();

            Attribute[] groupsAttrs = Attribute.GetCustomAttributes(type, typeof(OptionGroupAttribute));
            foreach (OptionGroupAttribute groupAttr in groupsAttrs) {
                OptionGroup group;
                if (!groups.TryGetValue(groupAttr.Name, out @group)) {
                    @group = new OptionGroup {IsRequired = groupAttr.IsRequired};
                    groups[groupAttr.Name] = @group;
                    if (groupAttr.IsRequired)
                        requiredGroups.Add(groupAttr.Name);
                }
            }

            var options = new Options();

            foreach (MemberInfo member in members) {
                Option option = CreateOptionFromMember(member, groups);
                if (option != null)
                    options.AddOption(option);
            }

            foreach(var entry in groups) {
                var group = entry.Value;
                options.AddOptionGroup(group);
            }

            return options;
        }
Esempio n. 11
0
        public void GetOptionProperties()
        {
            string[] args = new String[] { "-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar" };

            Options options = new Options();
            options.AddOption(OptionBuilder.New().WithValueSeparator().HasOptionalArgs(2).Create('D'));
            options.AddOption(OptionBuilder.New().WithValueSeparator().HasArguments(2).WithLongName("property").Create());

            Parser parser = new GnuParser();
            ICommandLine cl = parser.Parse(options, args);

            IDictionary<string, string> props = cl.GetOptionProperties("D");

            Assert.IsNotNull(props, "null properties");
            Assert.AreEqual(4, props.Count, "number of properties in " + props);
            Assert.AreEqual("value1", props["param1"], "property 1");
            Assert.AreEqual("value2", props["param2"], "property 2");
            Assert.AreEqual("true", props["param3"], "property 3");
            Assert.AreEqual("value4", props["param4"], "property 4");

            Assert.AreEqual("bar", cl.GetOptionProperties("property")["foo"], "property with long format");
        }
Esempio n. 12
0
        protected void BurstToken(Options options, string token, bool stopAtNonOption)
        {
            for (int i = 1; i < token.Length; i++) {
                String ch = token[i].ToString();

                if (options.HasOption(ch)) {
                    tokens.Add("-" + ch);
                    currentOption = options.GetOption(ch);

                    if (currentOption.HasArgument() && (token.Length != (i + 1))) {
                        tokens.Add(token.Substring(i + 1));

                        break;
                    }
                } else if (stopAtNonOption) {
                    ProcessNonOptionToken(token.Substring(i), true);
                    break;
                } else {
                    tokens.Add(token);
                    break;
                }
            }
        }
Esempio n. 13
0
 public static void PrintHelp(this IHelpFormatter formatter, Options options, TextWriter writer, bool autoUsage)
 {
     formatter.PrintHelp(options, new HelpSettings(), writer, autoUsage);
 }
Esempio n. 14
0
        public void Ls()
        {
            Options options = new Options();
            options.AddOption("a", "all", false, "do not hide entries starting with .");
            options.AddOption("A", "almost-all", false, "do not list implied . and ..");
            options.AddOption("b", "escape", false, "print octal escapes for nongraphic characters");
            options.AddOption(OptionBuilder.New().WithLongName("block-size")
                                            .WithDescription("use SIZE-byte blocks")
                                            .HasArgument()
                                            .WithArgumentName("SIZE")
                                            .Create());
            options.AddOption("B", "ignore-backups", false, "do not list implied entried ending with ~");
            options.AddOption("c", false, "with -lt: sort by, and show, ctime (time of last modification of file status information) with -l:show ctime and sort by name otherwise: sort by ctime");
            options.AddOption("C", false, "list entries by columns");

            String[] args = new String[] { "--block-size=10" };

            // create the command line parser
            ICommandLineParser parser = new PosixParser();

            ICommandLine line = parser.Parse(options, args);
            Assert.IsTrue(line.HasOption("block-size"));
            Assert.AreEqual("10", line.GetOptionValue("block-size").Value);
        }
Esempio n. 15
0
 public override void RegisterOptions(Options options)
 {
     if (obj is IOptionsHandler) {
         ((IOptionsHandler)obj).RegisterOptions(options);
     } else if (registerOptionsMethod != null) {
         registerOptionsMethod.Invoke(obj, new object[] {options});
     } else {
         throw new NotSupportedException();
     }
 }
Esempio n. 16
0
        public ICommandLine Parse(Options options, string[] arguments, IEnumerable<KeyValuePair<string, string>> properties, bool stopAtNonOption)
        {
            if (options == null)
                return new CommandLine(false);

            if (values != null) {
                // clear out the data in options in case it's been used before
                foreach (OptionValue option in values.Values) {
                    option.ClearValues();
                }
            }

            cmd = new CommandLine(true);

            bool eatTheRest = false;

            if (arguments == null)
                arguments = new string[0];

            string[] tokenList = Flatten(options, arguments, stopAtNonOption);

            int tokenCount = tokenList.Length;

            for (int i = 0; i < tokenCount; i++) {
                string t = tokenList[i];

                // the value is the double-dash
                if ("--".Equals(t)) {
                    eatTheRest = true;
                }

                // the value is a single dash
                else if ("-".Equals(t)) {
                    if (stopAtNonOption) {
                        eatTheRest = true;
                    } else {
                        cmd.AddArgument(t);
                    }
                }

                // the value is an option
                else if (t.StartsWith("-")) {
                    if (stopAtNonOption && !options.HasOption(t)) {
                        eatTheRest = true;
                        cmd.AddArgument(t);
                    } else {
                        ProcessOption(options, t, tokenList, ref i);
                    }
                }

                // the value is an argument
                else {
                    cmd.AddArgument(t);

                    if (stopAtNonOption) {
                        eatTheRest = true;
                    }
                }

                // eat the remaining tokens
                if (eatTheRest) {
                    while (++i < tokenCount) {
                        String str = tokenList[i];

                        // ensure only one double-dash is added
                        if (!"--".Equals(str)) {
                            cmd.AddArgument(str);
                        }
                    }
                }
            }

            ProcessProperties(options, properties);
            CheckRequiredOptions(options);

            return cmd;
        }
Esempio n. 17
0
 public override void RegisterOptions(Options options)
 {
     options.AddOption("h", "address", true, "The address to a node of the network (typically a manager).");
     options.AddOption("x", "protocol", true, "Specifies the connection protocol ('http' or 'tcp').");
     options.AddOption("f", "format", true, "Format used to serialize messages to/from the manager " +
                                       "service ('xml', 'json' or 'binary')");
     options.AddOption("p", "password", true, "The challenge password used in all connection handshaking " +
                                         "throughout the network.");
     options.AddOption("u", "user", true, "The name of the user to authenticate in a HTTP connection.");
 }
Esempio n. 18
0
        public void PropertiesOption()
        {
            if (style == ParserStyle.Basic)
                return;

            String[] args = new String[] { "-Jsource=1.5", "-J", "target", "1.5", "foo" };

            Options options = new Options();
            options.AddOption(OptionBuilder.New().WithValueSeparator().HasArguments(2).Create('J'));

            ICommandLine cl = parser.Parse(options, args);

            IList values = cl.GetOptionValues("J");
            Assert.IsNotNull(values, "null values");
            Assert.AreEqual(4, values.Count, "number of values");
            Assert.AreEqual("source", values[0], "value 1");
            Assert.AreEqual("1.5", values[1], "value 2");
            Assert.AreEqual("target", values[2], "value 3");
            Assert.AreEqual("1.5", values[3], "value 4");
            IEnumerable<string> argsleft = cl.Arguments;
            Assert.AreEqual(1, argsleft.Count(), "Should be 1 arg left");
            Assert.AreEqual("foo", argsleft.First(), "Expecting foo");
        }
Esempio n. 19
0
 protected abstract String[] Flatten(Options options, string[] arguments, bool stopAtNonOption);
Esempio n. 20
0
        public void Groovy()
        {
            Options options = new Options();

            options.AddOption(
                OptionBuilder.New().WithLongName("define").
                    WithDescription("define a system property").
                    HasArgument(true).
                    WithArgumentName("name=value").
                    Create('D'));
            options.AddOption(
                OptionBuilder.New().HasArgument(false)
                .WithDescription("usage information")
                .WithLongName("help")
                .Create('h'));
            options.AddOption(
                OptionBuilder.New().HasArgument(false)
                .WithDescription("debug mode will print out full stack traces")
                .WithLongName("debug")
                .Create('d'));
            options.AddOption(
                OptionBuilder.New().HasArgument(false)
                .WithDescription("display the Groovy and JVM versions")
                .WithLongName("version")
                .Create('v'));
            options.AddOption(
                OptionBuilder.New().WithArgumentName("charset")
                .HasArgument()
                .WithDescription("specify the encoding of the files")
                .WithLongName("encoding")
                .Create('c'));
            options.AddOption(
                OptionBuilder.New().WithArgumentName("script")
                .HasArgument()
                .WithDescription("specify a command line script")
                .Create('e'));
            options.AddOption(
                OptionBuilder.New().WithArgumentName("extension")
                .HasOptionalArg()
                .WithDescription("modify files in place; create backup if extension is given (e.g. \'.bak\')")
                .Create('i'));
            options.AddOption(
                OptionBuilder.New().HasArgument(false)
                .WithDescription("process files line by line using implicit 'line' variable")
                .Create('n'));
            options.AddOption(
                OptionBuilder.New().HasArgument(false)
                .WithDescription("process files line by line and print result (see also -n)")
                .Create('p'));
            options.AddOption(
                OptionBuilder.New().WithArgumentName("port")
                .HasOptionalArg()
                .WithDescription("listen on a port and process inbound lines")
                .Create('l'));
            options.AddOption(
                OptionBuilder.New().WithArgumentName("splitPattern")
                .HasOptionalArg()
                .WithDescription("split lines using splitPattern (default '\\s') using implicit 'split' variable")
                .WithLongName("autosplit")
                .Create('a'));

            Parser parser = new PosixParser();
            ICommandLine line = parser.Parse(options, new String[] { "-e", "println 'hello'" }, true);

            Assert.IsTrue(line.HasOption('e'));
            Assert.AreEqual("println 'hello'", line.GetOptionValue('e').Value);
        }
Esempio n. 21
0
        public void Man()
        {
            String cmdLine =
                    "man [-c|-f|-k|-w|-tZT device] [-adlhu7V] [-Mpath] [-Ppager] [-Slist] " +
                            "[-msystem] [-pstring] [-Llocale] [-eextension] [section] page ...";
            Options options = new Options().
                    AddOption("a", "all", false, "find all matching manual pages.").
                    AddOption("d", "debug", false, "emit debugging messages.").
                    AddOption("e", "extension", false, "limit search to extension type 'extension'.").
                    AddOption("f", "whatis", false, "equivalent to whatis.").
                    AddOption("k", "apropos", false, "equivalent to apropos.").
                    AddOption("w", "location", false, "print physical location of man page(s).").
                    AddOption("l", "local-file", false, "interpret 'page' argument(s) as local filename(s)").
                    AddOption("u", "update", false, "force a cache consistency check.").
                //FIXME - should generate -r,--prompt string
                    AddOption("r", "prompt", true, "provide 'less' pager with prompt.").
                    AddOption("c", "catman", false, "used by catman to reformat out of date cat pages.").
                    AddOption("7", "ascii", false, "display ASCII translation or certain latin1 chars.").
                    AddOption("t", "troff", false, "use troff format pages.").
                //FIXME - should generate -T,--troff-device device
                    AddOption("T", "troff-device", true, "use groff with selected device.").
                    AddOption("Z", "ditroff", false, "use groff with selected device.").
                    AddOption("D", "default", false, "reset all options to their default values.").
                //FIXME - should generate -M,--manpath path
                    AddOption("M", "manpath", true, "set search path for manual pages to 'path'.").
                //FIXME - should generate -P,--pager pager
                    AddOption("P", "pager", true, "use program 'pager' to display output.").
                //FIXME - should generate -S,--sections list
                    AddOption("S", "sections", true, "use colon separated section list.").
                //FIXME - should generate -m,--systems system
                    AddOption("m", "systems", true, "search for man pages from other unix system(s).").
                //FIXME - should generate -L,--locale locale
                    AddOption("L", "locale", true, "define the locale for this particular man search.").
                //FIXME - should generate -p,--preprocessor string
                    AddOption("p", "preprocessor", true, "string indicates which preprocessor to run.\n" +
                             " e - [n]eqn  p - pic     t - tbl\n" +
                             " g - grap    r - refer   v - vgrind").
                    AddOption("V", "version", false, "show version.").
                    AddOption("h", "help", false, "show this usage message.");

            HelpFormatter hf = new HelpFormatter();
            hf.PrintHelp(options, new HelpSettings {CommandLineSyntax = cmdLine}, Console.Out, false);
        }
Esempio n. 22
0
        private void Initialize()
        {
            if (!initialized) {
                Readline.ControlCInterrupts = true;
                Readline.Interrupt += Readline_Interrupt;
                RegisterDefaults();
                RegisterCommands();

                appOptions = CreateOptions();

                initialized = true;
            }
        }
Esempio n. 23
0
        public void RegisterOptions(Options options)
        {
            if (running)
                throw new InvalidOperationException("The application is running.");

            Initialize();

            appOptions = options;

            foreach(Command command in dispatcher.RegisteredCommands) {
                command.RegisterOptions(options);
            }
        }
Esempio n. 24
0
        public ICommandLine Parse(Options options, string[] arguments, IEnumerable <KeyValuePair <string, string> > properties, bool stopAtNonOption)
        {
            if (options == null)
            {
                return(new CommandLine(false));
            }

            if (values != null)
            {
                // clear out the data in options in case it's been used before
                foreach (OptionValue option in values.Values)
                {
                    option.ClearValues();
                }
            }

            cmd = new CommandLine(true);

            bool eatTheRest = false;

            if (arguments == null)
            {
                arguments = new string[0];
            }

            string[] tokenList = Flatten(options, arguments, stopAtNonOption);

            int tokenCount = tokenList.Length;

            for (int i = 0; i < tokenCount; i++)
            {
                string t = tokenList[i];

                // the value is the double-dash
                if ("--".Equals(t))
                {
                    eatTheRest = true;
                }

                // the value is a single dash
                else if ("-".Equals(t))
                {
                    if (stopAtNonOption)
                    {
                        eatTheRest = true;
                    }
                    else
                    {
                        cmd.AddArgument(t);
                    }
                }

                // the value is an option
                else if (t.StartsWith("-"))
                {
                    if (stopAtNonOption && !options.HasOption(t))
                    {
                        eatTheRest = true;
                        cmd.AddArgument(t);
                    }
                    else
                    {
                        ProcessOption(options, t, tokenList, ref i);
                    }
                }

                // the value is an argument
                else
                {
                    cmd.AddArgument(t);

                    if (stopAtNonOption)
                    {
                        eatTheRest = true;
                    }
                }

                // eat the remaining tokens
                if (eatTheRest)
                {
                    while (++i < tokenCount)
                    {
                        String str = tokenList[i];

                        // ensure only one double-dash is added
                        if (!"--".Equals(str))
                        {
                            cmd.AddArgument(str);
                        }
                    }
                }
            }

            ProcessProperties(options, properties);
            CheckRequiredOptions(options);

            return(cmd);
        }
Esempio n. 25
0
 public static void PrintHelp(this IHelpFormatter formatter, Options options, TextWriter writer)
 {
     PrintHelp(formatter, options, writer, false);
 }
Esempio n. 26
0
        public virtual void SetUp()
        {
            options = new Options()
                .AddOption("a", "enable-a", false, "turn [a] on or off")
                .AddOption("b", "bfile", true, "set the value of [b]")
                .AddOption("c", "copt", false, "turn [c] on or off");

            if (style == ParserStyle.Basic)
                parser = new BasicParser();
            else if (style == ParserStyle.Posix)
                parser = new PosixParser();
            else if (style == ParserStyle.Gnu)
                parser = new GnuParser();
        }
Esempio n. 27
0
 public static void PrintHelpToConsole(this IHelpFormatter formatter, Options options)
 {
     PrintHelpToConsole(formatter, options, false);
 }
Esempio n. 28
0
 protected void CheckRequiredOptions(Options options)
 {
     // if there are required options that have not been processsed
     if (options.RequiredOptions.Count != 0) {
         throw new MissingOptionException(options.RequiredOptions);
     }
 }
Esempio n. 29
0
 public static void PrintHelpToConsole(this IHelpFormatter formatter, Options options, bool autoUsage)
 {
     formatter.PrintHelp(options, Console.Out, autoUsage);
 }
Esempio n. 30
0
        public void SetUp()
        {
            options = new Options().AddOption("p", false, "Option p").AddOption("attr", true, "Option accepts argument");

            parser = new PosixParser();
        }
Esempio n. 31
0
        private void ProcessOptionToken(Options options, string token, bool stopAtNonOption)
        {
            if (stopAtNonOption && !options.HasOption(token)) {
                eatTheRest = true;
            }

            if (options.HasOption(token)) {
                currentOption = options.GetOption(token);
            }

            tokens.Add(token);
        }
Esempio n. 32
0
 protected abstract String[] Flatten(Options options, string[] arguments, bool stopAtNonOption);