update some deisng parameters and add new cases
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module FeatherCaseWizard
|
||||
class PromptingUI
|
||||
def self.wrap(ui)
|
||||
ui.is_a?(self) ? ui : new(ui)
|
||||
end
|
||||
|
||||
def initialize(ui)
|
||||
@ui = ui
|
||||
end
|
||||
|
||||
def ask(*arguments, &block)
|
||||
separate_after { @ui.ask(*arguments, &block) }
|
||||
end
|
||||
|
||||
def agree(*arguments, &block)
|
||||
separate_after { @ui.agree(*arguments, &block) }
|
||||
end
|
||||
|
||||
def choose(prompt, &block)
|
||||
separate_after do
|
||||
@ui.choose do |menu|
|
||||
menu.header = prompt.to_s.sub(/[?:]\s*\z/, "")
|
||||
block.call(menu)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def say(*arguments, &block)
|
||||
@ui.say(*arguments, &block)
|
||||
end
|
||||
|
||||
def color(*arguments, &block)
|
||||
@ui.color(*arguments, &block)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def separate_after
|
||||
result = yield
|
||||
@ui.say("\n")
|
||||
result
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user