-
Notifications
You must be signed in to change notification settings - Fork 349
Cookbook recipes to parse command-line arguments #3038
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
base: main
Are you sure you want to change the base?
Conversation
I can't understand why the CI failed. I'll investigate If someone has seeing this before, I would appreciate any help. |
let arg_module_parser () = | ||
let usage_msg = | ||
"mycmd [--verbose] <file1> [<file2>] ... -o <output>" | ||
and verbose = ref false | ||
and input_files = ref [] | ||
and output_file = ref "" in | ||
(* This function is called once for each anonymous argument. *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ood-gen
is parsing this whole block as a Str.Text
, except for the final delimiter *)
. There seems to be something wrong with the string splitting (Str.full_split
, line 72).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, got it. The regex expect the delimiter (*
always at the beginning of the line. This code has indented comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any comments about this comments restriction. Would it make sense to add a comment? Or would it be better to change the regex pattern?
"ood-gen" uses a regex pattern that expects comments starting only at the beginning of lines.
The recipes in this PR contains three alternative ways to parse command-line arguments:
Sys.argv
directly.Arg
module from the standard library.Cmdliner
installed throughopam
.