What will give me something like ruby readline with a default value?

后端 未结 5 639
孤街浪徒
孤街浪徒 2020-12-03 15:11

If I want to have a prompt on the terminal with a default value already typed in, how can I do that?

Ruby\'s standard Readline.readline() lets me set th

5条回答
  •  旧巷少年郎
    2020-12-03 15:46

    +1 to highline

    try with something like:

    require 'highline/import'
    input = ask('> ') {|q| q.default = 'default_text'} # > |default_text|
    

提交回复
热议问题