File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,16 +3,19 @@ module Geode::Commands
33 def initialize
44 super
55
6+ @debug = false
67 @inherit_options = true
78 add_option " no-color" , description: " disable ansi color formatting"
89 add_option 'h' , " help" , description: " get help information"
10+ add_option " debug" , hidden: true
911 end
1012
1113 def help_template : String
1214 Commands .format_command self
1315 end
1416
1517 def pre_run (arguments : Cling ::Arguments , options : Cling ::Options ) : Nil
18+ @debug = options.has? " debug"
1619 Colorize .enabled = false if options.has? " no-color"
1720 return unless options.has? " help"
1821
@@ -54,6 +57,11 @@ module Geode::Commands
5457 " https://github.com/devnote-dev/geode/issues"
5558 )
5659 end
60+
61+ if @debug
62+ info " Debug backtrace:"
63+ (ex.backtrace || %w[???] ).each { |line | stdout << " " << line << '\n' }
64+ end
5765 end
5866
5967 def on_missing_arguments (args : Array (String ))
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ module Geode::Commands
5252 max_size = 6 + command.options.keys.max_of & .size
5353
5454 command.options.each do |name , option |
55+ next if option.hidden?
5556 name_size = 2 + option.long.size
5657
5758 str << " » "
You can’t perform that action at this time.
0 commit comments