Java Code Examples for picocli.CommandLine.Model.CommandSpec#addMixin()

The following examples show how to use picocli.CommandLine.Model.CommandSpec#addMixin() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VersionProviderTest.java    From picocli with Apache License 2.0 6 votes vote down vote up
@Test
public void testInitVersionProvider() {
    CommandLine.IVersionProvider versionProvider1 = new CommandLine.IVersionProvider() {
        public String[] getVersion() { return new String[0]; }
    };
    CommandLine.IVersionProvider versionProvider2 = new CommandLine.IVersionProvider() {
        public String[] getVersion() { return new String[0];  }
    };

    CommandSpec spec = CommandSpec.wrapWithoutInspection(null);
    spec.versionProvider(versionProvider1);

    CommandSpec mixin = CommandSpec.wrapWithoutInspection(null);
    mixin.versionProvider(versionProvider2);

    spec.addMixin("helper", mixin);
    assertSame(versionProvider1, spec.versionProvider());
}
 
Example 2
Source File: ModelCommandSpecTest.java    From picocli with Apache License 2.0 5 votes vote down vote up
@Test
public void testInitHelpCommand() {
    CommandSpec spec = CommandSpec.wrapWithoutInspection(null);
    assertFalse(spec.helpCommand());

    CommandSpec mixin = CommandSpec.wrapWithoutInspection(null);
    mixin.helpCommand(true);

    spec.addMixin("helper", mixin);
    assertTrue(spec.helpCommand());
}