Sha256: 71f869e6733cffda569a134bc807f4a007cd717396d9daaff378557c17f32fa5
Contents?: true
Size: 807 Bytes
Versions: 3
Compression:
Stored size: 807 Bytes
Contents
require 'optparse' module Sijka class SijkaParser def initialize(argv, stdin) @argv = argv @stdin = stdin end def parse_flags options = {} OptionParser.new do |opts| opts.banner = 'Usage: sijka [name] [-h] [-f sijkafile] [-l]' opts.on('-l', 'List available sijka files') do |_| options['list'] = true end opts.on('-f SIJKAFILE', 'Specify a sijka file') do |sijkafile| options['sijkafile'] = sijkafile end opts.on('-r', 'Random file') do |_| options['sijkafile'] = Sijka::FILE_LIST.sample end end.parse! options end def parse_message if @argv.any? @argv.join(' ') else @stdin.tty? ? '' : @argv.read.chomp end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sijka-0.0.3.5 | lib/sijka/parser.rb |
sijka-0.0.3.4.1 | lib/sijka/parser.rb |
sijka-0.0.3.4 | lib/sijka/parser.rb |