Class: Sharekit::Cli::App

Inherits:
Thor
  • Object
show all
Defined in:
lib/sharekit/cli.rb

Overview

Thor gives us subcommand dispatch, flag parsing, and --help for free — the TS original hand-parses process.argv/flags itself.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


24
# File 'lib/sharekit/cli.rb', line 24

def self.exit_on_failure? = true

Instance Method Details

#init(*skill_names) ⇒ Object



63
64
65
66
67
68
69
70
# File 'lib/sharekit/cli.rb', line 63

def init(*skill_names)
  result = Init.call(profile_dir: options[:dir], skill_names:, force: options[:force])
  print_init_summary(result)
  Reporter.report(result.findings, force: options[:force])
rescue Error => e
  warn e.message
  exit 1
end

#scan(dir = ".") ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/sharekit/cli.rb', line 45

def scan(dir = ".")
  findings = collect_findings(dir)
  findings = triage(findings) if options[:ai_triage]
  Reporter.report(findings, force: options[:force])
rescue Error => e
  warn e.message
  exit 1
end