Use ArgumentParser for parsing args in generate-compile-commands
Created attachment 452771 [details] Patch
Comment on attachment 452771 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452771&action=review > Tools/Scripts/generate-compile-commands:39 > +parser = argparse.ArgumentParser(description='Generate compile_commands.json', usage='generate-compile-commands WebKitBuild/Release') Can/should this say something about how it's used overall, via `make EXPORT_COMPILE_COMMANDS=YES`? I've been following this project relatively closely, and yet I'm not sure how to set up code completion in BBEdit using this. Or maybe there could be a wiki page, linked from here. > Tools/Scripts/generate-compile-commands:40 > +parser.add_argument('built_products_dir', help='path to the build directory containing generated compile commands (ex: WebKitBuild/Release)') This seems like it should be required=True
LGTM! (In reply to Alexey Proskuryakov from comment #2) > > > Tools/Scripts/generate-compile-commands:40 > > +parser.add_argument('built_products_dir', help='path to the build directory containing generated compile commands (ex: WebKitBuild/Release)') > > This seems like it should be required=True Positional arguments are `required` by default, so it should be fine as-is.
(In reply to Alexey Proskuryakov from comment #2) > Comment on attachment 452771 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=452771&action=review > > > Tools/Scripts/generate-compile-commands:39 > > +parser = argparse.ArgumentParser(description='Generate compile_commands.json', usage='generate-compile-commands WebKitBuild/Release') > > Can/should this say something about how it's used overall, via `make > EXPORT_COMPILE_COMMANDS=YES`? I've been following this project relatively > closely, and yet I'm not sure how to set up code completion in BBEdit using > this. > > Or maybe there could be a wiki page, linked from here. > Created a page on trac on how to setup clangd. https://trac.webkit.org/wiki/Clangd It may be useful to link to the trac page in this command. > > Tools/Scripts/generate-compile-commands:40 > > +parser.add_argument('built_products_dir', help='path to the build directory containing generated compile commands (ex: WebKitBuild/Release)') > > This seems like it should be required=True If you call generate-compile-comamnds without an argument it will throw an error with a description on how to use it. > generate-compile-commands usage: generate-compile-commands WebKitBuild/Release generate-compile-commands: error: the following arguments are required: built_products_dir
Created attachment 452817 [details] Patch
Added better documentation on usage > generate-compile-commands -h usage: make r EXPORT_COMPILE_COMMANDS=YES generate-compile-commands WebKitBuild/Release https://trac.webkit.org/wiki/Clangd Generate compile_commands.json positional arguments: built_products_dir path to the build directory containing generated compile commands (ex: WebKitBuild/Release) optional arguments: -h, --help show this help message and exit
Committed r290289 (247613@main): <https://commits.webkit.org/247613@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452817 [details].
<rdar://problem/89276925>