@@ -3,10 +3,17 @@ module Commands
33 class Add < Base
44 help 'Add extra features and customization to your script'
55
6- usage 'bashly add LIBRARY [ARGS...] [--force]'
7- usage 'bashly add --list'
6+ usage 'bashly add [--source NAME] LIBRARY [ARGS...] [--force]'
7+ usage 'bashly add [--source NAME] --list'
88 usage 'bashly add (-h|--help)'
99
10+ option '-s --source NAME' , <<~USAGE
11+ Specify a different libraries source. NAME can be:
12+
13+ * Path to a local libraries directory
14+ * Github repository, in the form of 'github:user/repo'
15+ * Remote git repository, in the form of 'git:clone_url.git'
16+ USAGE
1017 option '-f --force' , 'Overwrite existing files'
1118 option '-l --list' , 'Show available libraries'
1219
@@ -22,14 +29,19 @@ def run
2229
2330 private
2431
32+ def source
33+ args [ '--source' ]
34+ end
35+
2536 def lib_source
26- @lib_source ||= Bashly ::LibrarySource . new
37+ @lib_source ||= Bashly ::LibrarySource . new source
2738 end
2839
2940 def show_list
3041 lib_source . config . each do |key , config |
3142 usage = key
3243 usage += " #{ config [ 'usage' ] } " if config [ 'usage' ]
44+ usage = "--source #{ source } #{ usage } " if source
3345 say "g`bashly add #{ usage } `"
3446 say word_wrap ( " #{ config [ 'help' ] } " )
3547 say ''
0 commit comments