static List<String> getStringList(CommandLine commandLine, Option option) { return commandLine.getValues(option); }
static List<Integer> getIntegerList(CommandLine commandLine, Option option) { List<String> list = commandLine.getValues(option); List<Integer> valList = Lists.newArrayList(); for (String str : list) { valList.add(Integer.parseInt(str)); } return valList; }
protected static void maybePut(Map<String, List<String>> args, CommandLine cmdLine, Option... opt) { for (Option o : opt) { // the option appeared on the command-line, or it has a value // (which is likely a default value). if (cmdLine.hasOption(o) || cmdLine.getValue(o) != null || (cmdLine.getValues(o) != null && !cmdLine.getValues(o).isEmpty())) { // nulls are ok, for cases where options are simple flags. List<?> vo = cmdLine.getValues(o); if (vo != null && !vo.isEmpty()) { List<String> vals = Lists.newArrayList(); for (Object o1 : vo) { vals.add(o1.toString()); } args.put(o.getPreferredName(), vals); } else { args.put(o.getPreferredName(), null); } } } }
protected static void maybePut(Map<String, List<String>> args, CommandLine cmdLine, Option... opt) { for (Option o : opt) { // the option appeared on the command-line, or it has a value // (which is likely a default value). if (cmdLine.hasOption(o) || cmdLine.getValue(o) != null || (cmdLine.getValues(o) != null && !cmdLine.getValues(o).isEmpty())) { // nulls are ok, for cases where options are simple flags. List<?> vo = cmdLine.getValues(o); if (vo != null && !vo.isEmpty()) { List<String> vals = Lists.newArrayList(); for (Object o1 : vo) { vals.add(o1.toString()); } args.put(o.getPreferredName(), vals); } else { args.put(o.getPreferredName(), null); } } } }
protected static void maybePut(Map<String, List<String>> args, CommandLine cmdLine, Option... opt) { for (Option o : opt) { // the option appeared on the command-line, or it has a value // (which is likely a default value). if (cmdLine.hasOption(o) || cmdLine.getValue(o) != null || (cmdLine.getValues(o) != null && !cmdLine.getValues(o).isEmpty())) { // nulls are ok, for cases where options are simple flags. List<?> vo = cmdLine.getValues(o); if (vo != null && !vo.isEmpty()) { List<String> vals = new ArrayList<>(); for (Object o1 : vo) { vals.add(o1.toString()); } args.put(o.getPreferredName(), vals); } else { args.put(o.getPreferredName(), null); } } } }
public void execute(CommandLine commandLine) throws ExecutionException { // TODO: move extended options support the commons-cli2 for (ExtendedOption x: xOpts) { if (commandLine.hasOption(x.getOption())) { List l = commandLine.getValues(x.getOption()); if (l.isEmpty()) { CliHelpFormatter fmt = CliHelpFormatter.create(); fmt.setCmd(x); fmt.setShowUsage(false); fmt.print(); return; } else { x.process(l.get(0).toString()); } } } super.execute(commandLine); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { File localDir = app.getPlatformFile("", true); List<String> commands = cl.getValues(argCommand); for (String cmd: commands) { if (cmd.equals("binary")) { Debug dbg = new Debug(localDir); VltContext vCtx = app.createVaultContext(localDir); vCtx.setVerbose(cl.hasOption(OPT_VERBOSE)); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); vCtx.execute(dbg); } } }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); PropList a = new PropList(localDir, localFiles, !cl.hasOption(optRecursive)); vCtx.execute(a); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setVerbose(cl.hasOption(OPT_VERBOSE)); Diff a = new Diff(localDir, localFiles, cl.hasOption(optNonRecursive)); vCtx.execute(a); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); Revert r = new Revert(localDir, localFiles, cl.hasOption(optRecursive)); vCtx.execute(r); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); PropGet a = new PropGet(localDir, localFiles, !cl.hasOption(optRecursive), (String) cl.getValue(argPropName)); vCtx.execute(a); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); Resolved a = new Resolved(localDir, localFiles, !cl.hasOption(optRecursive), cl.hasOption(optForce)); vCtx.execute(a); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setVerbose(cl.hasOption(OPT_VERBOSE)); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); Delete d = new Delete(localDir, localFiles, false, cl.hasOption(optForce)); vCtx.execute(d); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setVerbose(cl.hasOption(OPT_VERBOSE)); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); Info u = new Info(localDir, localFiles, !cl.hasOption(optRecursive)); vCtx.execute(u); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); PropSet a = new PropSet(localDir, localFiles, !cl.hasOption(optRecursive), (String) cl.getValue(argPropName), (String) cl.getValue(argPropValue)); vCtx.execute(a); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setVerbose(cl.hasOption(OPT_VERBOSE)); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); Commit s = new Commit(localDir, localFiles, cl.hasOption(optNonRecursive), cl.hasOption(optForce)); vCtx.execute(s); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setVerbose(cl.hasOption(OPT_VERBOSE)); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); Add a = new Add(localDir, localFiles, cl.hasOption(optNonRecursive), cl.hasOption(optForce)); vCtx.execute(a); }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setVerbose(cl.hasOption(OPT_VERBOSE)); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); Update u = new Update(localDir, localFiles, cl.hasOption(optNonRecursive)); u.setForce(cl.hasOption(optForce)); vCtx.execute(u); }
DefaultWorkspaceFilter srcFilter = new DefaultWorkspaceFilter(); PathFilterSet excludes = new PathFilterSet("/"); for (Object e: cl.getValues(optExclude)) { excludes.addExclude(new DefaultPathFilter(e.toString()));
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setVerbose(cl.hasOption(OPT_VERBOSE)); vCtx.setQuiet(cl.hasOption(optOnlyControlled)); Action a = cl.hasOption(optShowUpdate) ? new RemoteStatus(localDir, localFiles, cl.hasOption(optNonRecursive)) : new Status(localDir, localFiles, cl.hasOption(optNonRecursive)); vCtx.execute(a); }