Class: Slidict::Cli::App
- Inherits:
-
Object
- Object
- Slidict::Cli::App
- Includes:
- Options
- Defined in:
- lib/slidict/cli/app.rb
Constant Summary collapse
- QUESTIONS =
Keyed by the same symbols as the parsed CLI options (options, etc.), so a missing answer's question text can be looked up directly by
questions_for. { topic: "What would you like to talk about?", duration: "How long is the presentation?", audience: "Who is the audience?", goal: "What should the audience remember or do?" }.freeze
Constants included from Options
Options::FAILURE, Options::MISSING, Options::SUCCESS
Instance Method Summary collapse
Methods included from Options
Instance Method Details
#run(argv = []) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/slidict/cli/app.rb', line 62 def run(argv = []) = parse(argv) return print_help if [:help] return auth if [:command] == "auth" return ([:args]) if [:command] == "slides" return serve([:args]) if [:command] == "serve" return lint([:args]) if [:command] == "lint" return list_methods if [:command] == "list-methods" return show_method([:args]) if [:command] == "show-method" return init if [:command] == "init" config = build_config() return print_available_models(config) if config.llm_enabled? && config.model.nil? client = llm_client_for(config) return FAILURE if client && !verify_connection(client) questions = questions_for(client, ) deck = Deck.new( topic: ask(questions[:topic], [:topic]), duration: ask(questions[:duration], [:duration]), audience: ask(questions[:audience], [:audience]), goal: ask(questions[:goal], [:goal]), framework: [:framework], presentation_method: [:presentation_method] ) if client begin = client.(deck, language: [:language]) rescue Llm::Client::Error => e @output.puts "Error: LLM request failed (#{e.})" return FAILURE end deck = Deck.new( topic: deck.topic, duration: deck.duration, audience: deck.audience, goal: deck.goal, framework: deck.framework, slides: , presentation_method: deck.presentation_method ) end path = [:output] content = @renderer.render(deck) FileUtils.mkdir_p(File.dirname(path)) File.write(path, content) @output.puts "Created #{path}" return publish_to_slidict(deck, content, ) if [:publish] || [:slide_id] SUCCESS rescue ArgumentError => e @output.puts "Error: #{e.}" @output.puts print_help FAILURE end |