def run(argv)
      dup_argv = argv.dup
      begin
        @opt_parse.order! dup_argv
      rescue OptionParser::InvalidOption => e
      end

      command_to_run = dup_argv.join " "

      # Run on all devices
      if @options[:index]
        devices = get_connected_devices
        device = devices[@options[:index]]
        if device.nil?
          raise "Requested device #{@options[:index]} but only have #{devices.length} devices connected."
        end

        run_adb_command command_to_run, device

        return
      end

      # Run on a specific device
      if @options[:name]
        if !@config.key? "aliases"
          raise "No aliases defined in your ~/nadb.config file"
        end

        device = @config["aliases"][@options[:name]]
        if device.nil?
          raise "Requested device not found in aliases"
        end
        
        run_adb_command command_to_run, device

        return
      end

      # Run on all connected devices
      if @options[:all]
        devices = get_connected_devices
        devices.each do |device|
          run_adb_command command_to_run, device
        end
        return
      end

      # Just pass everything to adb as we got it
      passthrough_command = argv.join " "
      run_adb_command passthrough_command
    end
def run(argv)
      dup_argv = argv.dup
      begin
        @opt_parse.order! dup_argv
      rescue OptionParser::InvalidOption => e
      end

      command_to_run = dup_argv.join " "

      # Run on all devices
      if @options[:index]
        devices = get_connected_devices
        device = devices[@options[:index]]
        if device.nil?
          raise "Requested device #{@options[:index]} but only have #{devices.length} devices connected."
        end

        run_adb_command command_to_run, device

        return
      end

      # Run on a specific device
      if @options[:name]
        if !@config.key? "aliases"
          raise "No aliases defined in your ~/nadb.config file"
        end

        device = @config["aliases"][@options[:name]]
        if device.nil?
          raise "Requested device not found in aliases"
        end
        
        run_adb_command command_to_run, device

        return
      end

      # Run on all connected devices
      if @options[:all]
        devices = get_connected_devices
        devices.each do |device|
          run_adb_command command_to_run, device
        end
        return
      end

      # Just pass everything to adb as we got it
      passthrough_command = argv.join " "
      run_adb_command passthrough_command
    end
Bakes fresh cookies.