zhongjiajie created AIRFLOW-6330:
------------------------------------

             Summary: Show cli help when param blank or typo
                 Key: AIRFLOW-6330
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6330
             Project: Apache Airflow
          Issue Type: Improvement
          Components: cli
    Affects Versions: 1.10.6
            Reporter: zhongjiajie
            Assignee: zhongjiajie


Show cli help when param blank or typo

When user enter Airflow cli with *blank parameter* or typo arg, or use wrong 
parameter show Airflow cli help. Example like below
{code:java}
// when you enter 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.



// So as the subcommands
$ 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.{code}
When you *typo* parameter
{code:java}
// when you typo or wrong parameter, if will show you cli help and the preset 
parameter to use in error line

$ 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.{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to