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

[AIRFLOW-6330] Show cli help when param blank or typo #6883

Merged
merged 1 commit into from
Dec 25, 2019

Conversation

zhongjiajie
Copy link
Member

When enter Airflow cli with blank parameter
or typo parameter or wrong parameter will
show Airflow cli help just like enter
Airflow [command] -h command

Make sure you have checked all steps below.

Jira

  • My PR addresses the following Airflow Jira issues and references them in the PR title. For example, "[AIRFLOW-XXX] My Airflow PR"
    • https://issues.apache.org/jira/browse/AIRFLOW-6330
    • In case you are fixing a typo in the documentation you can prepend your commit with [AIRFLOW-XXX], code changes always need a Jira issue.
    • In case you are proposing a fundamental code change, you need to create an Airflow Improvement Proposal (AIP).
    • In case you are adding a dependency, check if the license complies with the ASF 3rd Party License Policy.

Description

  • Here are some details about my PR, including screenshots of any UI changes:

When enter Airflow cli with blank parameter
or typo parameter or wrong parameter will
show Airflow cli help just like enter
Airflow [command] -h command

@zhongjiajie
Copy link
Member Author

This patch change cli behavior like below

  • Main command or just Airflow
# 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
$ 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.

@kaxil
Copy link
Member

kaxil commented Dec 23, 2019

Travis is sad:

airflow/bin/cli.py:1002:8: C0111: Missing class docstring (missing-docstring)

@codecov-io
Copy link

codecov-io commented Dec 24, 2019

Codecov Report

Merging #6883 into master will decrease coverage by 0.28%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6883      +/-   ##
==========================================
- Coverage   84.62%   84.33%   -0.29%     
==========================================
  Files         679      679              
  Lines       38497    38501       +4     
==========================================
- Hits        32578    32470     -108     
- Misses       5919     6031     +112
Impacted Files Coverage Δ
airflow/bin/cli.py 93.42% <60%> (-2.42%) ⬇️
airflow/kubernetes/volume_mount.py 44.44% <0%> (-55.56%) ⬇️
airflow/kubernetes/volume.py 52.94% <0%> (-47.06%) ⬇️
airflow/kubernetes/pod_launcher.py 45.25% <0%> (-46.72%) ⬇️
airflow/kubernetes/refresh_config.py 50.98% <0%> (-23.53%) ⬇️
...rflow/contrib/operators/kubernetes_pod_operator.py 78.75% <0%> (-20%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d0fbb52...8261c25. Read the comment docs.

@zhongjiajie zhongjiajie force-pushed the cli_show_help_blank_param_typo branch 2 times, most recently from 29db8e0 to 8e96c2a Compare December 25, 2019 02:20
When enter Airflow cli with blank parameter
or typo parameter or wrong parameter will
show Airflow cli help just like enter
`Airflow [command] -h` command
@zhongjiajie
Copy link
Member Author

Finally CI green, PTAL @kaxil @mik-laj @potiuk

@potiuk potiuk merged commit 581a395 into apache:master Dec 25, 2019
@potiuk
Copy link
Member

potiuk commented Dec 25, 2019

Nice one @zhongjiajie !

@zhongjiajie zhongjiajie deleted the cli_show_help_blank_param_typo branch December 25, 2019 10:30
potiuk pushed a commit that referenced this pull request Jan 21, 2020
When enter Airflow cli with blank parameter
or typo parameter or wrong parameter will
show Airflow cli help just like enter
`Airflow [command] -h` command

(cherry picked from commit 581a395)
kaxil pushed a commit that referenced this pull request Jan 22, 2020
When enter Airflow cli with blank parameter
or typo parameter or wrong parameter will
show Airflow cli help just like enter
`Airflow [command] -h` command

(cherry picked from commit 581a395)
kaxil pushed a commit that referenced this pull request Jan 23, 2020
When enter Airflow cli with blank parameter
or typo parameter or wrong parameter will
show Airflow cli help just like enter
`Airflow [command] -h` command

(cherry picked from commit 581a395)
potiuk pushed a commit that referenced this pull request Jan 26, 2020
When enter Airflow cli with blank parameter
or typo parameter or wrong parameter will
show Airflow cli help just like enter
`Airflow [command] -h` command

(cherry picked from commit 581a395)
galuszkak pushed a commit to FlyrInc/apache-airflow that referenced this pull request Mar 5, 2020
When enter Airflow cli with blank parameter
or typo parameter or wrong parameter will
show Airflow cli help just like enter
`Airflow [command] -h` command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants