Skip to content

Commit 47539d3

Browse files
committed
fix specs
1 parent d68c62f commit 47539d3

File tree

9 files changed

+877
-13
lines changed

9 files changed

+877
-13
lines changed

lib/bashly/commands/doc.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ class Doc < Base
77
usage 'bashly doc [SEARCH] [--index]'
88
usage 'bashly doc (-h|--help)'
99

10-
option "-i --index", "Show option keys only"
10+
option '-i --index', 'Show option keys only'
1111
param 'SEARCH', 'Search for options that match this text'
1212

1313
example 'bashly doc command'
1414
example 'bashly doc command.flags'
15+
example 'bashly doc flag. -i'
1516
example 'bashly doc catch_all'
1617

1718
def run
@@ -46,7 +47,7 @@ def show_url(url)
4647
def show_example(example)
4748
example = word_wrap " #{example}"
4849
example.gsub!(/^(\s*- )?(\s*\w+):/, '\1!txtblu!\2!txtrst!:')
49-
example.gsub!(/^(\s*\- )/, '!txtylw!\1!txtrst!')
50+
example.gsub!(/^(\s*- )/, '!txtylw!\1!txtrst!')
5051
example.gsub!(/^(\s*#.+)/, '!txtpur!\1!txtrst!')
5152
say example
5253
say ''
@@ -61,15 +62,14 @@ def show_help(help)
6162

6263
def data
6364
return raw_data unless args['SEARCH']
64-
65-
result = raw_data.select { |k, v| k. == args['SEARCH'] }
65+
66+
result = raw_data.select { |k, _v| k.== args['SEARCH'] }
6667
return result if result.any?
6768

68-
result = raw_data.select { |k, v| k.include? args['SEARCH'] }
69+
result = raw_data.select { |k, _v| k.include? args['SEARCH'] }
6970
return result if result.any?
7071

71-
say! "!txtred!No match"
72-
exit 1
72+
raise Error, "No match"
7373
end
7474

7575
def raw_data
@@ -83,7 +83,7 @@ def raw_data
8383
end
8484

8585
def docs_dir
86-
@docs_dir ||= File.expand_path "../docs", __dir__
86+
@docs_dir ||= File.expand_path '../docs', __dir__
8787
end
8888
end
8989
end

lib/bashly/docs/command.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ command.alias:
2929
name: download
3030
alias: [d, pull]
3131
32-
# Run this commnad with anything that starts with 's'.
32+
# Run this command with anything that starts with 's'.
3333
command:
3434
name: server
3535
alias: s*
@@ -58,7 +58,7 @@ command.catch_all:
5858
help: Upload one or more files
5959
6060
# Use this extended syntax in order to also provide a usage label
61-
# for these arguemnts, as well as specifying that at least one is
61+
# for these arguments, as well as specifying that at least one is
6262
# required.
6363
catch_all:
6464
label: Files
@@ -87,7 +87,7 @@ command.completions:
8787
- $(git branch 2> /dev/null)
8888
8989
command.default:
90-
help: Specify that this sub-command will be executed implicitely.
90+
help: Specify that this sub-command will be executed implicitly.
9191
url: https://bashly.dannyb.co/configuration/command/#default
9292
example: |-
9393
# This command will execute when the command line is not
@@ -139,7 +139,7 @@ command.examples:
139139
- cli download example.com
140140
- cli download example.com ./output -f
141141
142-
# Use a multiline string when you need more control.
142+
# Use a multi-line string when you need more control.
143143
# Note the use of the '|-' marker that tells YAML to use the
144144
# string as is, including the newlines it contains.
145145
examples: |-
@@ -271,7 +271,7 @@ command.group:
271271
group: Server
272272
273273
command.help:
274-
help: Specify the help text to show when showing uwags.
274+
help: Specify the help text to show when displaying usage.
275275
url: https://bashly.dannyb.co/configuration/command/#help
276276
example: |-
277277
name: docker

spec/approvals/cli/commands

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Commands:
66
validate Scan the configuration file for errors
77
generate Generate the bash script and required files
88
add Add extra features and customization to your script
9+
doc Show bashly reference documentation
910

1011
Help: bashly COMMAND --help
1112
Docs: https://bashly.dannyb.co

spec/approvals/cli/doc/env_Var

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
environment_variable
2+
3+
Define environment variables that will be in use in your script.
4+
5+
environment_variables:
6+
- name: config_path
7+
help: Location of the config file
8+
default: ~/config.ini
9+
- name: api_key
10+
help: Your API key
11+
required: true
12+
13+
See https://bashly.dannyb.co/configuration/environment-variable/
14+

0 commit comments

Comments
 (0)