Class: UndriveGoogle::Options

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/undrive_google/options.rb

Overview

Combine defaults with YAML and CLI provided options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



12
13
14
# File 'lib/undrive_google/options.rb', line 12

def initialize
  load_yaml(true)
end

Instance Attribute Details

#config_yamlObject

Returns the value of attribute config_yaml.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def config_yaml
  @config_yaml
end

#dirObject

Returns the value of attribute dir.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def dir
  @dir
end

#extensionsObject

Returns the value of attribute extensions.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def extensions
  @extensions
end

#file_byObject

Returns the value of attribute file_by.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def file_by
  @file_by
end

#file_idObject

Returns the value of attribute file_id.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def file_id
  @file_id
end

#keep_zipObject

Returns the value of attribute keep_zip.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def keep_zip
  @keep_zip
end

#key_fileObject

Returns the value of attribute key_file.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def key_file
  @key_file
end

#langObject

Returns the value of attribute lang.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def lang
  @lang
end

#renameObject

Returns the value of attribute rename.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def rename
  @rename
end

#rename_procObject

Returns the value of attribute rename_proc.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def rename_proc
  @rename_proc
end

#sweepObject

Returns the value of attribute sweep.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def sweep
  @sweep
end

#titleObject

Returns the value of attribute title.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def title
  @title
end

#unzipObject

Returns the value of attribute unzip.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def unzip
  @unzip
end

#verboseObject

Returns the value of attribute verbose.



8
9
10
# File 'lib/undrive_google/options.rb', line 8

def verbose
  @verbose
end

Instance Method Details

#define_options(parser) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/undrive_google/options.rb', line 16

def define_options(parser)
  parser.banner = "Usage: undrive_google [options]"
  parser.separator ""

  # Handle YAML, as default overrides
  config_yaml_option(parser)

  # ARGV will override the defaults and YAML values
  key_file_option(parser)
  file_id_option(parser)
  by_option(parser)
  extensions_option(parser)
  unzip_option(parser)
  keep_zip_option(parser)
  rename_options(parser)
  dir_option(parser)
  lang_option(parser)
  title_option(parser)
  sweep_option(parser)
  verbose_option(parser)

  parser.separator ""

  # Print an options summary.
  parser.on_tail("-h", "--help", "Show this message") do
    puts parser
    exit
  end
end