shivaam opened a new pull request, #64812:
URL: https://github.com/apache/airflow/pull/64812

   Required non-boolean parameters in auto-generated CLI commands are now 
positional instead of flag-style, improving UX consistency with manually 
defined commands like `dags pause`.
   
   **Before:**
   ```bash
   airflowctl connections create --connection-id="test" --conn-type="mysql" 
--password=secret
   airflowctl dags get --dag-id=example_bash_operator
   ```
   
   **After:**
   ```bash
   airflowctl connections create test mysql --password=secret
   airflowctl dags get example_bash_operator
   ```
   
   ### Changes
   
   - Track which operation parameters have default values during AST parsing
   - For primitive params, use the default info to decide positional vs flag
   - For Pydantic model fields, use `is_required()` to decide positional vs flag
   - Use `_UNSET` for `arg_dest` default to avoid argparse crash on positional 
args
   - Skip the `has_default` metadata key at runtime when mapping CLI args to 
method params
   - Updated unit tests and integration test commands to match new positional 
syntax
   - Added 2 new tests for positional arg behavior and default detection
   
   ### Notes
   
   - `_create_arg` stays a dumb pass-through builder — all positional/flag 
logic is in the callers via one-liner conditionals
   - Booleans are never positional (they need `--flag/--no-flag`)
   - No special-casing for specific operations
   - **This is a breaking change** for anyone using the `--flag=value` style 
for required params. Since airflowctl is new and not yet stable, this may be 
acceptable — happy to add a newsfragment if needed.
   
   ### Open question
   
   Posted a [clarifying 
question](https://github.com/apache/airflow/issues/60142#issuecomment-4194675332)
 on the issue about whether all required params should be positional (e.g., 
`xcom add` has 5 positional args), or if we should limit it.
   
   closes: #60142
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Claude Opus 4.6)
   
   Generated-by: Claude Code (Claude Opus 4.6) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to