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.
7 8 9 |
# File 'lib/undrive_google/cli.rb', line 7 def @options end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
7 8 9 |
# File 'lib/undrive_google/cli.rb', line 7 def parser @parser end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
7 8 9 |
# File 'lib/undrive_google/cli.rb', line 7 def session @session end |
Instance Method Details
#liberate! ⇒ Object
27 28 29 30 |
# File 'lib/undrive_google/cli.rb', line 27 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*.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/undrive_google/cli.rb', line 13 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 |