mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Raise error if attempting to both explain issue and autocorrect
This commit is contained in:
parent
a40fdee33f
commit
470e41cb7b
1 changed files with 10 additions and 3 deletions
|
@ -7,8 +7,15 @@ module Ameba::Cli
|
|||
|
||||
def run(args = ARGV)
|
||||
opts = parse_args args
|
||||
location_to_explain = opts.location_to_explain
|
||||
autocorrect = opts.autocorrect?
|
||||
|
||||
if location_to_explain && autocorrect
|
||||
raise "Invalid usage: Cannot explain an issue and autocorrect at the same time."
|
||||
end
|
||||
|
||||
config = Config.load opts.config, opts.colors?
|
||||
config.autocorrect = opts.autocorrect?
|
||||
config.autocorrect = autocorrect
|
||||
|
||||
if globs = opts.globs
|
||||
config.globs = globs
|
||||
|
@ -26,8 +33,8 @@ module Ameba::Cli
|
|||
|
||||
runner = Ameba.run(config)
|
||||
|
||||
if location = opts.location_to_explain
|
||||
runner.explain(location)
|
||||
if location_to_explain
|
||||
runner.explain(location_to_explain)
|
||||
else
|
||||
exit 1 unless runner.success?
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue