Class: Gdsh::Gdsh
- Inherits:
-
DriveService
- Object
- DriveService
- Gdsh::Gdsh
- Includes:
- CommandFactory
- Defined in:
- lib/gdsh.rb
Overview
Gdsh Class
Instance Method Summary collapse
- #clear_screen ⇒ Object
- #init_shell ⇒ Object
- #prints_prompt ⇒ Object
- #puts_banner ⇒ Object
- #puts_hint ⇒ Object
-
#shell ⇒ Object
Command interpreter.
Methods included from CommandFactory
Methods included from Commands
commands, interpret, puts_usage_header, usage
Methods inherited from DriveService
#authorize, #authorize_from_authorization_code, #authorize_from_refresh_token, #credentials_from_file, #credentials_from_stdin, #init_client, #initialize, #puts_refresh_error, #write_session_info_to_file
Constructor Details
This class inherits a constructor from DriveService
Instance Method Details
#clear_screen ⇒ Object
29 30 31 |
# File 'lib/gdsh.rb', line 29 def clear_screen system('clear') || system('cls') end |
#init_shell ⇒ Object
33 34 35 36 37 38 |
# File 'lib/gdsh.rb', line 33 def init_shell clear_screen puts_hint end |
#prints_prompt ⇒ Object
40 41 42 |
# File 'lib/gdsh.rb', line 40 def prints_prompt print 'gdsh> '.colorize(:light_blue) end |
#puts_banner ⇒ Object
19 20 21 22 23 |
# File 'lib/gdsh.rb', line 19 def puts '' puts 'CLI tool to interface with Google Drive'.colorize(:green) puts '======================================='.colorize(:green) end |
#puts_hint ⇒ Object
25 26 27 |
# File 'lib/gdsh.rb', line 25 def puts_hint puts 'Hint: type \'help\'.'.colorize(:green) end |
#shell ⇒ Object
Command interpreter
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/gdsh.rb', line 47 def shell init_shell loop do prints_prompt params = parsed_inputs command = next_command(params) command.new(@client, params).execute break if command.terminal? end write_session_info_to_file end |