Class: UndriveGoogle::CLI
- Inherits:
-
Object
- Object
- UndriveGoogle::CLI
- Includes:
- Singleton
- Defined in:
- lib/undrive_google/cli.rb
Overview
Defines the CLI behavior & provides the Google Drive Session
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
-
#liberate! ⇒ Object
-
#parse(args) ⇒ Object
Options specified on the command line are collected in @options.
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/undrive_google/cli.rb', line 8 def @options end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
8 9 10 |
# File 'lib/undrive_google/cli.rb', line 8 def parser @parser end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
8 9 10 |
# File 'lib/undrive_google/cli.rb', line 8 def session @session end |
Instance Method Details
#liberate! ⇒ Object
28 29 30 31 |
# File 'lib/undrive_google/cli.rb', line 28 def liberate! Options.instance.title = session.file.title if missing_title? CaptiveFile.instance.liberate! end |
#parse(args) ⇒ Object
Options specified on the command line are collected in @options.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/undrive_google/cli.rb', line 14 def parse(args) @options = Options.instance @parser = OptionParser.new do |parser| @options.(parser) parser.parse!(args) end raise UndriveGoogle::Error, "file_id is required!" unless .file_id raise UndriveGoogle::Error, "dir is required!" unless .dir @session = Session.instance nil end |