Sha256: 3ccfb24d162db2032624ac90705fa031a9ca7122027c5b6a04802bb8be204b61

Contents?: true

Size: 1022 Bytes

Versions: 3

Compression:

Stored size: 1022 Bytes

Contents

#!/usr/bin/env ruby

require 'optparse'

require 'markdown_helper'

options = {:pristine => false}

parser = OptionParser.new do|opts|
  opts.banner = "Usage: #{__FILE__} [options] template_file_path markdown_file_page"
  opts.on('--pristine', 'No comments added') do |_|
    options[:pristine] = true
  end
  opts.on('--help', 'Display help') do
    usage(opts)
  end
end

def usage(opts)
  puts opts
  puts <<-EOT
    
  where

    * template_file_path is the path to an existing file.
    * markdown_file_path is the path to a file to be created.

  Typically:

    * Both file types are .md.
    * The template file contains file inclusion descriptions.
EOT
  exit
end

parser.parse!

template_file_path, markdown_file_path = ARGV

usage(options) unless ARGV.size == 2
usage(options) unless File.readable?(template_file_path)
usage(options) unless File.writable?(File.dirname(markdown_file_path))

MarkdownHelper.new(options).include(template_file_path, markdown_file_path)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
markdown_helper-1.0.0 bin/include
markdown_helper-0.2.4 bin/include
markdown_helper-0.2.3 bin/include