bin/mdcat in mdcat-0.2.0 vs bin/mdcat in mdcat-0.3.0
- old
+ new
@@ -4,24 +4,24 @@
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "mdcat"
require "tty-markdown"
-BANNER = %{
+BANNER = %q(
_ _
_ __ __| |__ __ _| |_
| ' \/ _` / _/ _` | _|
|_|_|_\__,_\__\__,_|\__|
-version (#{Mdcat::VERSION})
-}
+)
def help
puts %(
#{BANNER}
+version (#{Mdcat::VERSION})
USAGE
-mdcat <file>
+ mdcat <file>
COMMANDS
mdcat -h, help show this help message
EXAMPLES
@@ -30,21 +30,25 @@
)
end
# commands
if ARGV[0] == "-h" || ARGV[0] == "help"
- help and exit(0)
+ help
+ exit(0)
end
# validations
file_path = ARGV[0]
-help and exit(1) if file_path.nil?
+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
+ exit(1)
end
# proessing file and output
puts TTY::Markdown.parse_file(file)