lib/planter/prompt.rb in planter-cli-3.0.1 vs lib/planter/prompt.rb in planter-cli-3.0.2
- old
+ new
@@ -52,14 +52,14 @@
when :multiline
read_lines
else
read_line
end
- Planter.notify("{dw}#{prompt}: {dy}#{res}{x}", :debug)
+ Planter.notify("{dw}#{prompt} => {dy}#{res}{x}", :debug, newline: false)
res
rescue TTY::Reader::InputInterrupt
- raise Errors::InputError('Canceled')
+ raise Errors::InputError.new('Canceled')
end
private
##
@@ -114,11 +114,11 @@
def read_date(prompt: nil)
prompt ||= @prompt
default = date_default
default = default ? " {bw}[#{default}]" : ''
- Planter.notify("{by}#{prompt} (natural language)#{default}")
+ Planter.notify("{by}#{prompt} (natural language)#{default}", newline: false)
line = @gum ? read_line_gum : read_line_tty
return default unless line
Chronic.parse(line).strftime('%Y-%m-%d')
end
@@ -133,11 +133,11 @@
## @return [String] the single-line response
##
def read_line(prompt: nil)
prompt ||= @prompt
default = @default ? " {bw}[#{@default}]" : ''
- Planter.notify("{by}#{prompt}#{default}")
+ Planter.notify("{by}#{prompt}#{default}", newline: false)
res = @gum ? read_line_gum : read_line_tty
return @default unless res
@@ -154,10 +154,10 @@
## @return [String] the multi-line response
##
def read_lines(prompt: nil)
prompt ||= @prompt
save = @gum ? 'Ctrl-J for newline, Enter' : 'Ctrl-D'
- Planter.notify("{by}#{prompt} {xc}({bw}#{save}{xc} to save)'")
+ Planter.notify("{by}#{prompt} {xc}({bw}#{save}{xc} to save)'", newline: false)
res = @gum ? read_multiline_gum(prompt) : read_mutliline_tty
return @default unless res
res.strip