File tree Expand file tree Collapse file tree 5 files changed +22
-4
lines changed Expand file tree Collapse file tree 5 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module Commands
3
3
class Add < Base
4
4
help 'Add extra features and customization to your script'
5
5
6
- usage 'bashly add [--source NAME] LIBRARY [ARGS...] [--force]'
6
+ usage 'bashly add [--source NAME] LIBRARY [ARGS...] [--force --quiet ]'
7
7
usage 'bashly add [--source NAME] --list'
8
8
usage 'bashly add (-h|--help)'
9
9
@@ -17,6 +17,7 @@ class Add < Base
17
17
USAGE
18
18
option '-f --force' , 'Overwrite existing files'
19
19
option '-l --list' , 'Show available libraries'
20
+ option '-q --quiet' , 'Do not show post-install messages'
20
21
21
22
attr_reader :skip_src_check
22
23
@@ -70,7 +71,9 @@ def add_library_files(library)
70
71
end
71
72
72
73
message = library . post_install_message
73
- say "\n #{ message } " if message && files_created . positive?
74
+ return if !message || files_created . zero? || args [ '--quiet' ]
75
+
76
+ say "\n #{ message } "
74
77
end
75
78
76
79
def safe_write ( path , content )
Original file line number Diff line number Diff line change
1
+ created spec/tmp/src/lib/colors.sh
Original file line number Diff line number Diff line change 1
1
Add extra features and customization to your script
2
2
3
3
Usage:
4
- bashly add [--source NAME] LIBRARY [ARGS...] [--force]
4
+ bashly add [--source NAME] LIBRARY [ARGS...] [--force --quiet ]
5
5
bashly add [--source NAME] --list
6
6
bashly add (-h|--help)
7
7
@@ -20,5 +20,8 @@ Options:
20
20
-l --list
21
21
Show available libraries
22
22
23
+ -q --quiet
24
+ Do not show post-install messages
25
+
23
26
-h --help
24
27
Show this help
Original file line number Diff line number Diff line change 1
1
Usage:
2
- bashly add [--source NAME] LIBRARY [ARGS...] [--force]
2
+ bashly add [--source NAME] LIBRARY [ARGS...] [--force --quiet ]
3
3
bashly add [--source NAME] --list
4
4
bashly add (-h|--help)
Original file line number Diff line number Diff line change 47
47
end
48
48
end
49
49
50
+ describe 'add colors --quiet' do
51
+ let ( :lib_file ) { "#{ source_dir } /lib/colors.sh" }
52
+
53
+ before { reset_tmp_dir create_src : true }
54
+
55
+ it 'does not show the post-install message' do
56
+ expect { subject . execute %w[ add colors --quiet ] } . to output_approval ( 'cli/add/colors-quiet' )
57
+ expect ( File ) . to exist ( lib_file )
58
+ end
59
+ end
60
+
50
61
describe 'add completions' do
51
62
before { reset_tmp_dir init : true }
52
63
You can’t perform that action at this time.
0 commit comments