34件ヒット
[1-34件を表示]
(0.019秒)
種類
- 文書 (12)
- インスタンスメソッド (11)
- ライブラリ (11)
ライブラリ
- optparse (11)
クラス
- OptionParser (11)
キーワード
-
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (4) - environment (11)
検索結果
-
optparse (38186.0)
-
コマンドラインのオプションを取り扱うためのライブラリです。
...コマンドラインのオプションを取り扱うためのライブラリです。
=== チュートリアル
optparse を使う場合、基本的には
(1) OptionParser オブジェクト opt を生成する。
(2) オプションを取り扱うブロックを opt に登録する。
(3) o......ョンの定義
以下はオプション -a, -b を受け付けるコマンドを作成する例です。
//emlist[sample.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on('-a') {|v| p v }
opt.on('-b') {|v| p v }
opt.parse!(ARGV)
p ARGV
//}
↓
ruby sample.rb -a foo bar -b baz......ョンと
して認識されている)。ただし、環境変数 POSIXLY_CORRECT が定義してあると
この挙動は変更されます。
env POSIXLY_CORRECT=1 ruby ./sample.rb -a foo bar -b baz
# => true # -a はオプションと解釈... -
OptionParser
# environment(env) -> [String] (14235.0) -
環境変数 env に対して Shellwords.#shellwords を呼 んで配列にしてから parse を行ないます。
...環境変数 env に対して
Shellwords.#shellwords を呼
んで配列にしてから parse を行ないます。
@param env 環境変数名を文字列で与えます。
@raise OptionParser::ParseError パースに失敗した場合、発生します。
実際......mlist[例][ruby]{
require "optparse"
config = {}
opts = OptionParser.new
opts.on("-r", "--require LIBRARY"){|lib| config[:lib] = lib }
# HOGE_OPT は hoge というプログラム名に対応した名前です
ENV['HOGE_OPT'] = %q{--require lib1 'remain data'}
p opts.environment('HOGE_OPT') # => [... -
NEWS for Ruby 3
. 0 . 0 (24.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...14541
* Assigning to a numbered parameter is now a SyntaxError instead of
a warning.
== Command line options
=== `--help` option
When the environment variable `RUBY_PAGER` or `PAGER` is present and has
a non-empty value, and the standard input and output are tty, the `--help`
option shows......[] now sort the results by default, and accept the `sort:` keyword option. 8709
* ENV
* ENV.except has been added, which returns a hash excluding the given keys and their values. 15822
* Windows: Read ENV names and values as UTF-8 encoded Strings 12650
* Encoding
* Added new encodi......* drb
* debug
* erb
* find
* net-ftp
* net-http
* net-imap
* net-protocol
* open-uri
* optparse
* pp
* prettyprint
* resolv-replace
* resolv
* rinda
* set
* securerandom
* shellwords
* t... -
NEWS for Ruby 2
. 4 . 0 (12.0) -
NEWS for Ruby 2.4.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ttps://github.com/k-takata/Onigmo/issues/82
* Regexp/String: Unicodeのバージョンを8.0.0から9.0.0に更新しました 12513
* RubyVM::Env
* 削除しました
* String
* String#casecmp? を追加 12786
* String#concat, String#prepend 複数の引数を受け付けるよ....../OpenSSL 2.0
OpenSSL は https://github.com/ruby/openssl に分離されましたが、デフォルトGemとして残っています。
* optparse
* OptionParser#parseやOptionParser#orderにキーワード引数 into を追加 11191
* pathname
* Pathname#empty? を追加 12596...