-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
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
Re-write argument parsing #35
base: main
Are you sure you want to change the base?
Conversation
Adds `parse_args`, `check_required_args`, and `check_unknown_args`. Signed-off-by: Jake Correnti <[email protected]>
Updates the argument parsing for `virtio-blk` to use new helper functions. Makes the `format=` argument optional and provides the default value `raw`. Signed-off-by: Jake Correnti <[email protected]>
Updates virtio-net argument parsing to use new helper functions. Signed-off-by: Jake Correnti <[email protected]>
Updates virtio-serial argument parsing to use the new helper functions Signed-off-by: Jake Correnti <[email protected]>
Updates virtio-vsock argument parsing to use the new helper functions Signed-off-by: Jake Correnti <[email protected]>
Updates virtio-fs argument parsing to use the new helper functions Signed-off-by: Jake Correnti <[email protected]>
Updates virtio-input to use the new helper functions Signed-off-by: Jake Correnti <[email protected]>
Updates virtio-gpu to use the new helper functions Signed-off-by: Jake Correnti <[email protected]>
Signed-off-by: Jake Correnti <[email protected]>
Updates the argument parsing in src/cmdline.rs to no longer use `args_parse` or `val_parse`. Signed-off-by: Jake Correnti <[email protected]>
3f06cb5
to
c774914
Compare
The args needed to be in order for the virtio-blk arguments. The first virtio-blk arg was the root disk ( |
Not all were required, I believe? |
Maybe my phrasing here is wrong, but I'm talking about the order of the arguments for |
The previous method for parsing the command-line arguments required the device arguments, for example, to be in a hard-coded order, and they were all considered required. Additionally, if a specific argument was missing, or there were extra arguments, the error messages could be somewhat vague.
These changes allow for more granular error message, optional arguments that have a default value, and for the user to put the arguments in any particular order.
Fixes: #30