This is an automated email from the ASF dual-hosted git repository.
bugraoz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new af6997a8931 bugfix(airflowctl-docs): argparse encoding (#54592)
af6997a8931 is described below
commit af6997a8931a9b8f829d26a44660e76fb3af26c3
Author: Bugra Ozturk <[email protected]>
AuthorDate: Mon Aug 18 17:57:45 2025 +0200
bugfix(airflowctl-docs): argparse encoding (#54592)
* bugfix(airflowctl): argparse encoding
* Update airflow-ctl/docs/start.rst
Co-authored-by: GPK <[email protected]>
---------
Co-authored-by: GPK <[email protected]>
---
airflow-ctl/docs/conf.py | 3 +++
airflow-ctl/docs/start.rst | 4 ++++
airflow-ctl/src/airflowctl/ctl/cli_parser.py | 6 ++++--
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/airflow-ctl/docs/conf.py b/airflow-ctl/docs/conf.py
index d075866c8bd..ec70f4df6b1 100644
--- a/airflow-ctl/docs/conf.py
+++ b/airflow-ctl/docs/conf.py
@@ -63,6 +63,9 @@ SYSTEM_TESTS_DIR: pathlib.Path | None
os.environ["AIRFLOW_PACKAGE_NAME"] = PACKAGE_NAME
+# Disable color output for documentation generation
+os.environ["NO_COLOR"] = "1"
+
# Hack to allow changing for piece of the code to behave differently while
# the docs are being built. The main objective was to alter the
# behavior of the utils.apply_default that was hiding function headers
diff --git a/airflow-ctl/docs/start.rst b/airflow-ctl/docs/start.rst
index 523e7696b6d..a57c342ed59 100644
--- a/airflow-ctl/docs/start.rst
+++ b/airflow-ctl/docs/start.rst
@@ -27,6 +27,10 @@ To get started, you can use the following command to create
a new Airflow CTL en
airflowctl auth login --username <username> --password <password> --api-url
<api_url> --env <env_name>
+To persist the environment, you can set ``AIRFLOW_CLI_ENVIRONMENT``.
+The environment variable should be the name of the environment you want to use.
+This will allow users to switch environments easily.
+
OR
.. code-block:: bash
diff --git a/airflow-ctl/src/airflowctl/ctl/cli_parser.py
b/airflow-ctl/src/airflowctl/ctl/cli_parser.py
index 138f714462a..894ac8cbcda 100644
--- a/airflow-ctl/src/airflowctl/ctl/cli_parser.py
+++ b/airflow-ctl/src/airflowctl/ctl/cli_parser.py
@@ -103,14 +103,16 @@ class LazyRichHelpFormatter(RawTextRichHelpFormatter):
@cache
-def get_parser(dag_parser: bool = False) -> argparse.ArgumentParser:
+def get_parser() -> argparse.ArgumentParser:
"""Create and returns command line argument parser."""
parser = DefaultHelpParser(prog="airflowctl",
formatter_class=AirflowHelpFormatter)
subparsers = parser.add_subparsers(dest="subcommand",
metavar="GROUP_OR_COMMAND")
subparsers.required = True
for _, sub in sorted(ALL_COMMANDS_DICT.items()):
- _add_command(subparsers, sub)
+ _add_command(
+ subparsers, GroupCommandParser.from_group_command(sub) if
isinstance(sub, GroupCommand) else sub
+ )
return parser