1122件ヒット
[1-100件を表示]
(0.095秒)
ライブラリ
- optparse (1032)
-
rubygems
/ command (12)
クラス
-
Gem
:: Command (12) - OptionParser (708)
-
OptionParser
:: ParseError (120) -
RDoc
:: Options (24)
モジュール
キーワード
- AmbiguousArgument (12)
- AmbiguousOption (12)
- Arguable (12)
- InvalidArgument (12)
- InvalidOption (12)
- MissingArgument (12)
-
NEWS for Ruby 2
. 7 . 0 (6) - NeedlessArgument (12)
- ParseError (12)
- accept (24)
-
add
_ option (12) - args (12)
-
default
_ argv (12) -
default
_ argv= (12) - environment (12)
-
filter
_ backtrace (12) - getopts (60)
- help (12)
- inspect (12)
- load (12)
- new (24)
- on (144)
-
on
_ head (12) -
on
_ tail (12) -
option
_ parser (12) -
option
_ parser= (12) - optparse (12)
-
optparse
/ time (12) -
optparse
/ uri (12) - order (48)
- order! (48)
- parse (24)
- parse! (24)
- permute (24)
- permute! (24)
-
program
_ name (12) -
program
_ name= (12) - reason (12)
- reason= (12)
- recover (12)
- reject (24)
- release (12)
- release= (12)
-
ruby 1
. 8 . 2 feature (12) - separator (12)
-
set
_ backtrace (12) -
set
_ option (12) - summarize (24)
-
summary
_ indent (12) -
summary
_ indent= (12) -
summary
_ width (12) -
summary
_ width= (12) -
to
_ a (12) -
to
_ s (24) - ver (12)
- version (12)
- version= (12)
検索結果
先頭5件
-
OptionParser (44048.0)
-
コマンドラインのオプションを取り扱うためのクラスです。
...スです。
オプションが指定された時に呼ばれるブロックを
OptionParser#on メソッドで登録していきます。
つまり、OptionParser を使う場合、基本的には
(1) OptionParser オブジェクト opt を生成する。
(2) オプションを取り扱うブ......ンドラインを実際に parse する。
というような流れになります。
//emlist[][ruby]{
require "optparse"
ProgramConfig = Hash.new
opts = OptionParser.new
opts.on("-a"){|v| ProgramConfig[:a] = true } # オプション「-a」がコマンドラインで指定されていた場合......リを表示してから exit します。
: --version
OptionParser#ver を表示してから exit します。
OptionParser#ver が定義されていない場合は、そのようにエラーメッセージを出力して abort します。
オプション「--version」に「,」で区切ら... -
OptionParser
# version -> String (30106.0) -
プログラムのバージョンを文字列で返します。
...プログラムのバージョンを文字列で返します。
@return プログラムのバージョンを文字列で返します。
@see OptionParser#ver... -
OptionParser
# version=(ver) (30106.0) -
プログラムのバージョンを文字列で指定します。
...プログラムのバージョンを文字列で指定します。
@param ver プログラムのバージョンを文字列で指定します。
@see OptionParser#ver... -
OptionParser
# summary _ indent -> String (27224.0) -
サマリを表示する時のインデントを文字列で返します。
...列で返します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", "......-h, --help\n"]
opts.summary_indent = " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# summary _ indent=(indent) (27224.0) -
サマリを表示する時のインデントを文字列で指定します。
...@param indent サマリを表示する時に使われるインデントを文字列で指定します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summary_indent......# => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_indent = " " # => " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# summary _ width=(width) (27224.0) -
サマリを表示するときの幅を整数で指定します。
...param width サマリを表示するときの幅を整数で指定します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summary_width # => 32
opts.summarize
# =>......[" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_width = 8 # => 8
opts.summary_width # => 8
opts.summarize
# => [" -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}... -
OptionParser
# on _ tail(*arg , &block) -> self (27154.0) -
オプションを取り扱うためのブロックを自身の持つリストの最後に登録します。
...--version や --help の説明をサマリの最後に表示したい時に便利です。
@param arg OptionParser#on と同様です。
@param block OptionParser#on と同様です。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
op......ts.on_tail("-h", "--help")
end
puts opts.help
# => Usage: test [options]
# -i, --init
# -u, --update
# -h, --help
//}
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
opts.on_tail("--version", "S......how version") do
puts OptionParser::Version.join('.')
exit
end
//}
@see OptionParser#on, OptionParser#on_head... -
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) -> () (27124.0) -
サマリを指定された to へと加えていきます。
...m width サマリの幅を整数で指定します。
@param max サマリの最大幅を整数で指定します。
@param indent サマリのインデントを文字列で指定します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")......opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summarize(["description\n"], 10, 8, " ")
# => ["description\n", " -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\... -
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) {|line| . . . } -> () (27124.0) -
サマリを指定された to へと加えていきます。
...m width サマリの幅を整数で指定します。
@param max サマリの最大幅を整数で指定します。
@param indent サマリのインデントを文字列で指定します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")......opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summarize(["description\n"], 10, 8, " ")
# => ["description\n", " -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\...