Sha256: 211361efd7d67dd03ca8eae73d12771c3d20d6bc5823a66184975b43837f0110

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

module Ratch

  # General Options

  module GeneralOptions

    #

    def argv
      @argv ||= ARGV.dup
    end

    # Convert command line argv to args.
    #
    # TODO Is this implmented as expected?

    def command_parameters
      argv.to_params
    end

    # Debug mode.

    def debug?
      @debug
    end

    #

    def trace?
      @trace ||= %w{--trace}.any?{|a| argv.delete(a)}
    end

    #

    def trace!
      @trace = true
    end

    #

    def noharm?
      @noharm ||= %w{--dryrun --dry-run --noharm}.any?{|a| argv.delete(a)}
    end

    alias_method :dryrun?, :noharm? ; module_function :dryrun?

    #

    def noharm!
      @noharm = true
    end
    alias_method :dryrun!, :noharm! ; module_function :dryrun!

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ratch-0.1 lib/ratch/options.rb