private static NonOptionArgumentSpec<URI> makeBaseUriSpec(OptionParser optionParser) { return optionParser.nonOptions(CommandDescription.DESCRIPTION_BASE_URI).ofType(URI.class); }
public NonOptionArgumentSpec<String> nonOptions() { NonOptionArgumentSpec<String> spec = new NonOptionArgumentSpec<>(); recognize( spec ); return spec; }
public String argumentTypeIndicator() { return argumentTypeIndicatorFrom( converter ); }
String baseFormat = baseCsvFormatOs.value(options); baseFormat = baseFormat == null ? "" : baseFormat.trim().toLowerCase();
"Disables ALL warnings."); OptionSpec<File> inputsOption = parser.nonOptions() .ofType(File.class).describedAs("Files to process.");
@Override protected void execute(Terminal terminal, OptionSet options) throws Exception { if (subcommands.isEmpty()) { throw new IllegalStateException("No subcommands configured"); } String[] args = arguments.values(options).toArray(new String[0]); if (args.length == 0) { throw new UserException(ExitCodes.USAGE, "Missing command"); } Command subcommand = subcommands.get(args[0]); if (subcommand == null) { throw new UserException(ExitCodes.USAGE, "Unknown command [" + args[0] + "]"); } subcommand.mainWithoutErrorHandling(Arrays.copyOfRange(args, 1, args.length), terminal); }
@Override protected final V convert( String argument ) { return convertWith( converter, argument ); }
String baseFormat = baseCsvFormatOs.value(options); baseFormat = baseFormat == null ? "" : baseFormat.trim().toLowerCase();
@Override protected void execute(Terminal terminal, OptionSet options) throws Exception { if (subcommands.isEmpty()) { throw new IllegalStateException("No subcommands configured"); } String[] args = arguments.values(options).toArray(new String[0]); if (args.length == 0) { throw new UserException(ExitCodes.USAGE, "Missing command"); } Command subcommand = subcommands.get(args[0]); if (subcommand == null) { throw new UserException(ExitCodes.USAGE, "Unknown command [" + args[0] + "]"); } subcommand.mainWithoutErrorHandling(Arrays.copyOfRange(args, 1, args.length), terminal); } }
@Override protected final V convert( String argument ) { return convertWith( converter, argument ); }
String modeValue = modeSpec.value(set);
private static NonOptionArgumentSpec<URI> makeBaseUriSpec(OptionParser optionParser) { return optionParser.nonOptions(CommandDescription.DESCRIPTION_BASE_URI).ofType(URI.class); }
@Override protected void execute(Terminal terminal, OptionSet options) throws Exception { if (subcommands.isEmpty()) { throw new IllegalStateException("No subcommands configured"); } String[] args = arguments.values(options).toArray(new String[0]); if (args.length == 0) { throw new UserException(ExitCodes.USAGE, "Missing command"); } Command subcommand = subcommands.get(args[0]); if (subcommand == null) { throw new UserException(ExitCodes.USAGE, "Unknown command [" + args[0] + "]"); } subcommand.mainWithoutErrorHandling(Arrays.copyOfRange(args, 1, args.length), terminal); } }
public NonOptionArgumentSpec<String> nonOptions( String description ) { NonOptionArgumentSpec<String> spec = new NonOptionArgumentSpec<>( description ); recognize( spec ); return spec; }
@Override public String argumentTypeIndicator() { return argumentTypeIndicatorFrom( converter ); }
URI baseUri = baseUriSpec.value(optionSet); if (baseUri == null) { System.out.println("No base URI parameter specified. (Use: <command> <base URI>)");
@Override public NonOptionArgumentSpec<String> nonOptions( String description ) { NonOptionArgumentSpec<String> spec = new NonOptionArgumentSpec<>( description ); recognize( spec ); return spec; }
URI baseUri = baseUriSpec.value(optionSet); if (baseUri == null) { System.out.println("No base URI parameter specified. (Use: <command> <base URI>)");
@Override public NonOptionArgumentSpec<String> nonOptions() { NonOptionArgumentSpec<String> spec = new NonOptionArgumentSpec<>(); recognize( spec ); return spec; }
/** * Creates an option parser that initially recognizes no options, and does not exhibit "POSIX-ly correct" * behavior. * * @param allowAbbreviations whether unambiguous abbreviations of long options should be recognized * by the parser */ public OptionParser( boolean allowAbbreviations ) { trainingOrder = new ArrayList<>(); requiredIf = new HashMap<>(); requiredUnless = new HashMap<>(); availableIf = new HashMap<>(); availableUnless = new HashMap<>(); state = moreOptions( false ); recognizedOptions = allowAbbreviations ? new AbbreviationMap<AbstractOptionSpec<?>>() : new SimpleOptionNameMap<AbstractOptionSpec<?>>(); recognize( new NonOptionArgumentSpec<String>() ); }