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
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
..
cmd [ruby/irb] Centralize coloring control (https://github.com/ruby/irb/pull/374) 2022-06-28 22:30:42 +09:00
ext [ruby/irb] Fix the error when LC_MESSAGES config value is nil 2022-09-14 11:14:08 +09:00
lc [ruby/irb] Support --noscript option to not use first non-option argument as script 2022-09-17 02:25:26 +09:00
.document
color.rb [ruby/irb] Color.colorable? needs to consider the condition when irb is not loaded 2022-06-28 22:57:17 +09:00
color_printer.rb [ruby/irb] shortcut colorize_code to speedup pretty_print 2022-08-04 08:37:03 +09:00
completion.rb [ruby/irb] Ignore parenthesis during completion 2021-10-13 06:33:48 +09:00
context.rb [ruby/irb] Support --noscript option to not use first non-option argument as script 2022-09-17 02:25:26 +09:00
easter-egg.rb
extend-command.rb [ruby/irb] Changed to call Kernel.print 2022-01-27 01:28:52 +09:00
frame.rb
help.rb
init.rb [ruby/irb] Support --noscript option to not use first non-option argument as script 2022-09-17 02:25:26 +09:00
input-method.rb [ruby/irb] Support --noscript option to not use first non-option argument as script 2022-09-17 02:25:26 +09:00
inspector.rb [ruby/irb] Centralize coloring control (https://github.com/ruby/irb/pull/374) 2022-06-28 22:30:42 +09:00
irb.gemspec [ruby/irb] Update dependency, reline >= 0.3.0 2021-12-25 00:41:03 +09:00
locale.rb
magic-file.rb
notifier.rb
output-method.rb
ruby-lex.rb Fix warning in Lexer::Elem#[] 2021-12-24 20:44:02 +09:00
ruby_logo.aa
src_encoding.rb
version.rb [ruby/irb] Version 1.4.1 2021-12-25 12:57:28 +09:00
workspace.rb [ruby/irb] Centralize coloring control (https://github.com/ruby/irb/pull/374) 2022-06-28 22:30:42 +09:00
ws-for-case-2.rb
xmp.rb