Package org.jnode.shell.syntax

Examples of org.jnode.shell.syntax.RepeatSyntax


            if (bundle == null) {
                // We're missing the argument bundle.  We assume this is a 'classic' Java application
                // that does its own argument parsing and completion like a UNIX shell; i.e.
                // completing each argument as a pathname.
                Syntax syntax = new RepeatSyntax(new ArgumentSyntax("argument"));
                syntaxes = new SyntaxBundle(cmd, syntax);
                bundle = new ArgumentBundle(
                    new FileArgument("argument", Argument.MULTIPLE));
            } else if (syntaxes == null) {
                // We're missing the syntax, but we do have an argument bundle.  Generate
View Full Code Here


    public void testFormat() {
        Test test = new Test();
        Syntax syntax1 = new SequenceSyntax(new ArgumentSyntax("fileArg"));
        Assert.assertEquals("<fileArg>", syntax1.format(test.getArgumentBundle()));
        Syntax syntax2 =
                new SequenceSyntax(new RepeatSyntax(new ArgumentSyntax("fileArg")),
                        new ArgumentSyntax("intArg"));
        Assert.assertEquals("[ <fileArg> ... ] <intArg>", syntax2.format(test.getArgumentBundle()));
        Syntax syntax3 = new SequenceSyntax();
        Assert.assertEquals("", syntax3.format(test.getArgumentBundle()));
    }
View Full Code Here

    @org.junit.Test
    public void testTwo() throws Exception {
        TestShell shell = new TestShell();
        shell.addAlias("cmd", "org.jnode.test.shell.syntax.SequenceSyntaxTest$Test");
        shell.addSyntax("cmd", new SequenceSyntax(new RepeatSyntax(new ArgumentSyntax("fileArg")),
                new ArgumentSyntax("intArg")));

        CommandLine cl;
        CommandInfo cmdInfo;
        Command cmd;
View Full Code Here

    public void testLazy() throws Exception {
        TestShell shell = new TestShell();
        shell.addAlias("cmd", "org.jnode.test.shell.syntax.PowersetSyntaxTest$Test");
        shell.addSyntax("cmd", new SequenceSyntax(new PowersetSyntax(
                new OptionSyntax("intArg", 'i'), new OptionSyntax("fileArg", 'f')),
                new RepeatSyntax(new OptionSyntax("otherArg", 'i'))));

        CommandLine cl;
        CommandInfo cmdInfo;
        Command cmd;
View Full Code Here

    public void testEager() throws Exception {
        TestShell shell = new TestShell();
        shell.addAlias("cmd", "org.jnode.test.shell.syntax.PowersetSyntaxTest$Test");
        shell.addSyntax("cmd", new SequenceSyntax(new PowersetSyntax(null, true, null,
                new OptionSyntax("intArg", 'i'), new OptionSyntax("fileArg", 'f')),
                new RepeatSyntax(new OptionSyntax("otherArg", 'i'))));

        CommandLine cl;
        CommandInfo cmdInfo;
        Command cmd;
View Full Code Here

TOP

Related Classes of org.jnode.shell.syntax.RepeatSyntax

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.