From e27b6f1653fdac183b6b9fe6bb71f557d98b81e2 Mon Sep 17 00:00:00 2001 From: David Blevins Date: Fri, 9 Feb 2024 18:38:38 -0800 Subject: [PATCH] Help text shows command name and version https://github.com/tomitribe/crest/issues/110 --- .../main/java/org/tomitribe/crest/Main.java | 4 +- .../org/tomitribe/crest/cmds/CmdMethod.java | 16 +-- .../tomitribe/crest/cmds/processors/Help.java | 16 +++ .../crest/environments/Environment.java | 19 ++- .../crest/environments/SystemEnvironment.java | 33 ++++- .../java/org/tomitribe/crest/HelpTest.java | 98 +++++++++------ .../org/tomitribe/crest/help/AuthorTest.java | 4 +- .../crest/help/DefaultsShownTest.java | 2 +- .../help/GenericsInMethodSignatureTest.java | 2 +- .../crest/help/JavadocHelpComplexTest.java | 2 +- .../org/tomitribe/crest/help/ManualTest.java | 2 +- .../help/ParamWithPreformattedTextTest.java | 2 +- .../org/tomitribe/crest/help/SeeAlsoTest.java | 4 +- .../tomitribe/crest/help/SubcommandTest.java | 2 +- .../tomitribe/crest/help/TestEnvironment.java | 114 +++++++++++++++--- ...g.tomitribe.crest.HelpTest$Rsync_rsync.txt | 4 +- 16 files changed, 247 insertions(+), 77 deletions(-) diff --git a/tomitribe-crest/src/main/java/org/tomitribe/crest/Main.java b/tomitribe-crest/src/main/java/org/tomitribe/crest/Main.java index f360d03a..42bf6271 100644 --- a/tomitribe-crest/src/main/java/org/tomitribe/crest/Main.java +++ b/tomitribe-crest/src/main/java/org/tomitribe/crest/Main.java @@ -412,7 +412,7 @@ public Builder version(final String version) { * and finally to System.getenv("CMD"). */ public Builder name(final String name) { - this.version = name; + this.name = name; return this; } @@ -501,6 +501,8 @@ public Main build() { .in(in) .err(err) .properties(properties) + .name(name) + .version(version) .build(); final Iterable> commands = this.commands.size() == 0 ? Commands.load() : this.commands; diff --git a/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/CmdMethod.java b/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/CmdMethod.java index 96b22fec..cb3863ac 100644 --- a/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/CmdMethod.java +++ b/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/CmdMethod.java @@ -35,7 +35,6 @@ import org.tomitribe.crest.cmds.processors.Item; import org.tomitribe.crest.cmds.processors.OptionParam; import org.tomitribe.crest.cmds.processors.Param; -import org.tomitribe.crest.cmds.targets.SimpleBean; import org.tomitribe.crest.cmds.targets.Substitution; import org.tomitribe.crest.cmds.targets.Target; import org.tomitribe.crest.cmds.utils.CommandLine; @@ -144,11 +143,6 @@ public List getArguments() { } } - public CmdMethod(final Method method, final DefaultsContext defaultsFinder, - final BeanValidationImpl beanValidation) { - this(method, new SimpleBean(null), defaultsFinder, beanValidation); - } - public CmdMethod(final Method method, final Target target, final DefaultsContext defaultsFinder, final BeanValidationImpl beanValidation) { this.target = target; @@ -410,8 +404,14 @@ private void validate() { */ @Override public String getUsage() { + String commandName = name; + final String prefix = Environment.get().getName(); + if (prefix != null && prefix.length() > 0) { + commandName = prefix + " " + commandName; + } + final Class declaringClass = method.getDeclaringClass(); final Map commands = Commands.get(declaringClass); if (commands.size() == 1 && commands.values().iterator().next() instanceof CmdGroup) { @@ -655,11 +655,11 @@ public void manual(final PrintStream out) { final Javadoc javadoc = JavadocParser.parse(commandJavadoc.getJavadoc()); - if (javadoc.isEmpty()){ + if (javadoc.isEmpty()) { help(out); return; } - + final Document.Builder manual = Document.builder() .heading("NAME") .paragraph(name) diff --git a/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/processors/Help.java b/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/processors/Help.java index 2624c997..a289c8f2 100644 --- a/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/processors/Help.java +++ b/tomitribe-crest/src/main/java/org/tomitribe/crest/cmds/processors/Help.java @@ -19,6 +19,7 @@ import org.tomitribe.crest.api.Command; import org.tomitribe.crest.cmds.Cmd; import org.tomitribe.crest.cmds.CmdGroup; +import org.tomitribe.crest.environments.Environment; import org.tomitribe.crest.help.CommandJavadoc; import org.tomitribe.crest.help.Document; import org.tomitribe.crest.help.DocumentParser; @@ -91,6 +92,21 @@ public static void optionHelp(final Method method, final String commandName, // out.println(); } + + final Environment environment = Environment.ENVIRONMENT_THREAD_LOCAL.get(); + final String name = environment.getName(); + final String version = environment.getVersion(); + + if (name == null && version == null) { + return; + } + + if (name == null) { + out.printf("%nVersion %s%n", version); + return; + } + + out.printf("%n%s %s%n", name, version); } public static List getItems(final Method method, final String commandName, final Collection optionParams) { diff --git a/tomitribe-crest/src/main/java/org/tomitribe/crest/environments/Environment.java b/tomitribe-crest/src/main/java/org/tomitribe/crest/environments/Environment.java index cca74366..b8dffb71 100644 --- a/tomitribe-crest/src/main/java/org/tomitribe/crest/environments/Environment.java +++ b/tomitribe-crest/src/main/java/org/tomitribe/crest/environments/Environment.java @@ -21,7 +21,6 @@ import java.util.Map; import java.util.Properties; -@Deprecated public interface Environment { ThreadLocal ENVIRONMENT_THREAD_LOCAL = new ThreadLocal() { @@ -31,6 +30,16 @@ protected Environment initialValue() { } }; + static Environment get() { + return ENVIRONMENT_THREAD_LOCAL.get(); + } + + static Environment set(final Environment environment) { + final Environment old = ENVIRONMENT_THREAD_LOCAL.get(); + ENVIRONMENT_THREAD_LOCAL.set(environment); + return old; + } + PrintStream getOutput(); PrintStream getError(); @@ -44,4 +53,12 @@ default Map getEnv() { } T findService(Class type); + + default String getName() { + return null; + } + + default String getVersion() { + return null; + } } diff --git a/tomitribe-crest/src/main/java/org/tomitribe/crest/environments/SystemEnvironment.java b/tomitribe-crest/src/main/java/org/tomitribe/crest/environments/SystemEnvironment.java index 340b893d..6a624c4f 100644 --- a/tomitribe-crest/src/main/java/org/tomitribe/crest/environments/SystemEnvironment.java +++ b/tomitribe-crest/src/main/java/org/tomitribe/crest/environments/SystemEnvironment.java @@ -32,21 +32,25 @@ public class SystemEnvironment implements Environment { private final PrintStream err; private final InputStream in; private final Properties properties; + private final String name; + private final String version; public SystemEnvironment(final Map, Object> services) { - this(services, System.out, System.err, System.in, System.getProperties()); + this(services, System.out, System.err, System.in, System.getProperties(), null, null); } protected SystemEnvironment(final Map, Object> services, final PrintStream out, final PrintStream err, final InputStream in, - final Properties properties) { + final Properties properties, final String name, final String version) { this.services = new HashMap<>(services); this.out = out; this.err = err; this.in = in; this.properties = properties; + this.name = name; + this.version = version; init(); } @@ -54,6 +58,16 @@ public SystemEnvironment() { this(new HashMap<>()); } + @Override + public String getName() { + return name; + } + + @Override + public String getVersion() { + return version; + } + @Override public PrintStream getOutput() { return out; @@ -87,6 +101,8 @@ public static Builder builder() { } public static final class Builder { + private String name; + private String version; private Map, Object> services = new HashMap<>(); private PrintStream out; private PrintStream err; @@ -96,6 +112,7 @@ public static final class Builder { private Builder() { } + public Builder services(Map, Object> services) { this.services = services; return this; @@ -111,6 +128,16 @@ public Builder out(PrintStream out) { return this; } + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder version(String version) { + this.version = version; + return this; + } + public Builder err(PrintStream err) { this.err = err; return this; @@ -127,7 +154,7 @@ public Builder properties(Properties properties) { } public SystemEnvironment build() { - return new SystemEnvironment(services, out, err, in, properties); + return new SystemEnvironment(services, out, err, in, properties, name, version); } } } diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/HelpTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/HelpTest.java index 1b72a96e..f6e98a44 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/HelpTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/HelpTest.java @@ -31,6 +31,7 @@ import org.tomitribe.crest.cmds.CmdMethod; import org.tomitribe.crest.cmds.processors.Commands; import org.tomitribe.crest.cmds.targets.SimpleBean; +import org.tomitribe.crest.environments.Environment; import org.tomitribe.crest.environments.SystemEnvironment; import org.tomitribe.util.Files; import org.tomitribe.util.IO; @@ -78,7 +79,7 @@ public String pull(@Option("verbose") boolean verbose, String repo) { return "cmd:pull repo:" + repo; } } - + public static class Rsync { @Command @@ -104,7 +105,16 @@ public void rsync(@Option("recursive") final boolean recursive, @Test public void testRsync() throws Exception { - assertCommandHelp(Rsync.class, "rsync"); + final Environment old = Environment.set(SystemEnvironment.builder() + .name("orange") + .version("0.12") + .build()); + + try { + assertCommandHelp(Rsync.class, "rsync"); + } finally { + Environment.set(old); + } } @@ -194,46 +204,52 @@ public void annotatedParamDescription() throws Exception { public PrintStream getOutput() { return out; } - }, new String[] {"help", "test"}); + }, new String[]{"help", "test"}); assertEquals( - "Usage: test [options]" + - "Options: " + - " -a= a super parameter" + - " --b-binded= a super parameteroverrided desc" + - " --binded= overrided desc" + - " --c.binded= pre description: overrided desc" + - " -d= a parameter with default" + - " (default: otherwise)", - out.toString().replace(lineSeparator(), "")); + "Usage: test [options]" + + "Options: " + + " -a= a super parameter" + + " --b-binded= a super parameteroverrided desc" + + " --binded= overrided desc" + + " --c.binded= pre description: overrided desc" + + " -d= a parameter with default" + + " (default: otherwise)", + out.toString().replace(lineSeparator(), "")); } @Test public void name() throws Exception { final PrintString out = new PrintString(); + final Main main = Main.builder() + .command(Descripted.class) + .name("red") + .version("23.5.6") + .out(out) + .build(); + + main.run("help", "test"); - new Main(Descripted.class).main(new SystemEnvironment() { - @Override - public PrintStream getOutput() { - return out; - } - }, new String[] {"help", "test"}); assertEquals( - "Usage: test [options]" + - "Options: " + - " -a= a super parameter" + - " --b-binded= a super parameteroverrided desc" + - " --binded= overrided desc" + - " --c.binded= pre description: overrided desc" + - " -d= a parameter with default" + - " (default: otherwise)", - out.toString().replace(lineSeparator(), "")); + String.format("%n" + + "Usage: red test [options]%n" + + "%n" + + "Options: %n" + + " -a= a super parameter%n" + + " --b-binded= a super parameteroverrided desc%n" + + " --binded= overrided desc%n" + + " --c.binded= pre description: overrided desc%n" + + " -d= a parameter with default%n" + + " (default: otherwise)%n" + + "%n" + + "red 23.5.6%n"), + out.toString()); } @Test public void testOptionLists() throws Exception { assertCommandHelp(OptionLists.class, "test"); } - + @Test public void testSubCommandHelp() throws Exception { assertCommandHelp(Git.class, "git"); @@ -244,14 +260,14 @@ public void testSubCommandHelp() throws Exception { private void assertSubCommandHelp(final Class clazz, final String methodName) throws Exception { Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { - if (! methodName.equals(method.getName())) { + if (!methodName.equals(method.getName())) { continue; } - + if (method.getAnnotation(Command.class) == null) { continue; } - + CmdMethod cmd = new CmdMethod(method, new SimpleBean(null), null); assertCommandHelp(clazz, cmd, helpFileName(Git.class, "git", methodName)); } @@ -268,6 +284,12 @@ public void test() throws Exception { final String className = split[0]; final String commandName = split[1]; + if (className.equals("org.tomitribe.crest.HelpTest$Rsync")) { + // Skip as this one is slightly different and explicitly + // tested by testRsync() + continue; + } + final Class clazz = load(className); final Map commands = getCommands(parsed, clazz); final Cmd cmd = commands.get(commandName); @@ -288,7 +310,7 @@ private void assertCommandHelp(final Class clazz, final Cmd cmd) throws IOExcept String helpFileName = helpFileName(clazz, cmd.getName()); assertCommandHelp(clazz, cmd, helpFileName); } - + private void assertCommandHelp(final Class clazz, final Cmd cmd, String helpFileName) throws IOException { final URL resource = clazz.getResource("/help/" + helpFileName); assertNotNull(resource); @@ -323,7 +345,7 @@ public void generateHelp(final File helpBase, final Class clazz) throws FileNotF } for (final Cmd cmd : commands.values()) { - + try { final String name = cmd.getName(); writeHelp(helpBase, cmd, helpFileName(clazz, name)); @@ -332,14 +354,14 @@ public void generateHelp(final File helpBase, final Class clazz) throws FileNotF if (cmd instanceof CmdGroup) { final CmdGroup cmdGrp = (CmdGroup) cmd; final Map subcommands = getSubCommands(cmdGrp); - - + + for (final Cmd subCmd : subcommands.values()) { final String subCmdName = subCmd.getName(); writeHelp(helpBase, subCmd, helpFileName(clazz, name, subCmdName)); } } - + } catch (final Exception e) { continue; } @@ -356,10 +378,10 @@ private Map getSubCommands(CmdGroup cmdGrp) throws Exception { private void writeHelp(final File helpBase, final Cmd cmd, final String helpFileName) throws FileNotFoundException { final File file = new File(helpBase, helpFileName); final PrintStream print = IO.print(file); - + try { cmd.help(print); - + } finally { print.close(); } diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/AuthorTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/AuthorTest.java index 34378211..d52ebfa0 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/AuthorTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/AuthorTest.java @@ -31,7 +31,7 @@ public class AuthorTest { @Test public void justSeeAlso() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, new String[]{"help", "update"}); final String actual = env.getOut().toString(); @@ -53,7 +53,7 @@ public void justSeeAlso() throws Exception { @Test public void full() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, "help", "commit"); assertEquals("NAME\n" + " commit\n" + diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/DefaultsShownTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/DefaultsShownTest.java index d970f976..41350c84 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/DefaultsShownTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/DefaultsShownTest.java @@ -33,7 +33,7 @@ public class DefaultsShownTest { @Test public void full() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, new String[]{"help", "commit"}); assertEquals("NAME\n" + " commit\n" + diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/GenericsInMethodSignatureTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/GenericsInMethodSignatureTest.java index 56b1f07f..8f41e215 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/GenericsInMethodSignatureTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/GenericsInMethodSignatureTest.java @@ -32,7 +32,7 @@ public class GenericsInMethodSignatureTest { @Test public void test() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, new String[]{"help", "commit"}); assertEquals("NAME\n" + " commit\n" + diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/JavadocHelpComplexTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/JavadocHelpComplexTest.java index 244779c5..5d718462 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/JavadocHelpComplexTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/JavadocHelpComplexTest.java @@ -32,7 +32,7 @@ public class JavadocHelpComplexTest { @Test public void test() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Rsync.class).main(env, new String[]{"help", "rsync"}); assertEquals("NAME\n" + diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/ManualTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/ManualTest.java index bef68877..096b0b8e 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/ManualTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/ManualTest.java @@ -31,7 +31,7 @@ public class ManualTest { @Test public void test() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, new String[]{"help", "commit"}); assertEquals("NAME\n" + " commit\n" + diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/ParamWithPreformattedTextTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/ParamWithPreformattedTextTest.java index 5a46e9f0..32e59e19 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/ParamWithPreformattedTextTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/ParamWithPreformattedTextTest.java @@ -35,7 +35,7 @@ public class ParamWithPreformattedTextTest { @Test public void test() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, new String[]{"help", "commit"}); assertEquals("NAME\n" + " commit\n" + diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/SeeAlsoTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/SeeAlsoTest.java index 71139d68..ac57a56e 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/SeeAlsoTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/SeeAlsoTest.java @@ -31,7 +31,7 @@ public class SeeAlsoTest { @Test public void justSeeAlso() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, new String[]{"help", "update"}); assertEquals("NAME\n" + " update\n" + @@ -52,7 +52,7 @@ public void justSeeAlso() throws Exception { @Test public void full() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, new String[]{"help", "commit"}); assertEquals("NAME\n" + " commit\n" + diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/SubcommandTest.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/SubcommandTest.java index 81820110..907b86e6 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/SubcommandTest.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/SubcommandTest.java @@ -31,7 +31,7 @@ public class SubcommandTest { @Test public void test() throws Exception { - final TestEnvironment env = new TestEnvironment().env("NOCOLOR", ""); + final TestEnvironment env = TestEnvironment.builder().build(); new Main(Commands.class).main(env, new String[]{"help", "git", "commit"}); assertEquals("NAME\n" + " commit\n" + diff --git a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/TestEnvironment.java b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/TestEnvironment.java index bbf693dc..d1e22d3c 100644 --- a/tomitribe-crest/src/test/java/org/tomitribe/crest/help/TestEnvironment.java +++ b/tomitribe-crest/src/test/java/org/tomitribe/crest/help/TestEnvironment.java @@ -28,16 +28,28 @@ public class TestEnvironment implements Environment { - private final PrintString out = new PrintString(); - private final PrintString err = new PrintString(); - private final Properties properties = new Properties(); - private final HashMap env = new HashMap<>(); + private final PrintString out; + private final PrintString err; + private final Properties properties; + private final Map env; private final InputStream in; - - public TestEnvironment() { - in = new ByteArrayInputStream(new byte[0]); - env("NOCOLOR", ""); - env("NOLESS", ""); + private final String name; + private final String version; + + public TestEnvironment(final PrintString out, + final PrintString err, + final Properties properties, + final Map env, + final InputStream in, + final String name, + final String version) { + this.out = out; + this.err = err; + this.properties = properties; + this.env = env; + this.in = in; + this.name = name; + this.version = version; } public PrintString getOut() { @@ -82,13 +94,85 @@ public T findService(final Class type) { return null; } - public TestEnvironment env(final String name, final String value) { - this.env.put(name, value); - return this; + @Override + public String getName() { + return name; + } + + @Override + public String getVersion() { + return version; + } + + public static Builder builder() { + return new Builder(); } - public TestEnvironment property(final String name, final String value) { - this.properties.put(name, value); - return this; + + public static final class Builder { + private PrintString out = new PrintString(); + private PrintString err = new PrintString(); + private Properties properties = new Properties(); + private Map env = new HashMap<>(); + private InputStream in; + private String name; + private String version; + + private Builder() { + in = new ByteArrayInputStream(new byte[0]); + env("NOCOLOR", ""); + env("NOLESS", ""); + } + + + public Builder env(final String name, final String value) { + this.env.put(name, value); + return this; + } + + public Builder property(final String name, final String value) { + this.properties.put(name, value); + return this; + } + + public Builder out(PrintString out) { + this.out = out; + return this; + } + + public Builder err(PrintString err) { + this.err = err; + return this; + } + + public Builder properties(Properties properties) { + this.properties = properties; + return this; + } + + public Builder env(Map env) { + this.env = env; + return this; + } + + public Builder in(InputStream in) { + this.in = in; + return this; + } + + public Builder name(String name) { + this.name = name; + return this; + } + + public Builder version(String version) { + this.version = version; + return this; + } + + public TestEnvironment build() { + + return new TestEnvironment(out, err, properties, env, in, name, version); + } } } diff --git a/tomitribe-crest/src/test/resources/help/org.tomitribe.crest.HelpTest$Rsync_rsync.txt b/tomitribe-crest/src/test/resources/help/org.tomitribe.crest.HelpTest$Rsync_rsync.txt index 07961cf6..c24a6519 100644 --- a/tomitribe-crest/src/test/resources/help/org.tomitribe.crest.HelpTest$Rsync_rsync.txt +++ b/tomitribe-crest/src/test/resources/help/org.tomitribe.crest.HelpTest$Rsync_rsync.txt @@ -1,5 +1,5 @@ -Usage: rsync [options] URI... URI +Usage: orange rsync [options] URI... URI Options: --devices preserve device files (super-user only) @@ -15,3 +15,5 @@ Options: --recursive recurse into directories --specials preserve special files --times preserve times + +orange 0.12