Skip to content

Commit

Permalink
feat: Improved command usage help
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Ruaux committed Aug 16, 2022
1 parent b261819 commit 4c7ad7d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import picocli.CommandLine.Command;
import picocli.CommandLine.Parameters;

@Command(name = "import", description = "Import delimited, fixed-width, JSON, or XML files into Redis.")
@Command(name = "import", description = "Import CSV/JSON/XML files into Redis.")
public class FileImportCommand extends AbstractImportCommand {

private static final Logger log = Logger.getLogger(FileImportCommand.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

public class GeneratorOptions {

@Option(names = "--start", description = "Start index (default: ${DEFAULT-VALUE})", paramLabel = "<int>")
@Option(names = "--start", description = "Start index (default: ${DEFAULT-VALUE}).", paramLabel = "<int>")
protected int start = 1;
@Option(names = "--count", description = "Number of items to generate (default: ${DEFAULT-VALUE})", paramLabel = "<int>")
@Option(names = "--count", description = "Number of items to generate (default: ${DEFAULT-VALUE}).", paramLabel = "<int>")
protected int count = 1000;
@Option(names = "--sleep", description = "Duration in ms to sleep before each item generation (default: ${DEFAULT-VALUE})", paramLabel = "<ms>")
@Option(names = "--sleep", description = "Duration in ms to sleep before each item generation.", paramLabel = "<ms>")
private Optional<Long> sleep = Optional.empty();

public int getStart() {
Expand Down
5 changes: 3 additions & 2 deletions core/riot-core/src/main/java/com/redis/riot/RedisOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public class RedisOptions {
private Optional<char[]> password = Optional.empty();
@Option(names = { "-u", "--uri" }, description = "Server URI.", paramLabel = "<uri>")
private RedisURI uri;
@Option(names = "--timeout", description = "Redis command timeout (default: ${DEFAULT-VALUE}).", paramLabel = "<sec>")
@Option(names = "--timeout", description = "Redis command timeout.", paramLabel = "<sec>")
private Optional<Long> timeout = Optional.empty();
@Option(names = { "-n", "--db" }, description = "Database number (default: ${DEFAULT-VALUE}).", paramLabel = "<db>")
@Option(names = { "-n", "--db" }, description = "Database number.", paramLabel = "<db>")
private Optional<Integer> database = Optional.empty();
@Option(names = { "-c", "--cluster" }, description = "Enable cluster mode.")
private boolean cluster;
Expand Down Expand Up @@ -163,6 +163,7 @@ public void setCluster(boolean cluster) {
this.cluster = cluster;
}

@SuppressWarnings("deprecation")
public RedisURI uri() {
RedisURI redisURI = uri == null ? RedisURI.create(host, port) : uri;
insecure.ifPresent(b -> redisURI.setVerifyPeer(!b));
Expand Down
6 changes: 3 additions & 3 deletions core/riot-core/src/main/java/com/redis/riot/RiotApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public class RiotApp {
@Option(names = { "-V", "--version" }, versionHelp = true, description = "Print version information and exit.")
private boolean versionRequested;

@ArgGroup(heading = "Redis connection options%n", exclusive = false)
private RedisOptions redisOptions = new RedisOptions();

@ArgGroup(heading = "Logging options%n", exclusive = false)
private LoggingOptions loggingOptions = new LoggingOptions();

@ArgGroup(heading = "Redis connection options%n", exclusive = false)
private RedisOptions redisOptions = new RedisOptions();

public RedisOptions getRedisOptions() {
return redisOptions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum SkipPolicy {
private int chunkSize = 50;
@Option(names = "--skip-policy", description = "Policy to determine if some processing should be skipped: ${COMPLETION-CANDIDATES} (default: ${DEFAULT-VALUE})", paramLabel = "<name>")
private SkipPolicy skipPolicy = SkipPolicy.LIMIT;
@Option(names = "--skip-limit", description = "For LIMIT policy, max number of failed items to skip before considering the transfer has failed (default: ${DEFAULT-VALUE})", paramLabel = "<int>")
@Option(names = "--skip-limit", description = "LIMIT skip policy: max number of failed items before considering the transfer has failed (default: ${DEFAULT-VALUE})", paramLabel = "<int>")
private int skipLimit = 3;

public int getThreads() {
Expand Down

0 comments on commit 4c7ad7d

Please sign in to comment.