-
Notifications
You must be signed in to change notification settings - Fork 34
Banner, Synopsis and Version
nanobowers edited this page Mar 5, 2017
·
3 revisions
Synopsis can be used to override the default header of the message.
It will also print the version if version
is specified.
opts = Trollop::options do
synopsis "Overall synopsis of this program"
version "cool-script v0.3 (code-name: apple-cake)"
opt :juice, "use juice"
opt :milk, "use milk"
opt :litres, "quantity of liquid", :default => 2.0
opt :brand, "brand name of the liquid", :type => :string
end
opts = Trollop::options do
synopsis "Overall synopsis of this program"
version "cool-script v0.3 (code-name: apple-cake)"
banner "My Banner"
opt :juice, "use juice"
opt :milk, "use milk"
opt :litres, "quantity of liquid", :default => 2.0
opt :brand, "brand name of the liquid", :type => :string
end
You can re-introduce the version-string into your custom banners using self.version
Multiple banners are inserted in the order they are given, before/between/after the options they are adjacent to.
opts = Trollop::options do
version "cool-script v0.3 (code-name: apple-cake)"
banner self.version ## print out the version in the banner
banner "drinks"
opt :juice, "use juice"
opt :milk, "use milk"
banner "drink control" ## can be used for categories
opt :litres, "quantity of liquid", :default => 2.0
opt :brand, "brand name of the liquid", :type => :string
banner "other controls"
end