12件ヒット
[1-12件を表示]
(0.028秒)
検索結果
-
Readline
. # readline(prompt = "" , add _ hist = false) -> String | nil (120.0) -
prompt を出力し、ユーザからのキー入力を待ちます。 エンターキーの押下などでユーザが文字列を入力し終えると、 入力した文字列を返します。 このとき、add_hist が true であれば、入力した文字列を入力履歴に追加します。 何も入力していない状態で EOF(UNIX では ^D) を入力するなどで、 ユーザからの入力がない場合は nil を返します。
...dline.readline
p buf
end
rescue Interrupt
system("stty", stty_save)
exit
end
例: INTシグナルを捕捉して、端末状態を復帰する。
require 'readline'
stty_save = `stty -g`.chomp
trap("INT") { system "stty", stty_save; exit }
while buf = Readline.rea......f
begin
if Readline::HISTORY[Readline::HISTORY.length-2] == buf
Readline::HISTORY.pop
end
rescue IndexError
end
# p Readline::HISTORY.to_a
print "-> ", buf, "\n"
end
@see Readline.vi_editing_mode、Readline.emacs_editing_mode、
Readline::HISTORY...