Sha256: 40e38c6b67cda9453604f209d0b18f8b236133a3b76ae24b718b1e7803fc9188

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 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}"
system(command)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
markdown_helper-1.6.0 bin/markdown_helper