lib/landrush/command.rb in landrush-0.8.0 vs lib/landrush/command.rb in landrush-0.9.0

- old
+ new

@@ -6,18 +6,25 @@ ARGV.shift # flush landrush from ARGV, RExec wants to use it for daemon commands command = ARGV.first if DAEMON_COMMANDS.include?(command) Server.daemonize - elsif command == 'dependentvms' + elsif command == 'dependentvms' || command == 'vms' if DependentVMs.any? @env.ui.info(DependentVMs.list.map { |dvm| " - #{dvm}" }.join("\n")) else @env.ui.info("No dependent VMs") end - elsif command == 'install' - ResolverConfig.ensure_config_exists + elsif command == 'ls' || command == 'list' + IO.popen("/usr/bin/pr -2 -t -a", "w") do |io| + Landrush::Store.hosts.each do |key, value| + io.puts "#{key}" + io.puts "#{value}" + end + end + elsif command == 'help' + @env.ui.info(help) else boom("'#{command}' is not a command") end 0 # happy exit code @@ -28,18 +35,26 @@ end def usage(msg); <<-EOS.gsub(/^ /, '') ERROR: #{msg} + #{help} + EOS + end + + def help; <<-EOS.gsub(/^ /, '') vagrant landrush <command> commands: {start|stop|restart|status} control the landrush server daemon - dependentvms + list, ls + list all DNS entries known to landrush + dependentvms, vms list vms currently dependent on the landrush server - install - install resolver config for host visbility (requires sudo) + help + you're lookin at it! EOS end + end end