private Config parseConfig(CommandLine commandLine) throws IOException { if(commandLine.hasOption("updatepassword")) { new KeyUpdateParser( KeyEncryptorFactory.create(), PasswordReaderFactory.create() ).parse(commandLine); //return early so other options don't get processed return null; } final List<ConfigKeyPair> newKeys = new KeyGenerationParser().parse(commandLine); final Config config = new ConfigurationParser().withNewKeys(newKeys).parse(commandLine); if (!commandLine.hasOption("configfile") && !commandLine.hasOption("keygen") && !commandLine.hasOption("updatepassword")) { throw new CliException("One or more: -configfile or -keygen or -updatepassword options are required."); } return config; }
private Config parseConfig(CommandLine commandLine) throws IOException { if(commandLine.hasOption("updatepassword")) { new KeyUpdateParser( KeyEncryptorFactory.create(), PasswordReaderFactory.create() ).parse(commandLine); //return early so other options don't get processed return null; } final List<ConfigKeyPair> newKeys = new KeyGenerationParser().parse(commandLine); final Config config = new ConfigurationParser().withNewKeys(newKeys).parse(commandLine); if (!commandLine.hasOption("configfile") && !commandLine.hasOption("keygen") && !commandLine.hasOption("updatepassword")) { throw new CliException("One or more: -configfile or -keygen or -updatepassword options are required."); } return config; }
NaclFacadeFactory.newFactory().create(), KeyEncryptorFactory.create(), PasswordReaderFactory.create() );