michaelmior /
nose-cli
| 1 | # frozen_string_literal: true |
||
| 2 | |||
| 3 | 1 | module NoSE |
|
| 4 | 1 | module CLI |
|
| 5 | # Add the use of shared options |
||
| 6 | 1 | class NoSECLI < Thor |
|
| 7 | # Add a new option to those which can be potentially shared |
||
| 8 | 1 | def self.share_option(name, options = {}) |
|
| 9 | 3 | @options ||= {} |
|
| 10 | 3 | @options[name] = options |
|
| 11 | end |
||
| 12 | |||
| 13 | # Use a shared option for the current command |
||
| 14 | # @return [void] |
||
| 15 | 1 | def self.shared_option(name) |
|
| 16 | 16 | method_option name, @options[name] |
|
| 17 | end |
||
| 18 | |||
| 19 | 1 | share_option :mix, type: :string, default: 'default', |
|
| 20 | desc: 'the name of the mix for weighting queries' |
||
| 21 | 1 | share_option :format, type: :string, default: 'txt', |
|
| 22 | enum: %w(txt json yml html), aliases: '-f', |
||
|
0 ignored issues
–
show
coding-style
introduced
by
Loading history...
|
|||
| 23 | desc: 'the format of the produced plans' |
||
| 24 | 1 | share_option :output, type: :string, default: nil, aliases: '-o', |
|
| 25 | banner: 'FILE', |
||
| 26 | desc: 'a file where produced plans ' \ |
||
| 27 | 'should be stored' |
||
| 28 | end |
||
| 29 | end |
||
| 30 | end |
||
| 31 |