Fury0508 opened a new pull request, #60193:
URL: https://github.com/apache/airflow/pull/60193
## ⚠️ Important: Assignment Conflict
I started working on this before realizing @douglasmnegri was assigned to
#60142 yesterday. This is my mistake as a first-time contributor.
**@douglasmnegri** - If you're working on this, please let me know and **I
will close this PR immediately**. I'm not trying to duplicate effort or
undermine your assignment.
**@bugraoz93 @jroachgolf64** - I understand the assignment protocol now and
will respect it going forward.
I'm submitting this PR to share the implementation in case it's helpful, but
I completely respect that douglasmnegri has priority here.
---
## What change does this PR introduce?
Makes required (non-nullable) parameters positional arguments in the
auto-generated airflowctl CLI commands.
## Why is this change needed?
Previously, all parameters were optional-style arguments with `--` prefix,
even when they were required. This made the CLI less intuitive and verbose.
## Related issue(s)
Related to #60142 (assigned to @douglasmnegri)
## Changes
- Modified `_create_arg()` to accept `is_required` parameter
- Updated `_create_arg_for_non_primitive_type()` to pass `is_required` based
on `field_type.is_required()`
- Required non-boolean parameters are now positional (no `--` prefix)
- Optional parameters remain as options with `--` prefix and proper `dest`
parameter
- Used `_UNSET` for positional arg dest to avoid argparse error
## Example
**Before:**
```bash
airflowctl connections create --connection-id="test" --conn-type="test"
```
**After:**
```bash
airflowctl connections create test test [--optional-params]
```
## Testing
Verified help output shows:
- `connection_id` and `conn_type` as positional arguments
- Optional params (`description`, `host`, `login`, etc.) with `--` prefix
- Command accepts new syntax correctly
## Help Output
```
Usage: airflowctl connections create [-h] [options] connection_id conn_type
Positional Arguments:
connection_id connection_id for connection operation
conn_type conn_type for connection operation
Options:
--description DESCRIPTION
--host HOST
--login LOGIN
...
```
---
**Again, happy to close this if @douglasmnegri is working on it. Just wanted
to share the solution!**
--
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]