594件ヒット
[1-100件を表示]
(0.137秒)
種類
- インスタンスメソッド (528)
- 特異メソッド (66)
ライブラリ
- optparse (594)
キーワード
- accept (22)
-
default
_ argv (11) - environment (11)
- getopts (44)
- help (11)
- load (11)
- new (22)
- on (132)
-
on
_ head (11) -
on
_ tail (11) - order (44)
- order! (22)
- parse (22)
- parse! (11)
- permute (22)
- permute! (11)
-
program
_ name (11) - reject (22)
- release (11)
- separator (11)
- summarize (22)
-
summary
_ indent (11) -
summary
_ indent= (11) -
summary
_ width (11) -
summary
_ width= (11) -
to
_ a (11) -
to
_ s (11) - ver (11)
- version (11)
検索結果
先頭5件
- OptionParser
# version -> String - OptionParser
# summary _ indent -> String - OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) -> () - OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) {|line| . . . } -> () - OptionParser
# summary _ indent=(indent)
-
OptionParser
# version -> String (9201.0) -
プログラムのバージョンを文字列で返します。
...プログラムのバージョンを文字列で返します。
@return プログラムのバージョンを文字列で返します。
@see OptionParser#ver... -
OptionParser
# summary _ indent -> String (6355.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"]
op......ts.summary_indent = " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) -> () (6257.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\n"]... -
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) {|line| . . . } -> () (6257.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\n"]... -
OptionParser
# summary _ indent=(indent) (6255.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 -> Integer (6255.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"]
//}... -
OptionParser
# summary _ width=(width) (6255.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 (6231.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")......ts.on("-u", "--update")
opts.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", "Show version") do
puts OptionParser::Version.join('.')
exit
end
//}
@see OptionParser#on, OptionParser#on_head... -
OptionParser
# environment(env) -> [String] (6201.0) -
環境変数 env に対して Shellwords.#shellwords を呼 んで配列にしてから parse を行ないます。
...@raise OptionParser::ParseError パースに失敗した場合、発生します。
実際は OptionParser::ParseError のサブク
ラスになります。
//emlist[例][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') # => ["remain data"]
p config # => {:lib=>"lib1"}
//}... -
OptionParser
# order!(argv = self . default _ argv , into: nil) -> [String] (3319.0) -
与えられた argv を順番に破壊的にパースします。 argv からオプションがすべて取り除かれます。 argv を返します。
...efile)に出会うと、パースを中断します。
ブロックが与えられている場合は、パースを中断せずに
引数をブロックに渡してブロックを評価し、パースを継続します。argv を返します。
下の例で言うと、コマンドの引数 somefile......ろにオプションを置くことができません。
-b もコマンドのオプションではない引数として扱われてしまいます。
@param argv パースしたい引数を文字列の配列で指定します。
@param into オプションを格納するハッシュを指定し......ます。
指定したハッシュにはオプションの名前をキーとして、OptionParser#onに渡されたブロックの値が格納されます。
キーの名前はロングオプションが定義されていればロングオプションの値を、...