From 00cfafc0f5424e31dbf0a13b5bd6345572260f13 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 27 Sep 2021 03:21:39 +0900 Subject: [ruby/irb] Add doc about "echo on assignment" https://github.com/ruby/irb/commit/5af637b3c1 --- doc/irb/irb.rd.ja | 6 ++++++ lib/irb.rb | 6 ++++++ lib/irb/context.rb | 12 ++++++++++++ lib/irb/lc/help-message | 6 ++++++ man/irb.1 | 10 ++++++++++ 5 files changed, 40 insertions(+) diff --git a/doc/irb/irb.rd.ja b/doc/irb/irb.rd.ja index 6f55b01760..633c08cbd4 100644 --- a/doc/irb/irb.rd.ja +++ b/doc/irb/irb.rd.ja @@ -51,6 +51,12 @@ irbの使い方は, Rubyさえ知っていればいたって簡単です. 基本 オブジェクトの作成方法を 0 から 3 のいずれかに設定する. --echo 実行結果を表示する(デフォルト). --noecho 実行結果を表示しない. + --echo-on-assignment + 代入時に実行結果を表示する. + --noecho-on-assignment + 代入時に実行結果を表示しない. + --truncate-echo-on-assignment + 代入時に省略された実行結果を表示する(デフォルト). --inspect 結果出力にinspectを用いる. --noinspect 結果出力にinspectを用いない. --singleline シングルラインエディタを利用する. diff --git a/lib/irb.rb b/lib/irb.rb index 0cad6a0d41..fad738f7c8 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -64,6 +64,12 @@ require_relative "irb/easter-egg" # when new workspace was created # --echo Show result (default) # --noecho Don't show result +# --echo-on-assignment +# Show result on assignment +# --noecho-on-assignment +# Don't show result on assignment +# --truncate-echo-on-assignment +# Show truncated result on assignment (default) # --inspect Use `inspect' for output # --noinspect Don't use inspect for output # --multiline Use multiline editor module diff --git a/lib/irb/context.rb b/lib/irb/context.rb index 6dc5d7f0fd..09fd840bd3 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -274,6 +274,18 @@ module IRB # IRB.CurrentContext.echo_on_assignment = true # a = "omg" * 10 # #=> omgomgomgomgomgomgomgomgomgomg + # + # To set the behaviour of showing on assignment in irb: + # + # IRB.conf[:ECHO_ON_ASSIGNMENT] = :truncate or true or false + # + # or + # + # irb_context.echo_on_assignment = :truncate or true or false + # + # or + # + # IRB.CurrentContext.echo_on_assignment = :truncate or true or false attr_accessor :echo_on_assignment # Whether a newline is put before multiline output. # diff --git a/lib/irb/lc/help-message b/lib/irb/lc/help-message index fe9e3246d9..cee860fdeb 100644 --- a/lib/irb/lc/help-message +++ b/lib/irb/lc/help-message @@ -22,6 +22,12 @@ Usage: irb.rb [options] [programfile] [arguments] when new workspace was created --echo Show result (default) --noecho Don't show result + --echo-on-assignment + Show result on assignment + --noecho-on-assignment + Don't show result on assignment + --truncate-echo-on-assignment + Show truncated result on assignment (default) --inspect Use `inspect' for output --noinspect Don't use inspect for output --multiline Use multiline editor module diff --git a/man/irb.1 b/man/irb.1 index 113b986b16..a8a9b60a53 100644 --- a/man/irb.1 +++ b/man/irb.1 @@ -112,6 +112,16 @@ Show result (default). Don't show result. .Pp .Pp +.It Fl -echo-on-assignment +Show result on assignment. +.Pp +.It Fl -noecho-on-assignment +Don't show result on assignment. +.Pp +.It Fl -truncate-echo-on-assignment +Show truncated result on assignment (default). +.Pp +.Pp .It Fl -colorize Use colorization. .Pp -- cgit v1.2.1