Sha256: 9b9d244c7eddc777418498d07b33973269f54de0f00eeaabe00df4149c8908c6

Contents?: true

Size: 772 Bytes

Versions: 2

Compression:

Stored size: 772 Bytes

Contents

module Ratch

  # General Options

  module GeneralOptions

    # Duplicate of ARGV.

    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

2 entries across 2 versions & 1 rubygems

Version Path
ratch-0.2.1 lib/ratch/options.rb
ratch-0.2.2 lib/ratch/options.rb