154件ヒット
[1-100件を表示]
(0.051秒)
ライブラリ
- optparse (154)
クラス
- OptionParser (154)
キーワード
-
on
_ head (11) - parse (22)
- parse! (11)
- separator (11)
- summarize (22)
-
summary
_ indent (11) -
summary
_ indent= (11) -
summary
_ width (11) -
summary
_ width= (11) -
to
_ a (11) - ver (11)
検索結果
先頭5件
- OptionParser
# on _ tail(*arg , &block) -> self - 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 _ width -> Integer
-
OptionParser
# on _ tail(*arg , &block) -> self (18237.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"......)
opts.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
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) -> () (144.0) -
サマリを指定された to へと加えていきます。
...d("-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| . . . } -> () (144.0) -
サマリを指定された to へと加えていきます。
...d("-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 (142.0) -
サマリを表示する時のインデントを文字列で返します。
...("-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, --i......nit\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# summary _ width -> Integer (142.0) -
サマリを表示するときの幅を整数で返します。
...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
# on _ head(*arg , &block) -> self (130.0) -
オプションを取り扱うためのブロックを自身の持つリストの最初に登録します。
...][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
puts opts.help
# => Usage: test [options]
# -i, --init
# -u, --update
# -h, --help
//}
@see OptionParser#on, OptionParser#on_tail... -
OptionParser
# ver -> String (130.0) -
program_name、version と release から生成したバージョンを表す文字列を返します。
...|opts|
opts.banner = "Usage: example.rb [options]"
opts.program_name = "Optparse Example"
opts.version = [0, 1]
opts.release = "2019-05-01"
opts.on_tail("--version", "Show version") do
puts opts.ver # => "Optparse Example 0.1 (2019-05-01)"
exit
end
opts.parse!(ARGV)
end
//}... -
OptionParser
# to _ a -> [String] (124.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.to_a # => ["Usage: test [options]", " -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# parse!(argv = self . default _ argv) -> [String] (106.0) -
与えられた argv をパースします。
...opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
ARGV # => ["-i", "-u", "-h", "test"]
opts.parse(ARGV) # => ["test"]
ARGV # => ["-i", "-u", "-h", "test"]
opts.parse!(ARGV) # => ["test"]
ARGV... -
OptionParser
# parse!(argv = self . default _ argv , into: nil) -> [String] (106.0) -
与えられた argv をパースします。
...ばロングオプションの値を、
ショートオプションのみの場合はショートオプションの値から、先頭の "-" を除いてシンボル化した値が使用されます。
@raise OptionParser::ParseError パースに失敗した場合、発生します。......opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
ARGV # => ["-i", "-u", "-h", "test"]
opts.parse(ARGV) # => ["test"]
ARGV # => ["-i", "-u", "-h", "test"]
opts.parse!(ARGV) # => ["test"]
ARGV... -
OptionParser
# parse(*args) -> [String] (106.0) -
与えられた argv をパースします。 argv からオプションを取り除いたものを返します。
...ラスになります。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
ARGV # => ["-i", "-u", "-h", "test"]
opts.parse(ARGV) # => ["test"]
//}...