Class: Slidict::Cli::Slides
- Inherits:
-
Object
- Object
- Slidict::Cli::Slides
- Defined in:
- lib/slidict/cli/slides.rb
Overview
Implements the slidict slides <list|show|create|edit> subcommands.
Instance Method Summary collapse
-
#initialize(output:, credentials: nil, client: nil, reauthenticate: nil) ⇒ Slides
constructor
A new instance of Slides.
-
#publish(body:, id: nil, title: nil, body_format: nil, visibility: nil) ⇒ Object
Creates or edits a draft directly, bypassing argv parsing (and its "looks like a flag" checks, which would reject body text such as YAML frontmatter that happens to start with "-").
- #run(argv) ⇒ Object
Constructor Details
#initialize(output:, credentials: nil, client: nil, reauthenticate: nil) ⇒ Slides
Returns a new instance of Slides.
7 8 9 10 11 12 |
# File 'lib/slidict/cli/slides.rb', line 7 def initialize(output:, credentials: nil, client: nil, reauthenticate: nil) @output = output @credentials = credentials || External::SlidictIo::Credentials.new @client = client @reauthenticate = reauthenticate end |
Instance Method Details
#publish(body:, id: nil, title: nil, body_format: nil, visibility: nil) ⇒ Object
Creates or edits a draft directly, bypassing argv parsing (and its "looks like a flag" checks, which would reject body text such as YAML frontmatter that happens to start with "-").
29 30 31 32 |
# File 'lib/slidict/cli/slides.rb', line 29 def publish(body:, id: nil, title: nil, body_format: nil, visibility: nil) = { id: id, title: title, body: body, body_format: body_format, visibility: visibility } id ? edit() : create() end |
#run(argv) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/slidict/cli/slides.rb', line 14 def run(argv) = parse(argv) return print_help if [:help] || [:subcommand].nil? send([:subcommand], ) rescue ArgumentError => e @output.puts "Error: #{e.}" @output.puts print_help 1 end |