Sha256: 7800efa44594383d245873eeac2cb04bcb3679e424810327aa30a8079f7985fa
Contents?: true
Size: 1.98 KB
Versions: 13
Compression:
Stored size: 1.98 KB
Contents
#!/usr/bin/env ruby # # = NAME # juli - Personal outline processor and wiki # # = SYNOPSIS # juli [options] [files] # # = DESCRIPTION # see doc/juli.txt for more detail. $LOAD_PATH.insert(0, File.join(File.dirname(__FILE__), '../lib')) require 'erb' require 'fileutils' require 'optparse' require 'juli/command' #------------------------------------------------------------------ # Global variable #------------------------------------------------------------------ Version = Juli::VERSION #------------------------------------------------------------------ # Subroutine Part #------------------------------------------------------------------ #------------------------------------------------------------------ # Main #------------------------------------------------------------------ Juli.init include Juli::Util include Juli::Command command = 'gen' # parse common & default options parser = OptionParser.new(usage) subparsers = Hash.new{|h,k| $stderr.puts "no such juli command: #{k}" exit 1 } # set 'gen' options s = subparsers['gen'] = OptionParser.new GEN_OPTS = { # default option values for 'gen' :g=>'html', } s.on('-g generator', visitor_list.join(',')) {|v| GEN_OPTS[:g] = v} s.on('-f') {|v| GEN_OPTS[:f] = true} s.on('-t template') {|v| GEN_OPTS[:t] = v} s.on('-o output_path') {|v| GEN_OPTS[:o] = v} opts = GEN_OPTS # set 'init' options s = subparsers['init'] = OptionParser.new INIT_OPTS = { # default option values for 'init' :o=>'../html/', :t=>'default.html', :e=>'.shtml' } s.on('-o output_top') {|v| INIT_OPTS[:o] = v} s.on('-t template') {|v| INIT_OPTS[:t] = v} s.on('-e extention') {|v| INIT_OPTS[:e] = v} parser.order!(ARGV) # check command command = ARGV.shift if !ARGV.empty? # switch opts opts = INIT_OPTS if command == 'init' # parse command options subparsers[command].parse!(ARGV) if !ARGV.empty? Juli::Command::run(command, opts)
Version data entries
13 entries across 13 versions & 1 rubygems