Package org.crsh.cli.impl.lang

Examples of org.crsh.cli.impl.lang.CommandFactory


  /** . */
  private final CommandDescriptor<Instance<T>> descriptor;

  public ClassShellCommand(Class<T> clazz) throws IntrospectionException {
    CommandFactory factory = new CommandFactory(getClass().getClassLoader());
    this.clazz = clazz;
    this.descriptor = HelpDescriptor.create(factory.create(clazz));
  }
View Full Code Here


  }

  public void testValue() throws Exception {

    //
    CommandDescriptor<Instance<G>> desc = new CommandFactory(MatcherTestCase.class.getClassLoader()).create(G.class);

    //
    G g = new G();
    desc.matcher().parse("foo -o a").invoke(Util.wrap(g));
    assertEquals(new Custom("a"), g.o);
View Full Code Here

  private final CommandDescriptor<Instance<T>> descriptor;

  public GroovyScriptShellCommand(Class<T> clazz) throws IntrospectionException {

    //
    CommandFactory factory = new CommandFactory(getClass().getClassLoader());

    boolean hasExplicitReturn;
    try {
      clazz.getDeclaredField(ScriptLastStatementTransformer.FIELD_NAME);
      hasExplicitReturn = true;
    }
    catch (NoSuchFieldException e) {
      hasExplicitReturn = false;
    }

    //
    this.clazz = clazz;
    this.descriptor = HelpDescriptor.create(factory.create(clazz));
    this.hasExplicitReturn = hasExplicitReturn;
  }
View Full Code Here

      Custom o;
      @Command
      public void foo(@Argument Custom o) { this.o = o; }
    }

    CommandDescriptor<Instance<A>> desc = new CommandFactory(CompleteTestCase.class.getClassLoader()).create(A.class);

    //
    CompletionMatcher<Instance<A>> matcher = desc.completer();
    assertEquals(new CompletionMatch(Delimiter.EMPTY, Completion.create()), matcher.match("foo "));
  }
View Full Code Here

TOP

Related Classes of org.crsh.cli.impl.lang.CommandFactory

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.