Class: Vivlio::Starter::CLI::DeleteCommands::DeleteOptions
- Inherits:
-
Object
- Object
- Vivlio::Starter::CLI::DeleteCommands::DeleteOptions
- Defined in:
- lib/vivlio/starter/cli/delete.rb
Overview
CLI オプションを正規化し、各種フラグへのアクセスを提供する
異なる形式のオプション入力(Hash / Samovar コマンド)を統一的なインターフェースで扱えるようにする
Instance Method Summary collapse
-
#apply_verbose! ⇒ Object
verbose オプションが有効な場合、環境変数を設定してログを詳細化する.
-
#dry_run? ⇒ Boolean
Dry-run モードが有効か.
-
#force? ⇒ Boolean
Force モードが有効か(–yes も同義).
-
#initialize(source) ⇒ DeleteOptions
constructor
A new instance of DeleteOptions.
-
#verbose? ⇒ Boolean
Verbose モードが有効か.
-
#warn_conflict! ⇒ Object
dry-run と force の同時指定は矛盾するため警告を出力する dry-run が優先され、force は無視される.
Constructor Details
#initialize(source) ⇒ DeleteOptions
Returns a new instance of DeleteOptions.
100 101 102 |
# File 'lib/vivlio/starter/cli/delete.rb', line 100 def initialize(source) @option_values = extract_option_values(source) end |
Instance Method Details
#apply_verbose! ⇒ Object
verbose オプションが有効な場合、環境変数を設定してログを詳細化する
105 106 107 |
# File 'lib/vivlio/starter/cli/delete.rb', line 105 def apply_verbose! ENV['VERBOSE'] = '1' if verbose? end |
#dry_run? ⇒ Boolean
Returns dry-run モードが有効か.
118 119 120 |
# File 'lib/vivlio/starter/cli/delete.rb', line 118 def dry_run? !!option_values[:dry_run] end |
#force? ⇒ Boolean
Returns force モードが有効か(–yes も同義).
123 124 125 |
# File 'lib/vivlio/starter/cli/delete.rb', line 123 def force? !!(option_values[:force] || option_values[:yes]) end |
#verbose? ⇒ Boolean
Returns verbose モードが有効か.
128 129 130 |
# File 'lib/vivlio/starter/cli/delete.rb', line 128 def verbose? !!option_values[:verbose] end |