lib/make_menu/menu.rb in make_menu-0.0.3 vs lib/make_menu/menu.rb in make_menu-0.0.5
- old
+ new
@@ -81,22 +81,33 @@
self.status_present = true
next
end
unless current_group
- current_group = MenuItemGroup.new
+ current_group = MenuItemGroup.new('Commands'.color(group_title_color))
groups << current_group
end
items << current_group.add_item(
MenuItem.new(option_number, target, description)
)
option_number += 1
end
end
+
+ if option_number == 1
+ puts
+ puts 'No annotated targets found!'.red.bold
+ puts
+ puts 'Expecting something like this....'
+ puts " #{'my_target:'.cyan} #{'## Do some things'.yellow}"
+ puts
+ exit 1
+ end
end
+
end
# rubocop:enable Metrics/MethodLength
# Execute the selected menu item
@@ -142,21 +153,21 @@
.join("\n")
end
# Get the menu logo from the LOGO constant
def logo
- return "\n#{' make '.black_bg.light_yellow}#{' menu '.light_yellow_bg.black}\n".bold unless Object.const_defined?("#{self.class.name}::LOGO")
+ return "\n#{" #{Dir.pwd.split('/').last} ".light_yellow_bg.black.bold}\n \n" unless Object.const_defined?("#{self.class.name}::LOGO")
Object.const_get("#{self.class.name}::LOGO")
end
protected
# Override the following methods to customise the menu display
- # @return [Symbol] Color for group title
+ # @return [Symbol,Array[Symbol]] Color for group title
def group_title_color
- :light_green
+ %i[yellow bold]
end
# Clean screen before and after each command
def clear_screen?
true