We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For now, simargs doesn't sub commands, add subcommands support will make it much more powerful.
The syntax I could think of is like this:
const App = struct { help: bool = false, output: []const u8, sub_command1: ?struct { flags1: int, }, sub_command2: ?struct { flags1: int, }, };
Since there are more than one subcommand, we use optional to annotate them.
Or we can represent subcommand with union(enum)
union(enum)
const App = struct { help: bool = false, output: []const u8, sub_command: union(enum) { sub_cmd1: struct { flag1: i8, }, sub_cmd2: struct { flag1: i8, }, }, };
Here both method use nested struct to represent subcommands, and it can be nested at any-level!
The help message would look like this:
Usage: mycli [Global-Options] [COMMAND] [Options] Commands: sub_command1 xxx sub_command2 yyy Options: -o, --output <file> Output file -h, --help Print help
The text was updated successfully, but these errors were encountered:
I prefer the union enum approach.
Sorry, something went wrong.
Thanks, I also like the union style. I will implement this feature in next few weeks.
Successfully merging a pull request may close this issue.
For now, simargs doesn't sub commands, add subcommands support will make it much more powerful.
The syntax I could think of is like this:
Since there are more than one subcommand, we use optional to annotate them.
Or we can represent subcommand with
union(enum)
Here both method use nested struct to represent subcommands, and it can be nested at any-level!
The help message would look like this:
The text was updated successfully, but these errors were encountered: