module ArchSpec::CLI
The archspec command line. Backs the exe/archspec executable and dispatches the init, check, explain, reflect, 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.
Constants
- CONFIG_FILE
- TEMPLATE
- USAGE_ERROR_STATUS
Public Instance Methods
# 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 'reflect' reflect(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.message}" error.puts usage(command) USAGE_ERROR_STATUS rescue Error => e error.puts "archspec: error: #{e.message}" 1 end