Beispiel #1
0
        public void TestMethod1()
        {
            CLParser parser = new CLParser();

            CLSwitch apple = new CLSwitch('a', "apple", "Should I use apples?");

            parser.Add(apple);

            CLSwitch banana = new CLSwitch('b', "banana", "Should I use bananas?");

            parser.Add(banana);

            CLGenericArgument <Int32> integer = new CLGenericArgument <Int32>(Int32.Parse, 'i', "int", "This options has a long description, I am going to keep talking about this argument until I reach a good long length for this description");

            parser.Add(integer);

            CLEnumArgument <DayOfWeek> day = new CLEnumArgument <DayOfWeek>('d', "day", "The day of the week");

            parser.Add(day);

            parser.PrintUsage();


            parser.Parse(new String[] {
                "-a", "--day", "Sunday", "-b", "-i", "32", "43",
            });
            Assert.AreEqual(true, apple.set);
            Assert.AreEqual(true, banana.set);
            Assert.AreEqual(true, integer.set);
            Assert.AreEqual(true, day.set);
            Assert.AreEqual(DayOfWeek.Sunday, day.ArgValue);
        }
Beispiel #2
0
        public Options()
        {
            DontPrintSequences = new CLSwitch('n', "noprint", "Do not print sequences");
            Add(DontPrintSequences);

            MaxCnCount = new CLGenericArgument <UInt32>(UInt32.Parse, 'm', "max-cn-count", "The maximum number of characters in the sequence");
            Add(MaxCnCount);
        }