### Home Classes Methods

### In Files

- lib/vmail/send_options.rb

### Parent

Vmail::Options

### Methods

- #parse

### Class/Module Index

Quicksearch

- Vmail
- Vmail::AddressQuoter
- Vmail::ContactsExtractor
- Vmail::ImapClient
- Vmail::MessageFormatter
- Vmail::Options
- Vmail::Query
- Vmail::ReplyTemplate
- Vmail::SendOptions
- Vmail::Sender
- String

No matching classes.

# Vmail::SendOptions

### Public Instance Methods

parse(argv) click to toggle source

    # File lib/vmail/send_options.rb, line 6
    def parse(argv)
      OptionParser.new do |opts|
        opts.banner = "Usage:  vmailsend"
        opts.separator ""
        opts.separator "Specific options:"
        opts.on("-c", "--config path", String, "Path to config file") do |config_file|
          @config_file = config_file
        end
        opts.on("-v", "--version", "Show version (identical to vmail version)") do
          require 'vmail/version'
          puts "vmail #{Vmail::VERSION}\nCopyright 2010 Daniel Choi under the MIT license"
          exit
        end
        opts.on("-h", "--help", "Show this message") do
          puts opts
          exit
        end
        opts.separator ""
        opts.separator INSTRUCTIONS

        begin
          opts.parse!(argv)
          if @config_file && File.exists?(@config_file)
            puts "Using config file #{@config_file}"
          else
            puts Missing config file! #{INSTRUCTIONS}
            exit(1)
          end

          @config = YAML::load(File.read(@config_file))
          if @config['password'].nil?
            @config['password'] = ask("Enter gmail password (won't be visible & won't be persisted):") {|q| q.echo = false}
          end

        rescue OptionParser::ParseError => e
          STDERR.puts e.message, "\n", opts
        end

      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.