ライブラリ
- optparse (209)
キーワード
-
default
_ argv (11) -
default
_ argv= (11) -
on
_ head (11) -
on
_ tail (11) - order! (22)
- parse (22)
- parse! (11)
- permute (22)
- permute! (11)
- summarize (22)
-
summary
_ indent (11) -
summary
_ indent= (11) -
summary
_ width (11) -
summary
_ width= (11) -
to
_ a (11)
検索結果
先頭5件
- 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 -> String - OptionParser
# summary _ indent=(indent) - OptionParser
# summary _ width -> Integer
-
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) -> () (6320.0) -
サマリを指定された to へと加えていきます。
...ます。
//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| . . . } -> () (6320.0) -
サマリを指定された to へと加えていきます。
...ます。
//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 -> String (6120.0) -
サマリを表示する時のインデントを文字列で返します。
...turn サマリを表示する時のインデントを文字列で返します。
//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.sum......marize
# => [" -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) (6120.0) -
サマリを表示する時のインデントを文字列で指定します。
...t[例][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_i......ndent = " " # => " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# summary _ width -> Integer (6120.0) -
サマリを表示するときの幅を整数で返します。
...す。
@return サマリを表示するときの幅を整数で返します。
//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) (6120.0) -
サマリを表示するときの幅を整数で指定します。
...mlist[例][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
# default _ argv -> [String] (6102.0) -
自身がデフォルトでパースする引数を文字列の配列で返します。
...ます。
@param argv デフォルトでパースする文字列の配列を返します。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new
# --hoo param1 --bar param2 をパラメーターに指定して実行
opts.default_argv # => ["--foo", "param1", "--bar", "param2"]
//}... -
OptionParser
# default _ argv=(argv) (6102.0) -
自身がデフォルトでパースする引数を文字列の配列で指定します。
...します。
OptionParser#parse の引数が指定されなかったときに使われます。
@param argv デフォルトでパースしたい文字列の配列を指定します。
//emlist[例][ruby]{
require "optparse"
config = {}
opts = OptionParser.new
opts.on("-r", "--require LIBRARY"){|......config[:lib] = lib }
# パラメーター指定なしで実行
opts.default_argv # => []
opts.parse!
p config # => {}
opts.default_argv = ["--require", "lib1"] # => ["--require", "lib"]
opts.default_argv # => ["--require", "param1"]
opts.parse!
p config # => {:lib=>"lib1"}
//}... -
OptionParser
# permute!(argv = self . default _ argv) -> [String] (6102.0) -
与えられた argv を破壊的にパースします。argv からオプションがすべて取り除かれます。 オプションではないコマンドの引数(下の例で言うと somefile)があってもパースを中断しません。 argv を返します。
...。
@raise OptionParser::ParseError パースに失敗した場合、発生します。
実際は OptionParser::ParseError のサブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.o......n('-a [VAL]') {|v| p :a }
opt.on('-b ') {|v| p :b }
opt.permute!(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
:b
["somefile"]... -
OptionParser
# permute!(argv = self . default _ argv , into: nil) -> [String] (6102.0) -
与えられた argv を破壊的にパースします。argv からオプションがすべて取り除かれます。 オプションではないコマンドの引数(下の例で言うと somefile)があってもパースを中断しません。 argv を返します。
...ョンを格納するハッシュを指定します。
指定したハッシュにはオプションの名前をキーとして、OptionParser#onに渡されたブロックの値が格納されます。
キーの名前はロングオプションが定義されていればロ......。
@raise OptionParser::ParseError パースに失敗した場合、発生します。
実際は OptionParser::ParseError のサブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.on......('-a [VAL]') {|v| p :a }
opt.on('-b ') {|v| p :b }
opt.permute!(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
:b
["somefile"]... -
OptionParser
# permute(*args) -> [String] (6102.0) -
与えられた argv をパースします。 オプションではないコマンドの引数(下の例で言うと somefile)があってもパースを中断しません。 argv からオプションを取り除いたものを返します。
...。
@raise OptionParser::ParseError パースに失敗した場合、発生します。
実際は OptionParser::ParseError のサブク
ラスになります。
//emlist[opt.rb][ruby]{
require 'optparse'
opt = OptionParser.new
opt.o......n('-a [VAL]') {|v| p :a }
opt.on('-b ') {|v| p :b }
opt.permute!(ARGV)
p ARGV
//}
↓
$ ruby opt.rb -a foo somefile -b
:a
:b
["somefile"]...