Sha256: 28a3146ab1c79c3e9218e799dcd7beacc2d00cdaab2b85340ca6526dc317fcfb
Contents?: true
Size: 960 Bytes
Versions: 1
Compression:
Stored size: 960 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true $LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) require "mdcat" require "tty-markdown" DEFAULT_FILES = %w[README.md index.md].freeze BANNER = %q( _ _ _ __ __| |__ __ _| |_ | ' \/ _` / _/ _` | _| |_|_|_\__,_\__\__,_|\__| ) def help puts %( #{BANNER} version (#{Mdcat::VERSION}) USAGE mdcat <file> COMMANDS mdcat -h, help show this help message EXAMPLES `mdcat README.md` for printing to stdout `mdcat README.md | less` for paging long documents ) end # commands if ARGV[0] == "-h" || ARGV[0] == "help" help exit(0) end # validations file_path = ARGV[0] || DEFAULT_FILES.find { |file| File.exist?(file) } if file_path.nil? help exit(1) end file = File.expand_path(file_path) unless File.exist?(file) help puts "File not found: #{file}" exit(1) end # proessing file and output puts TTY::Markdown.parse_file(file)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mdcat-0.4.0 | bin/mdcat |