@Test public void testTextApply() { Ansi.Text txt = Ansi.ON.apply("--p", Arrays.<Ansi.IStyle>asList(Ansi.Style.fg_red, Ansi.Style.bold)); assertEquals(Ansi.ON.new Text("@|fg(red),bold --p|@"), txt); }
public Text renderParameterLabel(ArgSpec argSpec, Ansi ansi, List<IStyle> styles) { Range capacity = argSpec.isOption() ? argSpec.arity() : ((PositionalParamSpec)argSpec).capacity(); if (capacity.max == 0) { return ansi.new Text(""); } if (argSpec.hideParamSyntax()) { return ansi.apply((argSpec.isOption() ? separator() : "") + argSpec.paramLabel(), styles); } Text paramName = ansi.apply(argSpec.paramLabel(), styles); String split = argSpec.splitRegex(); String mandatorySep = empty(split) ? " " : split;
@Test public void testTextApply() { Ansi.Text txt = Ansi.ON.apply("--p", Arrays.<Ansi.IStyle>asList(Ansi.Style.fg_red, Ansi.Style.bold)); assertEquals(Ansi.ON.new Text("@|fg(red),bold --p|@"), txt); }
public Text renderParameterLabel(ArgSpec argSpec, Ansi ansi, List<IStyle> styles) { Range capacity = argSpec.isOption() ? argSpec.arity() : ((PositionalParamSpec)argSpec).capacity(); if (capacity.max == 0) { return ansi.new Text(""); } if (argSpec.hideParamSyntax()) { return ansi.apply((argSpec.isOption() ? separator() : "") + argSpec.paramLabel(), styles); } Text paramName = ansi.apply(argSpec.paramLabel(), styles); String split = argSpec.splitRegex(); String mandatorySep = empty(split) ? " " : split;
public Text renderParameterLabel(ArgSpec argSpec, Ansi ansi, List<IStyle> styles) { return ansi.apply(argSpec.paramLabel(), styles); } public String separator() { return ""; }
/** Returns a Text with all optionParam styles applied to the specified optionParam string. * @param optionParam the option parameter string to apply the registered option parameter styles to * @return a Text with all option parameter styles applied to the specified option parameter string */ public Ansi.Text optionParamText(String optionParam) { return ansi().apply(optionParam, optionParamStyles); }
/** Returns a Text with all parameter styles applied to the specified parameter string. * @param parameter the parameter string to apply the registered parameter styles to * @return a Text with all parameter styles applied to the specified parameter string */ public Ansi.Text parameterText(String parameter) { return ansi().apply(parameter, parameterStyles); } /** Returns a Text with all optionParam styles applied to the specified optionParam string.
/** Returns a Text with all command styles applied to the specified command string. * @param command the command string to apply the registered command styles to * @return a Text with all command styles applied to the specified command string */ public Ansi.Text commandText(String command) { return ansi().apply(command, commandStyles); } /** Returns a Text with all option styles applied to the specified option string.
/** Returns a Text with all option styles applied to the specified option string. * @param option the option string to apply the registered option styles to * @return a Text with all option styles applied to the specified option string */ public Ansi.Text optionText(String option) { return ansi().apply(option, optionStyles); } /** Returns a Text with all parameter styles applied to the specified parameter string.
/** Returns a Text with all optionParam styles applied to the specified optionParam string. * @param optionParam the option parameter string to apply the registered option parameter styles to * @return a Text with all option parameter styles applied to the specified option parameter string */ public Ansi.Text optionParamText(String optionParam) { return ansi().apply(optionParam, optionParamStyles); }
public Text renderParameterLabel(ArgSpec argSpec, Ansi ansi, List<IStyle> styles) { return ansi.apply(argSpec.paramLabel(), styles); } public String separator() { return ""; }
/** Returns a Text with all parameter styles applied to the specified parameter string. * @param parameter the parameter string to apply the registered parameter styles to * @return a Text with all parameter styles applied to the specified parameter string */ public Ansi.Text parameterText(String parameter) { return ansi().apply(parameter, parameterStyles); } /** Returns a Text with all optionParam styles applied to the specified optionParam string.
/** Returns a Text with all option styles applied to the specified option string. * @param option the option string to apply the registered option styles to * @return a Text with all option styles applied to the specified option string */ public Ansi.Text optionText(String option) { return ansi().apply(option, optionStyles); } /** Returns a Text with all parameter styles applied to the specified parameter string.
/** Returns a Text with all command styles applied to the specified command string. * @param command the command string to apply the registered command styles to * @return a Text with all command styles applied to the specified command string */ public Ansi.Text commandText(String command) { return ansi().apply(command, commandStyles); } /** Returns a Text with all option styles applied to the specified option string.