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

Required flags #2

Closed
antoniaklja opened this issue Nov 4, 2018 · 7 comments
Closed

Required flags #2

antoniaklja opened this issue Nov 4, 2018 · 7 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@antoniaklja
Copy link
Contributor

antoniaklja commented Nov 4, 2018

It would be nice to enforce required flags and validate them (if nil or empty) before executing any encrypt/decrypt action.

Few examples of required flags:
gcp: --location, --project, key, keyring
aws: --region, key-id
etc.

Unfortunately, library what we use doesn't support Required Flags.
urfave/cli#85 - issue is still open

@antoniaklja antoniaklja added the help wanted Extra attention is needed label Nov 4, 2018
@pawelprazak
Copy link
Contributor

pawelprazak commented Nov 7, 2018

I kind of get the explanation in the upstream issue, params validation is more of a "business logic".

I'd implement it as preconditions in the command, e.g.:
genuinetools/reg@58cebba#diff-f6da2430393ce391e4517013b6d3a95bL14

@pdolega
Copy link
Contributor

pdolega commented Nov 7, 2018

Yeah, that would obviously work 👍
(and is often the only way - e.g. when you have conditionally required flags).

Normally I guess the added benefit (of having this possible in library) is that:

  • this check is implicit (obviously - that's the whole point)
  • it gets automatically marked appropriately in --help messages

@pawelprazak
Copy link
Contributor

pawelprazak commented Nov 7, 2018

@pawelprazak
Copy link
Contributor

There's also a 4 yo PR ;)
urfave/cli#155

@pawelprazak pawelprazak added the enhancement New feature or request label May 14, 2019
@pawelprazak
Copy link
Contributor

we might as well migrate to cobra library (used by kubectl)

@coilysiren
Copy link

🎁 I come bearing gifts! 🎁 urfave/cli#819

@jakubmikusek jakubmikusek self-assigned this Aug 21, 2019
jakubmikusek added a commit to jakubmikusek/crypt that referenced this issue Aug 21, 2019
jakubmikusek added a commit to jakubmikusek/crypt that referenced this issue Aug 21, 2019
antoniaklja pushed a commit that referenced this issue Aug 21, 2019
* #2 Update urfave/cli.v1 package to support required flags

* #2 Make relevant flags required
@antoniaklja
Copy link
Contributor Author

fixed in v0.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants