Module: ArchSpec::CLI

Extended by:
CLI
Included in:
CLI
Defined in:
lib/archspec/cli.rb

Constant Summary collapse

CONFIG_FILE =
'Archspec.rb'
TEMPLATE =
<<~RUBY
  ArchSpec.define "Application architecture" do
    root "."
    preset :rails_way
  end
RUBY

Instance Method Summary collapse

Instance Method Details

#run(argv, output: $stdout, error: $stderr) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/archspec/cli.rb', line 17

def run(argv, output: $stdout, error: $stderr)
  argv = argv.dup
  command = argv.shift || 'check'

  case command
  when 'init'
    init(argv, output)
  when 'check'
    check(argv, output)
  when 'explain'
    explain(argv, output)
  when 'version', '--version', '-v'
    output.puts ArchSpec::VERSION
    0
  else
    error.puts "Unknown command: #{command}"
    error.puts usage
    64
  end
rescue Error => e
  error.puts e.message
  1
end