Skip to content

Commit aa3f392

Browse files
committed
Update docs with all the new info about 0.3.x
Fixes #23.
1 parent 9b42ec1 commit aa3f392

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

README.md

+18-19
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,26 @@ Or install it yourself as:
2222

2323
## Usage
2424

25+
Creating programs and commands with Mercenary is easy:
26+
2527
```ruby
2628
Mercenary.program(:jekyll) do |p|
2729
p.version Jekyll::VERSION
2830
p.description 'Jekyll is a blog-aware, static site generator in Ruby'
31+
p.syntax "jekyll <subcommand> [options]"
2932

3033
p.command(:new) do |c|
31-
c.syntax "jekyll new PATH"
34+
c.syntax "new PATH" # do not include the program name or super commands
3235
c.description "Creates a new Jekyll site scaffold in PATH"
36+
c.option 'blank', '--blank', 'Initialize the new site without any content."
3337
3438
c.action do |args, options|
35-
Jekyll::Commands::New.process(args)
39+
Jekyll::Commands::New.process(args, blank: options['blank'])
3640
end
3741
end
3842
3943
p.command(:build) do |c|
40-
c.syntax "jekyll build [options]"
44+
c.syntax "build [options]"
4145
c.description "Builds your Jekyll site"
4246
4347
c.option 'safe', '--safe', 'Run in safe mode'
@@ -49,28 +53,23 @@ Mercenary.program(:jekyll) do |p|
4953
end
5054
end
5155
52-
p.command(:import) do |c|
53-
c.syntax "jekyll import <platform> [options]"
54-
c.description "Import your old blog to Jekyll"
55-
56-
c.action do |args, options|
57-
begin
58-
require "jekyll-import"
59-
rescue
60-
msg = "You must install the 'jekyll-import' gem before continuing.\n"
61-
msg += "* Do this by running `gem install jekyll-import`.\n"
62-
msg += "* Or if you need root privileges, run `sudo gem install jekyll-import`."
63-
abort msg
64-
end
65-
66-
Jekyll::Commands::Import.process(args.first, options)
67-
end
56+
# Bring in command bundled in external gem
57+
begin
58+
require "jekyll-import"
59+
JekyllImport.init_with_program(p)
60+
rescue LoadError
6861
end
6962
7063
p.default_command(:build)
7164
end
7265
```
7366
67+
All commands have the following default options:
68+
69+
- `-h/--help` - show a help message
70+
- `-v/--version` - show the program version
71+
- `-t/--trace` - show the full backtrace when an error occurs
72+
7473
## Contributing
7574
7675
1. Fork it

0 commit comments

Comments
 (0)