diff options
author | kouji <kouji@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-07 13:58:04 +0000 |
---|---|---|
committer | kouji <kouji@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-07 13:58:04 +0000 |
commit | 05373c446902ace063b1ff5caf2236004e7bc763 (patch) | |
tree | fa23c6a1b46da972c809234fa4c183aba15bfe1c | |
parent | 16a24188cdfa81da007b0958f9dc1bf7c0778215 (diff) |
* ext/readline/README.ja: updated API document for Readline module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ext/readline/README.ja | 411 |
2 files changed, 380 insertions, 35 deletions
@@ -1,3 +1,7 @@ +Thu Aug 7 22:55:44 2008 TAKAO Kouji <[email protected]> + + * ext/readline/README.ja: updated API document for Readline module. + Thu Aug 7 20:52:08 2008 Shugo Maeda <[email protected]> * lib/net/ftp.rb (login): raise FTPReplyError if passwd or acct diff --git a/ext/readline/README.ja b/ext/readline/README.ja index beb951fbf0..69b26f0d69 100644 --- a/ext/readline/README.ja +++ b/ext/readline/README.ja @@ -1,63 +1,404 @@ -GNU Readline Library�����Ѥ��뤿��γ�ĥ�⥸�塼��Ǥ��� +GNU Readline �ˤ�륳�ޥ�ɥ饤�����ϥ��ե�����������⥸�塼�� +�Ǥ���GNU Readline �θߴ��饤�֥��ΤҤȤĤǤ��� Edit Line(libedit) �� +���ݡ��Ȥ��Ƥ��ޤ��� -require "readline" -include Readline +GNU Readline:: http://www.gnu.org/directory/readline.html +libedit:: http://www.thrysoee.dk/editline/ -line = readline("Prompt> ", true) +Readline.readline ����Ѥ��ƥ桼����������Ϥ�����Ǥ��ޤ������ΤȤ��� +GNU Readline �Τ褦�����Ϥ��䴰��Emacs �Τ褦�ʥ������ʤɤ��Ǥ��ޤ��� -�Τ褦�˻��Ѥ��Ƥ��������� + require "readline" + while buf = Readline.readline("> ", true) + p buf + end -[Readline] +�桼�������Ϥ������Ƥ�����(�ʲ����ҥ��ȥ�)�Ȥ��Ƶ�Ͽ���뤳�Ȥ��Ǥ��ޤ��� +��� Readline::HISTORY ����Ѥ��ƥҥ��ȥ�˥��������Ǥ��ޤ��� -<�⥸�塼��ؿ�> + require "readline" + while buf = Readline.readline("> ", true) + p Readline::HISTORY.to_a + print("-> ", buf, "\n") + end -readline(prompt, add_history=nil) +���Ѥ���饤�֥��ˤ�ꡢ�����Ĥ��Υ�åɤ��㳰 NotImplementedError +��ȯ�����ޤ��� - ������Ϥ��ɤ߹��ߤޤ��� - add_history��true�ξ�硢�ҥ��ȥ���ɤ߹����ʸ������ɲä��ޤ��� +$SAFE �� 4 �ξ�硢¿���Υ�åɤ��㳰 SecurityError ��ȯ�����ޤ��� -<���饹��å�> +== Readline �⥸�塼�� -completion_proc = proc +=== �⥸�塼��ؿ� - �䴰����ư�����ꤹ��Proc���֥������Ȥ���ꤷ�ޤ��� - proc�ϰ���������ʸ������ꡢ����ʸ�����������֤��褦�� - ���Ƥ��������� +readline([prompt, [add_hist]]) -> String | nil -completion_proc + prompt ����Ϥ����桼������Υ������Ϥ��Ԥ��ޤ��� + ���������β����ʤɤǥ桼����ʸ��������Ϥ�������ȡ� + ���Ϥ���ʸ������֤��ޤ��� + ���ΤȤ���add_hist �� true �Ǥ���С����Ϥ���ʸ�����ҥ��ȥ���ɲä��ޤ��� + + �������Ϥ��Ƥ��ʤ����֤� EOF(UNIX �Ǥ� ^D) �����Ϥ���ʤɤǡ� + �桼����������Ϥ��ʤ����� nil ���֤��ޤ��� + + ���ξ���������������硢�㳰 IOError ��ȯ�����ޤ��� + 1. ɸ�����Ϥ� tty �Ǥʤ��� + 2. ɸ�����Ϥ��������Ƥ��롣(isatty(2) �� errno �� EBADF �Ǥ��롣) + + �ܥ�åɤϥ���åɤ��б����Ƥ��ޤ��� + �����Ԥ����֤ΤȤ��ϥ���åɥ���ƥ����Ȥ����ؤ���ȯ�����ޤ��� + + ���ϻ��ˤϹ����Խ�����ǽ�ǡ�vi �⡼�ɤ� Emacs �⡼�ɤ��Ѱդ���Ƥ��ޤ��� + �ǥե���Ȥ� Emacs �⡼�ɤǤ��� + + �ܥ�åɤˤ����ջ��ब����ޤ��� + �����Ԥ��ξ��֤� ^C ����� ruby ���ץ����λ����ü�����֤��������ޤ��� + �������뤿������3�ĵޤ��� + + * ^C�ˤ��Interrupt�㳰�������ơ�ü�����֤��������ޤ�: + + require "readline" + + stty_save = `stty -g`.chomp + begin + while buf = Readline.readline + p buf + end + rescue Interrupt + system("stty", stty_save) + exit + end + end + end + + * INT�����ʥ�������ơ�ü�����֤��������ޤ�: + + require "readline" + + stty_save = `stty -g`.chomp + trap("INT") { system "stty", stty_save; exit } + + while buf = Readline.readline + p buf + end + + * ñ�� ^C ��̵�뤹����ˡ�⤢��ޤ�: + + require "readline" + + trap("INT", "SIG_IGN") + + while buf = Readline.readline + p buf + end + + �������� Readline::HISTORY ����Ѥ��ơ����Ԥ�ľ�������Ϥ�Ʊ�����Ƥ����� + ����˻Ĥ��ʤ��Ȥ������Ȥ�Ǥ��ޤ��� + + require "readline" + + while buf = Readline.readline("> ", true) + # p Readline::HISTORY.to_a + Readline::HISTORY.pop if /^\s*$/ =~ buf + + 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 + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� - �䴰����ư�����ꤹ��Proc���֥������Ȥ��֤��ޤ��� +=== ���饹��å� -completion_case_fold = case_fold +Readline.input = input - �䴰������ʸ����ʸ������̤��ʤ���硢true����ꤷ�ޤ��� + Readline.readline ��åɤǻ��Ѥ��������Ѥ� File ���֥������� input + ����ꤷ�ޤ��� -completion_case_fold + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� - �䴰������ʸ����ʸ������̤��ʤ���硢true���֤��ޤ��� +Readline.output = output -completion_append_character = char + Readline.readline ��åɤǻ��Ѥ�������Ѥ� File ���֥������� + output ����ꤷ�ޤ��� - �䴰�����ղä����ʸ����ʸ����ǻ��ꤷ�ޤ�����Ƭ�ΰ�ʸ���� - ���ꤵ�졢��ʸ���� ("") �ޤ��� nil ����ꤹ��Ȳ����ղ� - ����ʤ��ʤ�ޤ��� + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� -completion_append_character +Readline.completion_proc = proc - �䴰�����ղä����ʸ����ʸ������֤��ޤ����ǥե���Ȥ� - ���� (" ") �Ǥ��� + �桼����������Ϥ��䴰������θ����������� Proc ���֥������� proc �� + ���ꤷ�ޤ���proc �ϡ����Τ�Τ����ꤷ�Ƥ��ޤ��� + 1. call ��åɤ�����ޤ��� + call ��åɤ�����ʤ���硢�㳰 ArgumentError ��ȯ�����ޤ��� + 2. �����˥桼�����������ʸ����(��1)����ޤ��� + 3. �����ʸ�����������֤��ޤ��� -vi_editing_mode + ��1:��/var/lib /v�פθ���䴰��Ԥ��ȡ� + �ǥե���ȤǤ� proc �ΰ����ˡ�/v�פ��Ϥ���ޤ��� + ���Τ褦�ˡ��桼�������Ϥ���ʸ����� + Readline.completer_word_break_characters �˴ޤޤ��ʸ���Ƕ��ڤä��� + �Τ�ñ��Ȥ���ȡ��������뤬����ñ��κǽ��ʸ�����鸽�ߤΥ�������� + �֤ޤǤ�ʸ���� proc �ΰ������Ϥ���ޤ��� - VI�⡼�ɤˤʤ�ޤ��� + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� -emacs_editing_mode +Readline.completion_proc -> proc - Emacs�⡼�ɤˤʤ�ޤ��� + �桼����������Ϥ��䴰������θ����������� Proc ���֥������� proc + ��������ޤ��� -<���饹���> + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.completion_case_fold = bool + + �桼�������Ϥ��䴰����ݡ���ʸ���Ⱦ�ʸ������̤��롿���ʤ�����ꤷ�ޤ��� + bool �����ʤ�ж��̤��ޤ���bool �����ʤ�ж��̤��ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.completion_case_fold -> bool + + �桼�������Ϥ��䴰����ݡ���ʸ���Ⱦ�ʸ������̤��롿���ʤ���������ޤ��� + bool �����ʤ�ж��̤��ޤ���bool �����ʤ�ж��̤��ޤ��� + + �ʤ���Readline.completion_case_fold= ��åɤǻ��ꤷ�����֥������Ȥ� + ���Τޤ�������Τǡ����Τ褦��ư��ޤ��� + + require "readline" + + Readline.completion_case_fold = "This is a String." + p Readline.completion_case_fold # => "This is a String." + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.vi_editing_mode -> nil + + �Խ��⡼�ɤ� vi �⡼�ɤˤ��ޤ��� + vi �⡼�ɤξܺ٤ϡ�GNU Readline �Υޥ˥奢��Ȥ��Ƥ��������� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.emacs_editing_mode -> nil + + �Խ��⡼�ɤ� Emacs �⡼�ɤˤ��ޤ��� + �ǥե���Ȥ� Emacs �⡼�ɤǤ��� + Emacs �⡼�ɤξܺ٤ϡ�GNU Readline �Υޥ˥奢��Ȥ��Ƥ��������� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.completion_append_character = char + + �桼�������Ϥ��䴰����λ�������ˡ��Ǹ���ղä���ʸ�� char ����ꤷ + �ޤ���Ⱦ�ѥ��ڡ�����" "�פʤɤ�ñ�����ڤ�ʸ������ꤹ��С�Ϣ³���� + ���Ϥ���ݤ������Ǥ��� + + ������: + + require "readline" + + Readline.readline("> ", true) + Readline.completion_append_character = " " + + �¹���: + + > + ������ "/var/li" �����Ϥ��ޤ��� + + > /var/li + ������ TAB ���������Ϥ��ޤ��� + + > /var/lib + "b" ���䴰���졢�Ǹ�� " " ���ɲä����Τǡ�"/usr" ��Ϣ³�������ϤǤ��ޤ��� + + > /var/lib /usr + + �ʤ���1ʸ���������ꤹ�뤳�ȤϤǤ��ޤ��� + �㤨�С�"string"����ꤷ�����Ϻǽ��ʸ���Ǥ���"s"��������Ѥ��ޤ��� + + require "readline" + + Readline.completion_append_character = "string" + p Readline.completion_append_character # => "s" + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.completion_append_character -> char + + �桼�������Ϥ��䴰����λ�������ˡ��Ǹ���ղä���ʸ����������ޤ��� + �ǥե���Ȥ϶��� (" ") �Ǥ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.basic_word_break_characters = string + + �桼�������Ϥ��䴰��Ԥ��ݡ�ñ��ζ��ڤ��ʣ����ʸ���ǹ�������� + ʸ���� string ����ꤷ�ޤ��� + + GNU Readline �Υǥե���Ȥ��ͤϡ�Bash ���䴰�����ǻ��Ѥ��Ƥ���ʸ���� + " \t\n\"\\'`@$><=;|&{(" (���ڡ�����ޤ�) �ˤʤäƤ��ޤ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.basic_word_break_characters -> string + + �桼�������Ϥ��䴰��Ԥ��ݡ�ñ��ζ��ڤ��ʣ����ʸ���ǹ�������� + ʸ�����������ޤ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.completer_word_break_characters = string + + �桼�������Ϥ��䴰��Ԥ��ݡ�ñ��ζ��ڤ��ʣ����ʸ���ǹ�������� + ʸ���� string ����ꤷ�ޤ��� + Readline.basic_word_break_characters= �Ȥΰ㤤�ϡ� + GNU Readline �� rl_complete_internal �ؿ��ǻ��Ѥ���뤳�ȤǤ��� + + GNU Readline �Υǥե���Ȥ��ͤϡ� + Readline.basic_word_break_characters ��Ʊ���Ǥ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.completer_word_break_characters -> string + + �桼�������Ϥ��䴰��Ԥ��ݡ�ñ��ζ��ڤ��ʣ����ʸ���ǹ������줿 + ʸ�����������ޤ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.basic_quote_characters = string + + ���ڡ����ʤɤ�ñ��ζ��ڤ�����Ȥ��뤿���ʣ����ʸ���ǹ�������� + ʸ���� string ����ꤷ�ޤ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.basic_quote_characters -> string + + ���ڡ����ʤɤ�ñ��ζ��ڤ�����Ȥ��뤿���ʣ����ʸ���ǹ�������� + ʸ�����������ޤ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.completer_quote_characters = string + + �桼�������Ϥ��䴰��Ԥ��ݡ����ڡ����ʤɤ�ñ��ζ��ڤ�� + �������Ȥ��뤿���ʣ����ʸ���ǹ��������ʸ���� string ����ꤷ�ޤ��� + ���ꤷ��ʸ���δ֤Ǥϡ�Readline::completer_word_break_characters= + �ǻ��ꤷ��ʸ����˴ޤޤ��ʸ���⡢���̤�ʸ����Ȥ��ư����ޤ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.completer_quote_characters -> string + + �桼�������Ϥ��䴰��Ԥ��ݡ����ڡ����ʤɤ�ñ��ζ��ڤ�� + �������Ȥ��뤿���ʣ����ʸ���ǹ��������ʸ�����������ޤ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.filename_quote_characters = string + + �桼�������ϻ��˥ե�����̾���䴰��Ԥ��ݡ����ڡ����ʤɤ�ñ��ζ��ڤ�� + �������Ȥ��뤿���ʣ����ʸ���ǹ��������ʸ���� string ����ꤷ�ޤ��� + + GNU Readline �Υǥե�����ͤ� nil �Ǥ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +Readline.filename_quote_characters -> string + + �桼�������ϻ��˥ե�����̾���䴰��Ԥ��ݡ����ڡ����ʤɤ�ñ��ζ��ڤ�� + �������Ȥ��뤿���ʣ����ʸ���ǹ��������ʸ�����������ޤ��� + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ��㳰 NotImplementedError ��ȯ�����ޤ��� + + $SAFE �� 4 �ξ�硢�㳰 SecurityError ��ȯ�����ޤ��� + +=== ���饹��� HISTORY -�ҥ��ȥ���Ф������Ϥ���������̤��ƹԤäƤ��������� -�����Ʊ���褦�˰�����褦�ˤʤäƤ��ޤ��� + ��� HISTORY ����Ѥ��ƥҥ��ȥ�˥��������Ǥ��ޤ��� + Enumerable �⥸�塼��� extend ���Ƥ��ꡢ + ����Τ褦�˿������Ȥ��Ǥ��ޤ��� + �㤨�С�HISTORY[4] �ˤ�� 5 ���ܤ����Ϥ������Ƥ���Ф����Ȥ��Ǥ��ޤ��� + + require "readline" + + Readline::HISTORY.push("a", "b", "c", "d", "e") + p Readline::HISTORY[4] # => "e" + + �������Ƥ����åɤ˵ޤ��� + * HISTORY.to_s -> "HISTORY" + * HISTORY[index] -> string + * HISTORY[index] = string + * HISTORY.push(string[, string, ...]) -> self + * HISTORY << string -> self + * HISTORY.pop -> string + * HISTORY.shift -> string + * HISTORY.each -> Enumerable::Enumerator + * HISTORY.each { |i| } -> [string] + * HISTORY.length -> Integer + * HISTORY.empty? -> true or false + * HISTORY.delete_at(index) -> string + * HISTORY.clear -> self + + ���ݡ��Ȥ��Ƥ��ʤ��Ķ��Ǥϡ����Υ�åɤ��㳰 NotImplementedError �� + ȯ�����ޤ��� + * HISTORY[index] = string + * HISTORY.pop -> string + * HISTORY.shift -> string + * HISTORY.delete_at(index) -> string + * HISTORY.clear -> self + + $SAFE �� 4 �ξ�硢�ҥ��ȥ�˥������������Ȥ����㳰 SecurityError �� + ȯ�����ޤ��� + +FILENAME_COMPLETION_PROC + + �ե�����̾���䴰��Ԥ� call ��åɤ���ĥ��֥������ȤǤ��� + + Readline.completion_proc= �ˤ�ꡢ�桼�������ϻ��˥ե�����̾���䴰�� + �Ԥ��褦�����ꤹ�뤿��˻��Ѥ��뤳�Ȥ����ꤷ�Ƥޤ��� + +USERNAME_COMPLETION_PROC + + �桼��̾���䴰��Ԥ� call ��åɤ���ĥ��֥������ȤǤ��� + + Readline.completion_proc= �ˤ�ꡢ�桼�������ϻ��˥桼��̾���䴰��� + ���褦�����ꤹ�뤿��˻��Ѥ��뤳�Ȥ����ꤷ�Ƥޤ��� + +VERSION + + ���Ѥ��Ƥ��� GNU Readline �ޤ��� libedit �ΥС������Ǥ��� |