File tree Expand file tree Collapse file tree 5 files changed +14
-11
lines changed Expand file tree Collapse file tree 5 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 2
2
# This script was generated by bashly ... (https://bashly.dannyb.co)
3
3
# Modifying it manually is not recommended
4
4
5
- # :script .wrapper
5
+ # :wrapper .wrapper
6
6
function () {
7
+ # :command.master_script
7
8
8
9
# :command.version_command
9
10
version_command () {
10
11
echo " $version "
11
- }
Original file line number Diff line number Diff line change 2
2
# This script was generated by bashly ... (https://bashly.dannyb.co)
3
3
# Modifying it manually is not recommended
4
4
5
- # :script .bash3_bouncer
5
+ # :wrapper .bash3_bouncer
6
6
if [[ " ${BASH_VERSINFO:- 0} " -lt 4 ]]; then
7
7
printf " bash version 4 or higher is required\n"
8
8
exit 1
9
9
fi
10
10
11
+ # :command.master_script
11
12
# :command.root_command
12
13
root_command () {
13
- # : spec/tmp/src/root_command.sh
14
+ # spec/tmp/src/root_command.sh
Original file line number Diff line number Diff line change 2
2
# This script was generated by bashly ... (https://bashly.dannyb.co)
3
3
# Modifying it manually is not recommended
4
4
5
- # :script .wrapper
5
+ # :wrapper .wrapper
6
6
my_super_function () {
7
+ # :command.master_script
7
8
# :command.root_command
8
9
root_command () {
9
- # : spec/tmp/src/root_command.sh
10
+ # spec/tmp/src/root_command.sh
10
11
echo " error: cannot load file"
11
12
}
12
13
Original file line number Diff line number Diff line change 211
211
end
212
212
213
213
it "returns the contents of a file in ./src along with a header " do
214
- expect ( subject . load_user_file 'test.sh' ) . to eq "# : spec/tmp/src/test.sh\n hello Command#load_user_file"
214
+ expect ( subject . load_user_file 'test.sh' ) . to eq "# spec/tmp/src/test.sh\n hello Command#load_user_file"
215
215
end
216
216
217
217
context "when the file is not found" do
218
218
it "returns a string containing a friendly error message" do
219
- expect ( subject . load_user_file 'notfound.sh' ) . to eq "# : spec/tmp/src/notfound.sh\n echo \" error: cannot load file\" "
219
+ expect ( subject . load_user_file 'notfound.sh' ) . to eq "# spec/tmp/src/notfound.sh\n echo \" error: cannot load file\" "
220
220
end
221
221
end
222
222
end
Original file line number Diff line number Diff line change 10
10
context "without function name" do
11
11
it "returns the complete script" do
12
12
lines = subject . code . split "\n "
13
- expect ( lines [ 0 ..12 ] . join ( "\n " ) ) . to match_approval ( 'script/wrapper/code' ) . except ( /\d +\. \d +\. \d +/ )
13
+ expect ( lines [ 0 ..13 ] . join ( "\n " ) ) . to match_approval ( 'script/wrapper/code' ) . except ( /\d +\. \d +\. \d +/ )
14
14
expect ( lines [ -1 ] ) . to eq 'run "$@"'
15
15
end
16
16
end
20
20
21
21
it "returns the complete script wrapped in a function without a bash3 bouncer" do
22
22
lines = subject . code . split "\n "
23
- expect ( lines [ 0 ..12 ] . join ( "\n " ) ) . to match_approval ( 'script/wrapper/code-wrapped' ) . except ( /\d +\. \d +\. \d +/ )
23
+ expect ( lines [ 0 ..13 ] . join ( "\n " ) ) . to match_approval ( 'script/wrapper/code-wrapped' ) . except ( /\d +\. \d +\. \d +/ )
24
24
expect ( lines [ -1 ] ) . to eq '(return 0 2>/dev/null) || my_super_function "$@"'
25
25
end
26
26
end
37
37
it "uses the custom header instead of the factory one" do
38
38
lines = subject . code . split "\n "
39
39
expect ( lines [ 0 ] ) . to eq header_text
40
- expect ( lines [ 1 ] ) . to eq "# :command.root_command"
40
+ expect ( lines [ 1 ] ) . to eq "# :command.master_script"
41
+ expect ( lines [ 2 ] ) . to eq "# :command.root_command"
41
42
end
42
43
end
43
44
end
You can’t perform that action at this time.
0 commit comments