zhongjiajie commented on issue #6883: [AIRFLOW-6330] Show cli help when param 
blank or typo
URL: https://github.com/apache/airflow/pull/6883#issuecomment-568534370
 
 
   This patch change cli behavior like below 
   
   * **Main command** or just `Airflow`
   ```sh
   # Only airflow with blank parameter
   $ airflow
   
   usage: airflow [-h]
   
{config,connections,dags,db,flower,kerberos,pools,roles,rotate_fernet_key,scheduler,sync_perm,tasks,users,variables,version,webserver,worker}
                           sub-command help
       config              Show current application configuration
       connections         List/Add/Delete connections
       dags                List and manage DAGs
       db                  Database operations
       flower              Start a Celery Flower
       kerberos            Start a kerberos ticket renewer
       pools               CRUD operations on pools
       roles               Create/List roles
       rotate_fernet_key   Rotate all encrypted connection credentials and
                           variables; see
                           
https://airflow.readthedocs.io/en/stable/howto/secure-
                           connections.html#rotating-encryption-keys
       scheduler           Start a scheduler instance
       sync_perm           Update permissions for existing roles and DAGs
       tasks               List and manage tasks
       users               CRUD operations on users
       variables           CRUD operations on variables
       version             Show the version
       webserver           Start a Airflow webserver instance
       worker              Start a Celery worker nodeoptional arguments:
     -h, --help            show this help message and exit
   
   airflow command error: the following arguments are required: subcommand, see 
help above.
   
   
   # airflow [subcommands] with blank parameter
   $ airflow connections
   
   usage: airflow connections [-h] {list,add,delete} ...positional arguments:
     {list,add,delete}
       list             List connections
       add              Add a connection
       delete           Delete a connectionoptional arguments:
     -h, --help         show this help message and exit
   
   airflow connections command error: the following arguments are required: 
subcommand, see help above.
   ```
   
   * **typo** or **wrong** parameter
   ```sh
   $ airflow connections docker
   
   usage: airflow connections [-h] {list,add,delete} ...positional arguments:
     {list,add,delete}
       list             List connections
       add              Add a connection
       delete           Delete a connectionoptional arguments:
     -h, --help         show this help message and exit
   
   airflow connections command error: argument subcommand: invalid choice: 
'docker' (choose from 'list', 'add', 'delete'), see help above.
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to