theforeman / theforeman/foremanctl
Group arguments in the help text
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 27
- Forks
- 47
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 40
Description
Consider grouping related parameters and using this to help order them logically for users. For example, presently the --add-feature and --remove-feature appear in different locations spread through the options.
Metadata
Add an optional group key to variable definitions in metadata.obsah.yaml:
variables:
foreman_initial_admin_username:
help: Initial username for the admin user.
group: Initialization
foreman_initial_admin_password:
help: Initial password for the admin user.
group: Initialization
certificates_cnames:
help: Additional DNS name to include in Subject Alternative Names for certificates.
action: append_unique
type: FQDN
parameter: --certificate-cname
group: Certificates
Variables without a group are added to the default "options" section as they are today.
Group assignment via include
Included metadata files can define groups on their own variables. For example, _database_connection/metadata.obsah.yaml could set group: Database on all its variables, and when included by deploy, those arguments would appear grouped under "Database" in the help output.
Alternatively, the including file could specify a default group for all variables pulled from an include:
include:
- name: _database_connection
group: Database
- name: _tuning
- name: _flavor_features
This would assign the group to all variables from the included file that don't already have an explicit group set. The simple string form (- _database_connection) would continue to work as today with no group assignment.
Ordering
argparse displays argument groups in the order they are created. To control group ordering, a top-level groups key could define the display order:
groups:
- Initialization
- Certificates
- Database
- Tuning
variables:
...
Groups not listed in this ordering would appear after the listed groups. This key is optional — without it, groups appear in the order they are first encountered while iterating variables.
Proposed grouping for deploy
| Group | Arguments |
|---|---|
| Initialization | --initial-admin-username, --initial-admin-password |
| Certificates | --certificate-cname, --server-certificate, --server-key, --server-ca-certificate |
| Database | --database-mode, --database-host, --database-port, --database-ssl-mode, --database-ssl-ca, --foreman-database-*, --candlepin-database-*, --pulp-database-* |
| Authentication | --external-authentication, --external-authentication-pam-service |
| Tuning | --tuning, --puma-workers, --pulp-worker-count |
| (ungrouped) | --flavor, --add-feature, --remove-feature |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with deploy and its metadata.obsah.yaml, then inspect how included files such as _database_connection/metadata.obsah.yaml contribute variables to the help output. Implement optional variable and include groups plus top-level group ordering, preserving ungrouped options and the simple include form. Done means grouped arguments appear in the requested order and existing metadata without groups continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100