Module: ArchSpec::CLI
Overview
The archspec command line. Backs the exe/archspec executable and
dispatches the init, check, explain, and version subcommands.
archspec init
archspec check [PATHS...] [--config PATH] [--format text|json] [--update-todo]
archspec explain PATH_OR_CONSTANT
#run returns the process exit status: 0 when clean, 1 when violations are found.
Defined Under Namespace
Classes: UsageError
Constant Summary collapse
- CONFIG_FILE =
'Archspec.rb'- USAGE_ERROR_STATUS =
64- TEMPLATE =
<<~RUBY architecture :rails RUBY
Instance Method Summary collapse
Instance Method Details
#run(argv, output: $stdout, error: $stderr) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/archspec/cli.rb', line 26 def run(argv, output: $stdout, error: $stderr) argv = argv.dup command = argv.shift || 'check' case command when 'help', '--help', '-h' help(argv, output) when 'init' init(argv, output) when 'check' check(argv, output) when 'explain' explain(argv, output) when 'version', '--version', '-v' raise UsageError, "unexpected argument: #{argv.first}" if argv.any? output.puts ArchSpec::VERSION 0 else raise UsageError, "unknown command: #{command}" end rescue OptionParser::ParseError, UsageError => e error.puts "archspec: error: #{e.}" error.puts usage(command) USAGE_ERROR_STATUS rescue Error => e error.puts "archspec: error: #{e.}" 1 end |