1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/irb/lc/help-message
Jeremy Evans b07db96744 [ruby/irb] Support --noscript option to not use first non-option argument as script
Also add --script option to turn the option back on.

Previously there wasn't a way to get an interactive IRB session
and access arguments provided on the command line.

Additionally, handle `-` as script as stdin. In Unix-like tools, `-`
means to take standard input instead of a file.  This doesn't
result in exactly the same output for:

```
echo 'p ARGV' > args.rb; irb args.rb a b c
```

and

```
echo 'p ARGV' | irb - a b c
```

Due to how irb handles whether stdin is a tty.

However, this change allows use of `-` as a argument, instead of
giving an unrecognized switch error. This required some small
changes to context.rb (to handle `-` as standard input) and
input-method.rb (to have FileInputMethod accept IO arguments in
addition to strings).

Implements [Feature #15371]

https://github.com/ruby/irb/commit/4192683ba2
2022-09-17 02:25:26 +09:00

51 lines
2.7 KiB
Text

Usage: irb.rb [options] [programfile] [arguments]
-f Don't initialize from configuration file.
-d Set $DEBUG and $VERBOSE to true (same as 'ruby -d').
-r load-module Require load-module (same as 'ruby -r').
-I path Specify $LOAD_PATH directory (same as 'ruby -I').
-U Set external and internal encodings to UTF-8.
-E ex[:in] Set default external (ex) and internal (in) encodings
(same as 'ruby -E').
-w Suppress warnings (same as 'ruby -w').
-W[level=2] Set warning level: 0=silence, 1=medium, 2=verbose
(same as 'ruby -W').
--context-mode n Set n[0-4] to method to create Binding Object,
when new workspace was created.
--extra-doc-dir Add an extra doc dir for the doc dialog.
--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.
--nomultiline Don't use multiline editor module (default).
--singleline Use single line editor module.
--nosingleline Don't use single line editor module (default).
--colorize Use color-highlighting (default).
--nocolorize Don't use color-highlighting.
--autocomplete Use auto-completion (default).
--noautocomplete Don't use auto-completion.
--prompt prompt-mode, --prompt-mode prompt-mode
Set prompt mode. Pre-defined prompt modes are:
'default', 'classic', 'simple', 'inf-ruby', 'xmp', 'null'.
--inf-ruby-mode Use prompt appropriate for inf-ruby-mode on emacs.
Suppresses --multiline and --singleline.
--sample-book-mode, --simple-prompt
Set prompt mode to 'simple'.
--noprompt Don't output prompt.
--script Script mode (default, treat first argument as script)
--noscript No script mode (leave arguments in argv)
--single-irb Share self with sub-irb.
--tracer Show stack trace for each command.
--back-trace-limit n[=16]
Display backtrace top n and bottom n.
--verbose Show details.
--noverbose Don't show details.
-v, --version Print the version of irb.
-h, --help Print help.
-- Separate options of irb from the list of command-line args.