Class: HerokuAppInfo::Options
- Inherits:
-
Object
- Object
- HerokuAppInfo::Options
- Defined in:
- lib/heroku_app_info/options.rb
Instance Attribute Summary collapse
-
#apps ⇒ Object
readonly
Returns the value of attribute apps.
-
#authz ⇒ Object
readonly
Returns the value of attribute authz.
-
#out_dir ⇒ Object
readonly
Returns the value of attribute out_dir.
-
#rest ⇒ Object
readonly
Returns the value of attribute rest.
Instance Method Summary collapse
- #cli_parser ⇒ OptionParser
- #defaults! ⇒ Object
- #help ⇒ Object
-
#initialize(argv) ⇒ Options
constructor
A new instance of Options.
- #no_cache? ⇒ Boolean
- #raw_output? ⇒ Boolean
- #show_all? ⇒ Boolean
Constructor Details
#initialize(argv) ⇒ Options
Returns a new instance of Options.
8 9 10 11 12 |
# File 'lib/heroku_app_info/options.rb', line 8 def initialize(argv) defaults! @parser = cli_parser @rest = @parser.parse(argv) end |
Instance Attribute Details
#apps ⇒ Object (readonly)
Returns the value of attribute apps.
13 14 15 |
# File 'lib/heroku_app_info/options.rb', line 13 def apps @apps end |
#authz ⇒ Object (readonly)
Returns the value of attribute authz.
13 14 15 |
# File 'lib/heroku_app_info/options.rb', line 13 def authz @authz end |
#out_dir ⇒ Object (readonly)
Returns the value of attribute out_dir.
13 14 15 |
# File 'lib/heroku_app_info/options.rb', line 13 def out_dir @out_dir end |
#rest ⇒ Object (readonly)
Returns the value of attribute rest.
13 14 15 |
# File 'lib/heroku_app_info/options.rb', line 13 def rest @rest end |
Instance Method Details
#cli_parser ⇒ OptionParser
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/heroku_app_info/options.rb', line 44 def cli_parser OptionParser.new do |opt| opt.on("-a", "--app-list APP,APP,APP") do |apps| @apps = apps.split(",") end opt.on("--app-list-from FILE") do |file| if File.exist?(file) && File.readable?(file) @apps = File.read(file).lines(chomp: true) end end opt.on("-n", "--no-cache") do @no_cache = true end opt.on("-o", "--out-dir [DIR]") do |dir| if File.exist?(dir) && File.directory?(dir) && File.writable?(dir) @out_dir = dir end end opt.on("-r", "--raw-output") do @raw_output = true end opt.on("-s", "--show-all-apps", "not include detail") do @show_all = true end opt.on("-z", "--authorizarion AUTH") do |auth| @authz = auth end opt.version = VERSION end end |
#defaults! ⇒ Object
33 34 35 |
# File 'lib/heroku_app_info/options.rb', line 33 def defaults! @out_dir = Dir.pwd end |
#help ⇒ Object
37 38 39 |
# File 'lib/heroku_app_info/options.rb', line 37 def help @parser.help end |
#no_cache? ⇒ Boolean
25 26 27 |
# File 'lib/heroku_app_info/options.rb', line 25 def no_cache? @no_cache end |
#raw_output? ⇒ Boolean
29 30 31 |
# File 'lib/heroku_app_info/options.rb', line 29 def raw_output? @raw_output end |
#show_all? ⇒ Boolean
18 19 20 |
# File 'lib/heroku_app_info/options.rb', line 18 def show_all? @show_all end |