zhongjiajie commented on a change in pull request #6881: [AIRFLOW-6326] Sort
cli commands and arg
URL: https://github.com/apache/airflow/pull/6881#discussion_r360776082
##########
File path: airflow/bin/cli.py
##########
@@ -1022,10 +1022,10 @@ def _add_subcommand(cls, subparsers, sub):
if subcommands:
sub_subparsers = sub_proc.add_subparsers(dest='subcommand')
sub_subparsers.required = True
- for command in subcommands:
+ for command in sorted(subcommands, key=lambda x: x['name']):
Review comment:
I think this change is acceptable, it keep `subcommand` in alphabetical, it
change cli command like below
```sh
# airflow pools -h
# before
usage: airflow pools [-h] {list,get,set,delete,import,export} ...
positional arguments:
{list,get,set,delete,import,export}
list List pools
get Get pool size
set Configure pool
delete Delete pool
import Import pools
export Export all pools
optional arguments:
-h, --help show this help message and exit
# after
usage: airflow pools [-h] {delete,export,get,import,list,set} ...
positional arguments:
{delete,export,get,import,list,set}
delete Delete pool
export Export all pools
get Get pool size
import Import pools
list List pools
set Configure pool
optional arguments:
-h, --help show this help message and exit
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services