RESOLVED FIXED 236995
Use ArgumentParser for parsing args in generate-compile-commands
https://bugs.webkit.org/show_bug.cgi?id=236995
Summary Use ArgumentParser for parsing args in generate-compile-commands
Brandon
Reported 2022-02-21 13:46:00 PST
Use ArgumentParser for parsing args in generate-compile-commands
Attachments
Patch (1.81 KB, patch)
2022-02-21 13:49 PST, Brandon
no flags
Patch (1.97 KB, patch)
2022-02-21 19:38 PST, Brandon
no flags
Brandon
Comment 1 2022-02-21 13:49:05 PST
Alexey Proskuryakov
Comment 2 2022-02-21 14:12:51 PST
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
Elliott Williams
Comment 3 2022-02-21 17:36:57 PST
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.
Brandon
Comment 4 2022-02-21 18:38:03 PST
(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
Brandon
Comment 5 2022-02-21 19:38:27 PST
Brandon
Comment 6 2022-02-21 19:39:15 PST
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
EWS
Comment 7 2022-02-21 22:44:52 PST
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].
Radar WebKit Bug Importer
Comment 8 2022-02-21 22:45:21 PST
Note You need to log in before you can comment on or make changes to this bug.