Skip to content

Commit e0271b9

Browse files
committed
resolve #263
1 parent 55fbaf2 commit e0271b9

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

src/main/java/com/dtsx/astra/cli/commands/CommonOptions.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.dtsx.astra.cli.core.completions.impls.OutputTypeCompletion;
44
import com.dtsx.astra.cli.core.exceptions.internal.cli.OptionValidationException;
5+
import com.dtsx.astra.cli.core.mixins.HelpMixin;
56
import com.dtsx.astra.cli.core.output.formats.OutputType;
67
import lombok.Getter;
78
import lombok.experimental.Accessors;
@@ -15,16 +16,7 @@
1516
import static com.dtsx.astra.cli.commands.AbstractCmd.SHOW_CUSTOM_DEFAULT;
1617

1718
@Accessors(fluent = true)
18-
public class CommonOptions {
19-
@Option(
20-
names = { "-h", "--help" },
21-
description = "Show this help message and exit.",
22-
showDefaultValue = Visibility.NEVER,
23-
usageHelp = true,
24-
hidden = true
25-
)
26-
private boolean helpRequested; // unfortunately mixins not allowed in arg groups :(
27-
19+
public class CommonOptions extends HelpMixin { // I don't like extending here but mixins don't compose w/ arg groups :(
2820
@Getter
2921
private Optional<Ansi> ansi = Optional.empty();
3022

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.dtsx.astra.cli.commands.config.home;
22

3+
import com.dtsx.astra.cli.core.mixins.HelpMixin;
34
import picocli.CommandLine.Command;
5+
import picocli.CommandLine.Mixin;
46

57
@Command(
68
name = "home",
@@ -9,4 +11,7 @@
911
ConfigHomePathCmd.class,
1012
}
1113
)
12-
public class ConfigHomeCmd {}
14+
public class ConfigHomeCmd {
15+
@Mixin
16+
public HelpMixin help;
17+
}

src/main/java/com/dtsx/astra/cli/commands/db/cqlsh/CqlshCmd.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.dtsx.astra.cli.commands.db.cqlsh;
22

33
import com.dtsx.astra.cli.core.help.Example;
4+
import com.dtsx.astra.cli.core.mixins.HelpMixin;
45
import picocli.CommandLine.Command;
6+
import picocli.CommandLine.Mixin;
57

68
@Command(
79
name = "cqlsh",
@@ -29,4 +31,7 @@
2931
comment = "Execute a CQL file",
3032
command = "${cli.name} db cqlsh exec my_db -f script.cql"
3133
)
32-
public class CqlshCmd {}
34+
public class CqlshCmd {
35+
@Mixin
36+
public HelpMixin help;
37+
}

src/main/java/com/dtsx/astra/cli/commands/db/dsbulk/DbDsbulkCmd.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.dtsx.astra.cli.commands.db.dsbulk;
22

3+
import com.dtsx.astra.cli.core.mixins.HelpMixin;
34
import picocli.CommandLine.Command;
5+
import picocli.CommandLine.Mixin;
46

57
@Command(
68
name = "dsbulk",
@@ -13,4 +15,7 @@
1315
DbDsbulkPathCmd.class,
1416
}
1517
)
16-
public class DbDsbulkCmd {}
18+
public class DbDsbulkCmd {
19+
@Mixin
20+
public HelpMixin help;
21+
}

src/main/java/com/dtsx/astra/cli/commands/streaming/pulsar/StreamingPulsarCmd.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.dtsx.astra.cli.commands.streaming.pulsar;
22

33
import com.dtsx.astra.cli.core.help.Example;
4+
import com.dtsx.astra.cli.core.mixins.HelpMixin;
45
import picocli.CommandLine.Command;
6+
import picocli.CommandLine.Mixin;
57

68
@Command(
79
name = "pulsar",
@@ -24,4 +26,7 @@
2426
comment = "Get pulsar executable path",
2527
command = "${cli.name} streaming pulsar path"
2628
)
27-
public class StreamingPulsarCmd {}
29+
public class StreamingPulsarCmd {
30+
@Mixin
31+
public HelpMixin help;
32+
}

0 commit comments

Comments
 (0)