Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cli argument handling #2099

Merged

Conversation

ziegenberg
Copy link
Contributor

@ziegenberg ziegenberg commented May 3, 2022

Changes

  • gracefully handle invalid format options (-f) with listing rules (-L)
  • put arguments -L and -T into a mutually exclusive group
    We either print a list of rules or a list of tags, but never both at the same time. So it makes no sense to allow giving both arguments at the same time.
  • always provide a long form of CLI arguments
    Having short CLI arguments for often used options is nice to have when using the command in an interactive shell. For writing scripts, it would be better to have long forms of arguments as it increases the readability.

ℹ️ Note: This PR contains commits from PR #2098, which should be merged first.

@ziegenberg ziegenberg force-pushed the gracefully-handle-wrong-cli-arguments branch from 152baa6 to 471da7c Compare May 3, 2022 17:17
@ziegenberg ziegenberg marked this pull request as ready for review May 3, 2022 17:19
@ziegenberg ziegenberg requested review from a team as code owners May 3, 2022 17:19
With PR ansible#1450 optional rules with the 'opt-in' tag were introduced
and according to the docs, listing rules and tags should also list
the opt-in rules.

Fixes: ansible#2068

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
We either print a list of rules or a list of tags, but never
both at the same time. So it makes no sense to allow giving
both arguments at the same time.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
Having short cli arguments for often used options is nice to have
when using the command in an interactive shell. For writing scripts
it would be better to have long forms of arguments as it increases
the readebility.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
@ziegenberg ziegenberg force-pushed the gracefully-handle-wrong-cli-arguments branch from 471da7c to d4c3ae7 Compare May 4, 2022 10:00
@ssbarnea ssbarnea merged commit f9ad8ea into ansible:main May 4, 2022
@ziegenberg ziegenberg deleted the gracefully-handle-wrong-cli-arguments branch May 4, 2022 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants