Project

General

Profile

Actions

Bug #11853

closed

Overriding :flag options does not work

Added by Alex Wood over 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

Overriding options that are declared as :flag does not seem to work. For example:

option(["-i", "--insecure"], :flag, _("do not perform SSL/TLS verifications"), :default => false)

[1] pry(#<HammerCLICandlepin::StatusCommand>)> option_insecure = true
=> true
[2] pry(#<HammerCLICandlepin::StatusCommand>)> option_insecure?
=> false

Here is my use case: I am writing a tool primarily meant to be used by developers. If they are connecting to localhost, I know that it is almost certain they are going to want --insecure set to true. I have a bit of code at the top of the execute method that looks at the value of the --server option and if it is localhost, it will flip insecure to true. Unfortunately, the call to option_insecure= doesn't appear to do anything.

If there is a better way to accomplish my goal, please let me know.

I am using hammer-cli 0.3.0.

Actions

Also available in: Atom PDF