Skip to content

Help with design a structure #2166

Answered by remkop
kmosakowski asked this question in Q&A
Dec 13, 2023 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

Instead of @ArgGroup, I believe you want to use @Command instead.

From your diagram it sounds like you want something like this:

@Command(subcommands = { Command1.class, Command2.class, Command3.class})
class Input { // maybe implements Runnable if this command also has functionality
    @Option(names = {"-d", "--debug"}, scope = ScopeType.INHERIT) // option is shared with subcommands
    boolean debug;
}

@Command
class Command1 implements Runnable { ... }

@Command
class Command2 implements Runnable { ... }

@Command(subcommands = { SubCommand1.class, SubCommand2.class, SubCommand3.class})
class Command3 implements Runnable { 
     @Option(names = "-x")
     String x;

     @Option(names

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@kmosakowski
Comment options

@remkop
Comment options

@kmosakowski
Comment options

@kmosakowski
Comment options

@remkop
Comment options

Answer selected by kmosakowski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants