12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/madan/application.rb', line 12
def run
program :name, "Madan"
program :version, Madan::VERSION
program :description, "Preview Markdown File In Terminal"
command :present do |c|
c.syntax = 'madan present FILE'
c.description = 'present markdown file'
c.action do |args, options|
file_arg = args.first
if File.directory?(file_arg) || File.file?(file_arg)
file_parser = Madan::FileParser.new(file_arg)
str = file_parser.parse
parsed = TTY::Markdown.parse(str)
= TTY::Pager.new
.page(parsed)
end
end
end
alias_command :p, :present
alias_command :preview, :present
run!
end
|