33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/wordsmith/cli.rb', line 33
def parse_options
@options = {}
global_options do |opts|
opts.banner = "Usage: #{$0} [options] [subcommand [options]]"
opts.description = "wordsmith helps you write books collectively with Git"
opts.separator ""
opts.separator "Global options are:"
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
@options[:verbose] = v
end
end
command :init, :new, :n do |opts|
opts.banner = "Usage: wordsmith new [directory]"
opts.description = "initialize a new book layout"
end
command :generate, :g do |opts|
opts.banner = "Usage: wordsmith generate [options]"
opts.description = "generate digital formats"
end
command :publish do |opts|
opts.banner = "Usage: wordsmith publish"
opts.description = "publish your book to github project page"
end
@subcommand = opt_parse
@args = ARGV
end
|