Skip to content

Commit 101e626

Browse files
committed
chore(commands): resolve stupid ameba lints
1 parent b184b99 commit 101e626

2 files changed

Lines changed: 11 additions & 17 deletions

File tree

src/commands/base.cr

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ module Geode::Commands
1414

1515
def pre_run(arguments : Cling::Arguments, options : Cling::Options) : Nil
1616
Colorize.enabled = false if options.has? "no-color"
17+
return unless options.has? "help"
1718

18-
if options.has? "help"
19-
stdout.puts help_template
20-
exit_program 0
21-
end
19+
stdout.puts help_template
20+
exit_program 0
2221
end
2322

2423
def on_error(ex : Exception)
@@ -151,18 +150,14 @@ module Geode::Commands
151150
end
152151

153152
protected def ensure_local_shard! : Nil
154-
unless File.exists? "shard.yml"
155-
error "A shard.yml file was not found", "Run 'geode init' to initialize one"
156-
exit_program
157-
end
153+
return if File.exists? "shard.yml"
154+
155+
fatal "A shard.yml file was not found", "Run 'geode init' to initialize one"
158156
end
159157

160158
protected def ensure_local_shard_and_lib! : Nil
161159
ensure_local_shard!
162-
unless Dir.exists? "lib"
163-
error "No shards installed"
164-
exit_program
165-
end
160+
fatal "No shards installed" unless Dir.exists? "lib"
166161
end
167162

168163
protected def format_time(time : Time::Span) : String

src/commands/info.cr

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,11 @@ module Geode::Commands
7474
end
7575
stdout << '\n'
7676
end
77+
return if shard.executables.empty?
7778

78-
unless shard.executables.empty?
79-
stdout << "executables:\n".colorize.bold
80-
shard.executables.each { |e| stdout << "" << e << '\n' }
81-
stdout << '\n'
82-
end
79+
stdout << "executables:\n".colorize.bold
80+
shard.executables.each { |e| stdout << "" << e << '\n' }
81+
stdout << '\n'
8382
end
8483
end
8584
end

0 commit comments

Comments
 (0)