Sha256: 7526886214b324b5c90b4930d2771ba942c089d19f4955aa49072a30e761909c

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

#!/usr/bin/env ruby

require 'markdown_helper'

# Each command foo has a corresponding Ruby executable _foo.
def command_keywords
  dir_path = File.dirname(__FILE__)
  dirs = Dir.entries(dir_path)
  command_file_names = dirs.select{ |x| x.start_with?('_')}
  command_file_names.collect {|x| x.sub(/^_/, '')}
end


def usage
  puts <<-EOT
  Usage: markdown_helper command [options] [args]

  where

    * Command is one of #{command_keywords.inspect}.

  EOT
  exit
end

command_keyword = ARGV[0]
unless command_keywords.include?(command_keyword)
  usage
end

bindir = File.dirname(__FILE__)
bin_file_path = File.absolute_path(File.join(
                    bindir,
                    '_' + command_keyword,
))
command = "ruby #{bin_file_path} #{ARGV.join(' ')}"
system(command)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
markdown_helper-1.8.0 bin/markdown_helper
markdown_helper-1.7.0 bin/markdown_helper
markdown_helper-1.6.1 bin/markdown_helper