Sha256: bc05876598ddc2dc8306d04bce9ca5bdd524490eb57f69cf883c86e255f76e0f

Contents?: true

Size: 674 Bytes

Versions: 8

Compression:

Stored size: 674 Bytes

Contents

#!/usr/bin/env ruby

require "mado"
require "optparse"
require "pathname"

options = {}

parser = OptionParser.new("Usage: mado [options] FILE") do |opt|
  opt.on("-p", "--port=VAL", "Port number (default: 8080)") { |val| options[:port] = val.to_i }
  opt.on("-a", "--addr=VAL", "Address to bind (default: 0.0.0.0)") { |val| options[:host] = val }
  opt.on("--debug", "Debug mode") { |val| options[:debug] = val }
end

argv = parser.parse(ARGV)

if argv.length < 1
  puts parser.help
  exit 1
end

path = argv.shift

begin
  options[:markdown] = Pathname.new(path).realpath.to_s
rescue
  $stderr.puts "mado: File not found - #{path}"
  exit 1
end

Mado::Server.run(options)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mado-0.2.1 bin/mado
mado-0.2.0 bin/mado
mado-0.1.1 bin/mado
mado-0.1.0 bin/mado
mado-0.0.4 bin/mado
mado-0.0.3 bin/mado
mado-0.0.2 bin/mado
mado-0.0.1 bin/mado