def command_select
      command = command_search( @commands, ARGV[0] )
      if command != nil then
        # remove command name from ARGV and search next.
        ARGV.delete_at( 0 )
        ARGV.each do |arg|
	  cmd = command_search( command.subcmd, arg )
	  break if cmd == nil
	  ARGV.delete_at( 0 )
	  command = cmd
        end
      end
      return command
    end
def command_select
      command = command_search( @commands, ARGV[0] )
      if command != nil then
        # remove command name from ARGV and search next.
        ARGV.delete_at( 0 )
        ARGV.each do |arg|
	  cmd = command_search( command.subcmd, arg )
	  break if cmd == nil
	  ARGV.delete_at( 0 )
	  command = cmd
        end
      end
      return command
    end
Select and return command object in application.