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
Fixes #18878 - Adding hidden_value option to parameters #290
Conversation
This works for global parameters but it doesn't hide host parameters yet. |
b9c8fa5
to
6564816
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the in-line comments the code looks good.
@@ -26,6 +26,7 @@ class SetCommand < HammerCLIForeman::Command | |||
|
|||
option "--name", "NAME", _("parameter name"), :required => true | |||
option "--value", "VALUE", _("parameter value"), :required => true | |||
option "--hidden_value", "HIDDEN VALUE", _("should the value be hidden") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Options should have dashes only: --hidden-value
. Multi-word param names should be connected with underscore: HIDDEN_VALUE
.
lib/hammer_cli_foreman/parameter.rb
Outdated
@@ -48,6 +48,7 @@ def self.create_option_builder | |||
class SetCommand < AbstractParameterCommand | |||
option "--name", "NAME", _("parameter name"), :required => true | |||
option "--value", "VALUE", _("parameter value"), :required => true | |||
option "--hidden_value", "HIDDEN VALUE", _("should the value be hidden") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dtto (dash and underscore missing)
@mbacovsky thanks, fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While testing I found out one usability issue - the new option should be of type boolean so that the the allowed values are shown in the help and the value is validated.
@@ -26,6 +26,7 @@ class SetCommand < HammerCLIForeman::Command | |||
|
|||
option "--name", "NAME", _("parameter name"), :required => true | |||
option "--value", "VALUE", _("parameter value"), :required => true | |||
option "--hidden-value", "HIDDEN_VALUE", _("should the value be hidden") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While testing I found out one usability issue - the new option should be of type boolean so that the the allowed values are shown in the help and the value is validated.
option "--hidden-value", "HIDDEN_VALUE", _("should the value be hidden"),
:format => HammerCLI::Options::Normalizers::Bool.new
lib/hammer_cli_foreman/parameter.rb
Outdated
@@ -48,6 +48,7 @@ def self.create_option_builder | |||
class SetCommand < AbstractParameterCommand | |||
option "--name", "NAME", _("parameter name"), :required => true | |||
option "--value", "VALUE", _("parameter value"), :required => true | |||
option "--hidden-value", "HIDDEN_VALUE", _("should the value be hidden") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dtto - boolean
@orrabin, Thanks for updating. I requested one more change that I found out during my testing. |
@mbacovsky I added tests but they are not working yet. Adding Edit: @mbacovsky fixed the test as you suggested on IRC, everything is passing locally. |
👍 Thanks @orrabin, it looks and works great now! Merging... 💐 |
No description provided.