Skip to content

Commit 1f86420

Browse files
committed
refactor command specs
1 parent 2fcd790 commit 1f86420

File tree

25 files changed

+133
-144
lines changed

25 files changed

+133
-144
lines changed

lib/bashly/commands/render.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Render < Base
2525
2626
The provided PATH is treated as relative TARGET.
2727
28-
Note that this works only if the template source defines a preview command.
28+
Note that this works only if the template source supports it.
2929
USAGE
3030

3131
option '-l --list', 'Show list of built-in templates'
@@ -71,10 +71,6 @@ def render
7171
render_source.render target, show: args['--show']
7272
end
7373

74-
def show(path)
75-
render_source.show path
76-
end
77-
7874
def watch
7975
say "g`watching`\n"
8076

lib/bashly/libraries/render/markdown/markdown.gtx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ if commands.any?
9494
> ## {{ group.gsub(/:$/, '') }}
9595
>
9696
commands.each do |subcommand|
97-
> - [{{ subcommand.name }}]({{ subcommand.full_name }}) - {{ subcommand.summary.for_markdown }}
97+
> - [{{ subcommand.name }}]({{ subcommand.full_name.gsub(' ', '%20') }}) - {{ subcommand.summary.for_markdown }}
9898
end
9999
>
100100
end

lib/bashly/libraries/render/markdown/render.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@
2121
file = "#{target}/#{show}"
2222
puts TTY::Markdown.parse_file(file) if File.exist?(file)
2323
end
24-
Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1 @@
1-
Render markdown
2-
3-
Render markdown documents for your script.
4-
5-
Usage
6-
7-
# Generate all documents to the ./docs directory
8-
$ bashly render :markdown docs
9-
10-
Viewing the output
11-
12-
In order to view your markdown files, you can use
13-
Madness markdown server » https://madness.dannyb.co/:
14-
15-
$ gem install madness
16-
$ madness server docs
17-
18-
Supported custom definitions
19-
20-
Add these definitions to your bashly.yml to render them in your
21-
markdown:
22-
23-
Footer: x_markdown_footer
24-
25-
Add additional sections to your man pages. This field is expected
26-
to be in markdown format.
27-
28-
Example
29-
30-
x_markdown_footer: |-
31-
# ISSUE TRACKER
32-
33-
Report issues at <https://github.com/lanalang/smallville>
34-
1+
Heading

spec/approvals/cli/render/help

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Render the bashly data structure using cutsom templates
22

33
Usage:
4-
bashly render SOURCE TARGET [options]
4+
bashly render SOURCE TARGET [--watch --show PATH]
55
bashly render SOURCE --about
66
bashly render --list
77
bashly render (-h|--help)
@@ -10,6 +10,13 @@ Options:
1010
-w --watch
1111
Watch bashly.yml and the templates source for changes and render on change
1212

13+
-s --show PATH
14+
After rendering, show the result generated in PATH.
15+
16+
The provided PATH is treated as relative TARGET.
17+
18+
Note that this works only if the template source supports it.
19+
1320
-l --list
1421
Show list of built-in templates
1522

@@ -33,4 +40,5 @@ Examples:
3340
bashly render --list
3441
bashly render :markdown --about
3542
bashly render :markdown docs --watch
43+
bashly render :markdown docs --show "cli-download.1"
3644
bashly render /path/to/templates ./out_path

spec/approvals/cli/render/markdown

Lines changed: 0 additions & 3 deletions
This file was deleted.

spec/approvals/cli/render/watch

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
saved spec/tmp/index.md
2-
saved spec/tmp/cli download.md
3-
saved spec/tmp/cli upload.md
41
watching
52

6-
saved spec/tmp/index.md
7-
saved spec/tmp/cli download.md
8-
saved spec/tmp/cli upload.md
93
waiting
104

spec/approvals/cli/render/watch-stderr

Lines changed: 0 additions & 2 deletions
This file was deleted.

spec/approvals/examples/render-mandoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
+ bashly render :mandoc docs
22
saved docs/download.md
33
saved docs/download.1
4-
+ man docs/download.1
54
+ col -bx
5+
+ man docs/download.1
66
download(1) Sample application download(1)
77

88
NAME

spec/approvals/rendering/markdown/catch-all-advanced/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cli COMMAND
1414

1515
## Commands
1616

17-
- [download](cli download) - Download a file
18-
- [upload](cli upload) - Upload a file
17+
- [download](cli%20download) - Download a file
18+
- [upload](cli%20upload) - Upload a file
1919

2020

0 commit comments

Comments
 (0)