1028件ヒット
[1-100件を表示]
(0.104秒)
ライブラリ
- optparse (946)
-
rubygems
/ command (11)
クラス
-
Gem
:: Command (11) - OptionParser (649)
-
OptionParser
:: ParseError (110) -
RDoc
:: Options (22)
モジュール
キーワード
- AmbiguousArgument (11)
- AmbiguousOption (11)
- Arguable (11)
- InvalidArgument (11)
- InvalidOption (11)
- MissingArgument (11)
-
NEWS for Ruby 2
. 7 . 0 (5) - NeedlessArgument (11)
- ParseError (11)
- accept (22)
-
add
_ option (11) - args (11)
-
default
_ argv (11) -
default
_ argv= (11) - environment (11)
-
filter
_ backtrace (11) - getopts (55)
- help (11)
- inspect (11)
- load (11)
- new (22)
- on (132)
-
on
_ head (11) -
on
_ tail (11) -
option
_ parser (11) -
option
_ parser= (11) - optparse (11)
-
optparse
/ time (11) -
optparse
/ uri (11) - order (44)
- order! (44)
- parse (22)
- parse! (22)
- permute (22)
- permute! (22)
-
program
_ name (11) -
program
_ name= (11) - reason (11)
- reason= (11)
- recover (11)
- reject (22)
- release (11)
- release= (11)
-
ruby 1
. 8 . 2 feature (11) - separator (11)
-
set
_ backtrace (11) -
set
_ option (11) - summarize (22)
-
summary
_ indent (11) -
summary
_ indent= (11) -
summary
_ width (11) -
summary
_ width= (11) -
to
_ a (11) -
to
_ s (22) - ver (11)
- version (11)
- version= (11)
検索結果
先頭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\... -
OptionParser
# summary _ width -> Integer (27124.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_width # => 32
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_width......= 8
opts.summary_width # =>8
opts.summarize
# => [" -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}...