Skip to content
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

build: sort.py: add -h option for help #6562

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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