Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Fixes #21220 - make k-c-h command name easily changed #552

Merged
merged 1 commit into from
Oct 6, 2017

Conversation

johnpmitsch
Copy link
Contributor

@johnpmitsch johnpmitsch commented Oct 5, 2017

We need this to backport these changes.

@theforeman-bot
Copy link

Issues: #21220

proxy: "Foreman Proxy",
plural_proxy: "Foreman Proxies",
proxy_hyphenated: "foreman-proxy-content",
plugin: "katello"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I might prefer this being command or command_name rather than plugin. Plugin tends to evoke a lot of other thoughts and this isn't really a plugin system.

@johnpmitsch
Copy link
Contributor Author

@ehelms updated to command_prefix, I think that makes sense for what we are trying to achieve

@johnpmitsch johnpmitsch force-pushed the kch_backport_name branch 2 times, most recently from cafb928 to a011f3e Compare October 6, 2017 15:22
@options[:program] = program || @default_program
@options[:scenario] = scenario || @last_scenario
@options[:program] = init_options[:program] || @default_program
@options[:scenario] = init_options[:scenario] || @last_scenario
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hashes have a builtin function for this .fetch(:scenario, @last_scenario)

@plural_proxy = init_options[:plural_proxy]
@proxy_hyphenated = init_options[:proxy_hyphenated]
@accepted_scenarios = init_options[:accepted_scenarios]
@command_prefix = init_options[:command_prefix]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are all required, you can use fetch to enforce that.

@johnpmitsch
Copy link
Contributor Author

@ehelms thanks, updated

@options[:program] = program || @default_program
@options[:scenario] = scenario || @last_scenario
@options[:program] = init_options[:program].fetch(:program, @default_program)
@options[:scenario] = init_options[:scenario].fetch(:scenario, @last_scenario)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean to leave off the [:...] for these two options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@command_prefix = init_options.fetch(:command_prefix)
# accepted_scenarios is not a required parameter, so we allow to return nil.
# See method in helper file
@accepted_scenarios = init_options[:accepted_scenarios]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make this explicit without the need for comment by using init_options.fetch(:accepted_scenarios, nil) which will set the default to nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, updated

We need this to backport these changes.
@johnpmitsch johnpmitsch merged commit 765b640 into Katello:master Oct 6, 2017
@johnpmitsch johnpmitsch deleted the kch_backport_name branch October 6, 2017 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants