# File lib/mcollective/optionparser.rb, line 128
    def add_common_options
      @parser.separator ""
      @parser.separator "Common Options"

      @parser.on('-T', '--target COLLECTIVE', 'Target messages to a specific sub collective') do |f|
        @options[:collective] = f
      end

      @parser.on('--dt', '--discovery-timeout SECONDS', Integer, 'Timeout for doing discovery') do |t|
        @options[:disctimeout] = t
      end

      @parser.on('-t', '--timeout SECONDS', Integer, 'Timeout for calling remote agents') do |t|
        @options[:timeout] = t
      end

      @parser.on('-q', '--quiet', 'Do not be verbose') do |v|
        @options[:verbose] = false
      end

      @parser.on('--ttl TTL', 'Set the message validity period') do |v|
        @options[:ttl] = v.to_i
      end

      @parser.on('--reply-to TARGET', 'Set a custom target for replies') do |v|
        @options[:reply_to] = v
      end

      @parser.on('--dm', '--disc-method METHOD', 'Which discovery method to use') do |v|
        raise "Discovery method is already set by a competing option" if @options[:discovery_method] && @options[:discovery_method] != v
        @options[:discovery_method] = v
      end

      @parser.on('--do', '--disc-option OPTION', 'Options to pass to the discovery method') do |a|
        @options[:discovery_options] << a
      end

      @parser.on("--nodes FILE", "List of nodes to address") do |v|
        raise "Cannot mix --disc-method, --disc-option and --nodes" if @options[:discovery_method] || @options[:discovery_options].size > 0
        raise "Cannot read the discovery file #{v}" unless File.readable?(v)

        @options[:discovery_method] = "flatfile"
        @options[:discovery_options] << v
      end

      @parser.on("--publish_timeout TIMEOUT", Integer, "Timeout for publishing requests to remote agents.") do |pt|
        @options[:publish_timeout] = pt
      end

      @parser.on("--threaded", "Start publishing requests and receiving responses in threaded mode.") do |v|
        @options[:threaded] = true
      end

      @parser.on("--sort", "Sort the output of an RPC call before processing.") do |v|
        @options[:sort] = true
      end

      @parser.on("--connection-timeout TIMEOUT", Integer, "Set the timeout for establishing a connection to the middleware") do |v|
        @options[:connection_timeout] = Integer(v)
      end
    end