Method: NA.request_input
- Defined in:
- lib/na/next_action.rb
.request_input(options, prompt: 'Enter text') ⇒ Object
Request terminal input from user, readline style
2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 |
# File 'lib/na/next_action.rb', line 2077 def request_input(, prompt: 'Enter text') if $stdin.isatty && TTY::Which.exist?('gum') && ([:tagged].nil? || [:tagged].empty?) opts = [%(--placeholder "#{prompt}"), '--char-limit=500', "--width=#{TTY::Screen.columns}"] `gum input #{opts.join(' ')}`.strip elsif $stdin.isatty && [:tagged].empty? NA.notify("#{NA.theme[:prompt]}#{prompt}:") reader.read_line(NA::Color.template("#{NA.theme[:filename]}> #{NA.theme[:action]}")).strip end end |