Skip to content

Commit

Permalink
build: sort.py: add -h option for help
Browse files Browse the repository at this point in the history
Print the usage if `-h` is given.

Kind of relates to netblue30#6290.
  • Loading branch information
kmk3 committed Dec 1, 2024
1 parent 245a0ab commit 9261fbc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contrib/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
__doc__ = f"""\
Sort the arguments of commands in profiles.
Usage: {path.basename(argv[0])} [-i] [-n] [--] [/path/to/profile ...]
Usage: {path.basename(argv[0])} [-h] [-i] [-n] [--] [/path/to/profile ...]
The following commands are supported:
Expand All @@ -21,6 +21,7 @@
Note that this is only applicable to commands that support multiple arguments.
Options:
-h Print this message.
-i Edit the profile file(s) in-place (this is the default).
-n Do not edit the profile file(s) in-place.
-- End of options.
Expand Down Expand Up @@ -105,7 +106,10 @@ def check_profile(filename, overwrite):
def main(args):
overwrite = True
while len(args) > 0:
if args[0] == "-i":
if args[0] == "-h":
print(__doc__)
return 0
elif args[0] == "-i":
overwrite = True
args.pop(0)
elif args[0] == "-n":
Expand Down

0 comments on commit 9261fbc

Please sign in to comment.