Граф коммитов

36 Коммитов

Автор SHA1 Сообщение Дата
Akinori MUSHA b877928ca5 Fix the ArgumentError message in shellsplit
Change "double quote" to just "quote" because the message is about any type of quotes.
2020-06-16 23:23:13 +09:00
Akinori MUSHA 68e4310344 Improve the document of Shellwords
- Improve careless examples
  - Insert `--` before a file name for cat(1)
  - Insert `-e` before a search pattern for grep(1)

- Add a caution about passing an arbitrary argument to a command
2020-06-16 23:15:51 +09:00
Kazuhiro NISHIYAMA 37457117c9
Use `\&` instead of `\1` with capture 2019-10-17 12:51:29 +09:00
Jeremy Evans 43a16c98df Do not escape + in Shellwords.escape
+ is not a character that requires escaping in Bourne sh.

Fixes [Bug #14429]
2019-09-27 07:43:32 -07:00
knu 2da5ae4232 Fix the handling of the backslash in double quotes
* lib/shellwords.rb (Shellwords#shellsplit): Fix the handling of
  the backslash in double quotes to conform to the standard.
  [ruby-core:63807] [Bug #10055]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 04:58:48 +00:00
naruse 63f486f1db remove duplicated frozen_string_literal magic comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 09:25:48 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
knu 273d5004be * lib/shellwords.rb (Shellwords#shellsplit): Document that this
method does not treat shell metacharacters as such.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 05:19:03 +00:00
normal bd13788fdb lib/shellwords.rb: do not change API with frozen-string-literal
This fixes a bug introduced in r53066 when attempting to
shellescape an empty string.

* lib/shellwords.rb (shellescape): duplicate frozen literal
* test/test_shellwords.rb (test_stringification): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 03:17:28 +00:00
knu fdfb8804c0 * lib/shellwords.rb: Turn on frozen-string-literal after fixing
shellsplit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 02:43:56 +00:00
nobu 01c432169f disable frozen-string-literal
* lib/mkmf.rb, lib/shellwords.rb: disable frozen-string-literal.
  [ruby-core:72011] [Bug #11800]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-10 00:32:53 +00:00
hsbt 925ac7ade7 * lib/shellwords.rb: proofreading documentation.
[Bug #10155][ruby-core:64471]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-05 10:00:46 +00:00
a_matsuda 4618b7f200 [DOC] Fix output of Shellwords.escape() by @anatol [Fixes GH-483]
* lib/shellwords.rb:  Fix output of Shellwords.escape()
https://github.com/ruby/ruby/pull/483
[ci-skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-14 18:26:59 +00:00
knu ab714c82f0 Add back my original example of Shellwords#shellescape.
* lib/shellwords.rb (Shellwords#shellescape): Add back my original
  real world example with some enhancement.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09 06:28:00 +00:00
knu eccb95543c Fix an example of Shellwords#shellescape.
* lib/shellwords.rb (Shellwords#shellescape): Undo part of the
  previous rdoc change.  This new example using a string-only
  array was not in line with the description.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-09 06:25:02 +00:00
zzak 5d62cf1376 * lib/shellwords.rb: Documentation for Shellwords.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-12 23:22:26 +00:00
knu d00fe54803 * lib/shellwords.rb (Shellwords#shellescape): shellescape() now
stringifies the given object using to_s.

* lib/shellwords.rb (Shellwords#shelljoin): shelljoin() accepts
  non-string objects in the given array, each of which is
  stringified using to_s.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-12 18:49:30 +00:00
knu c100aeb838 * lib/shellwords.rb: Fix rdoc markups.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-12 18:49:27 +00:00
knu 8c72fc9bf0 * lib/shellwords.rb (Shellwords#shellsplit): Fix a bug where
consecutive backslashes in double quotes are all removed except
  the one at the tail.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-12 18:42:03 +00:00
knu d367b1b9f1 * lib/shellwords.rb (Shellwords#shellescape): Drop the //n flag
that only causes warnings with no real effect.  [Bug #5637]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-01 03:26:20 +00:00
drbrain 6be866e262 * lib/shellwords.rb: Update toplevel comment with an example. Patch
by Samnang Chhun.  [Ruby 1.9 - Bug #5388]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-03 23:23:24 +00:00
knu 47d42038b3 * lib/ipaddr.rb: Say that I am the current maintainer.
* lib/set.rb: Ditto.

* lib/shellwords.rb: Ditto.

* ext/syslog/syslog.txt: Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-21 12:15:06 +00:00
matz d407e2fac8 * lib/shellwords.rb: scape should be an alias to shellescape. a
patch from Masahiro Kawato <m-kawato AT mwb.biglobe.ne.jp> in
  [ruby-dev:33060].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-14 07:14:14 +00:00
knu d2a68669da * lib/shellwords.rb: Add shellescape() and shelljoin().
* lib/shellwords.rb: Rename shellwords() to shellsplit() and make
  the former an alias to the latter.

* lib/shellwords.rb: Add escape(), split(), join() as class
  methods, which are aliases to their respective long names
  prefixed with `shell'.

* lib/shellwords.rb: Add String#shellescape(), String#shellsplit()
  and Array#shelljoin() for convenience.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-11 08:27:48 +00:00
nobu 88d6c083ea * ext/extmk.rb, lib/fileutils.rb, lib/mkmf.rb, lib/optparse.rb,
lib/shellwords.rb: get rid of shadowing outer local variable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-09 14:41:24 +00:00
nobu 7145ec7bb2 * lib/shellwords.rb: fix for blank but not empty string.
fixed: [ruby-dev:27663]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-10 12:05:57 +00:00
nobu e8201d12db * lib/shellwords.rb: refactored. [ruby-core:06581]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-08 23:41:40 +00:00
matz 683400f427 * dir.c (rb_glob2): do not allocate buffer from heap to avoid
memory leaks.  use string object for buffering instead.
  [ruby-dev:24738]

* dir.c (join_path): ditto.

* io.c (io_read): external input buffer may be modified even after
  rb_str_locktmp().  [ruby-dev:24735]

* dir.c (fnmatch): p or s may be NULL.  [ruby-dev:24749]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-10 07:17:53 +00:00
knu 8b222cea6b * lib/shellwords.rb: Embed rdoc style comments.
* lib/shellwords.rb (shellwords): Use String#lstrip!.

* lib/shellwords.rb (shellwords): Recognize an object that
  responds to to_str() by using String.new().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-26 10:11:30 +00:00
knu 4ae8470a48 * lib/shellwords.rb (shellwords): A backslash ('\') in single
quotes should not be regarded as meta character.  This bug or
  maybe feature was inherited from Perl's shellwords.pl.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-19 14:13:01 +00:00
wakou bfd441db8f * lib/shellwords.rb: don't destroy argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-06-03 19:25:07 +00:00
matz d3a6170010 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-08-01 09:25:37 +00:00
matz 320e99d8dd 2000-02-08
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-02-08 08:54:01 +00:00
matz 65a5162550 1.4.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-08-13 05:45:20 +00:00
matz 210367ec88 This commit was generated by cvs2svn to compensate for changes in r372,
which included commits to RCS files with non-trunk default branches.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1999-01-20 04:59:39 +00:00
matz 62e41d3f2e Initial revision
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1998-01-16 12:19:09 +00:00