diff --git a/airflow/cli/cli_config.py b/airflow/cli/cli_config.py index c8b1c6831f485..b59fea7893421 100644 --- a/airflow/cli/cli_config.py +++ b/airflow/cli/cli_config.py @@ -37,6 +37,7 @@ from airflow.settings import _ENABLE_AIP_44 from airflow.utils.cli import ColorMode from airflow.utils.module_loading import import_string +from airflow.utils.state import DagRunState from airflow.utils.timezone import parse as parsedate BUILD_DOCS = "BUILDING_AIRFLOW_DOCS" in os.environ @@ -277,7 +278,13 @@ def string_lower_type(val): ARG_NO_BACKFILL = Arg( ("--no-backfill",), help="filter all the backfill dagruns given the dag id", action="store_true" ) -ARG_STATE = Arg(("--state",), help="Only list the dag runs corresponding to the state") +dagrun_states = tuple(state.value for state in DagRunState) +ARG_STATE = Arg( + ("--state",), + help="Only list the dag runs corresponding to the state", + metavar=", ".join(dagrun_states), + choices=dagrun_states, +) # list_jobs ARG_DAG_ID_OPT = Arg(("-d", "--dag-id"), help="The id of the dag")