bin/tap in tap-0.18.0 vs bin/tap in tap-0.19.0

- old
+ new

@@ -13,55 +13,50 @@ # require "#{File.dirname(__FILE__)}/../lib/tap.rb" # -# setup the environment +# setup the application # begin - exe = Tap::Exe.setup + app = Tap::App.setup rescue(Tap::Env::ConfigError) # catch errors and exit gracefully # (errors usu from gem loading errors) puts $!.message exit(1) end # -# launch tap +# launch the command # -exe.activate -exe.launch(ARGV) do - template = %Q{<% unless entries.empty? || count <= 1 %> +commands = app.env.manifest do |env| + env.root.glob(:cmd, "**/*.rb") +end + +case command = ARGV.shift.to_s +when '', '--help' + template = %Q{<% unless minimap.empty? || count <= 1 %> <%= env_key %>: <% end %> -<% entries.each do |key, path| %> +<% minimap.each do |key, path| %> <%= key.ljust(width) %> <% end %>} - commands = exe.manifest(:command).inspect(template, - :count => 0, - :width => 10 - ) do |templater, globals| - entries = templater.manifest.minimap - templater.entries = entries - - # determine width, count - width = globals[:width] - entries.each do |key, path| - width = key.length if width < key.length - end - globals[:width] = width - globals[:count] += 1 unless entries.empty? - end - puts Lazydoc.usage(__FILE__) puts puts "available commands:" - puts commands + puts commands.summarize(template) puts puts "version #{Tap::VERSION} -- #{Tap::WEBSITE}" +else + if path = commands.seek(command) + load path + else + puts "Unknown command: '#{command}'" + puts "Type 'tap --help' for usage information." + end end exit(0) \ No newline at end of file