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
918 919 920 921 922 923 924 925 926 927 928 |
# File 'lib/na/next_action.rb', line 918 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 |