Class: SnippetCli::NewWorkflow

Inherits:
Object
  • Object
show all
Includes:
TriggerResolver, WizardHelpers::ErrorHandler, WizardHelpers::MatchFileSelector
Defined in:
lib/snippet_cli/new_workflow.rb

Overview

Thin orchestrator for the new-snippet wizard. Sequences collaborators (TriggerResolver, ReplacementWizard, SnippetBuilder) but contains no Gum/UI calls or business rules itself.

Constant Summary

Constants included from TriggerResolver

TriggerResolver::RUST_REGEX_GUIDANCE

Instance Method Summary collapse

Methods included from WizardHelpers::ValidationLoop

#prompt_non_empty, #prompt_until_valid

Methods included from WizardHelpers::PromptHelpers

#collect_search_terms, #confirm!, #list_confirm!, #optional_prompt, #prompt!

Methods included from WizardHelpers::ErrorHandler

#handle_errors

Methods included from WizardHelpers::MatchFileSelector

#pick_match_file

Instance Method Details

#run(opts) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/snippet_cli/new_workflow.rb', line 24

def run(opts)
  handle_errors(ValidationError, EspansoConfigError, YamlScalar::InvalidCharacterError, NoMatchFilesError) do
    context = prepare_context(opts)
    yaml, summary_clear = build_snippet(opts, context)
    deliver_snippet(yaml, context, summary_clear)
  end
end