Class: Slidict::Cli::Slides
- Inherits:
-
Object
- Object
- Slidict::Cli::Slides
- Includes:
- Options
- Defined in:
- lib/slidict/cli/slides.rb
Overview
Implements the slidict slides <list|show|create|edit> subcommands.
Constant Summary
Constants included from Options
Options::FAILURE, Options::MISSING, Options::SUCCESS
Instance Method Summary collapse
-
#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
Methods included from Options
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 "-").
46 47 48 49 |
# File 'lib/slidict/cli/slides.rb', line 46 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
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/slidict/cli/slides.rb', line 31 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 FAILURE end |