Sha256: 665b8478e6beeb46a3e9a30be155a6c1818f601616d38eb54f4176e05549ce9f

Contents?: true

Size: 942 Bytes

Versions: 5

Compression:

Stored size: 942 Bytes

Contents

module Scide

  # Pre-configured scide option parser.
  class Opts < Upoj::Opts

    # Returns the scide option parser. Run scide with <tt>--usage</tt>
    # to see available options.
    def initialize
      super({
        :banner => {
          :usage => '[OPTION]... PROJECT',
          :description => 'generates GNU Screen configuration files.'
        }
      })

      on '-c', '--config FILE', 'load configuration from FILE'
      on '--dry-run', 'show what would be run but do not execute'
      on('--version', 'show version and exit'){ puts "#{program_name} #{Scide::VERSION}"; exit 0 }

      help!.usage!
    end

    # Parses the given arguments.
    #
    # Causes scide to fail with an <tt>invalid_argument</tt> error (see {Scide.fail})
    # if an argument is invalid.
    def parse! args
      begin
        super args
      rescue StandardError => err
        Scide.fail :invalid_argument, err
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scide-0.0.12 lib/scide/opts.rb
scide-0.0.11 lib/scide/opts.rb
scide-0.0.10 lib/scide/opts.rb
scide-0.0.9 lib/scide/opts.rb
scide-0.0.8 lib/scide/opts.rb