bashly 0.9.4 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/bashly +1 -1
  4. data/lib/bashly/cli.rb +1 -1
  5. data/lib/bashly/commands/add.rb +42 -90
  6. data/lib/bashly/commands/base.rb +1 -9
  7. data/lib/bashly/commands/doc.rb +7 -7
  8. data/lib/bashly/commands/generate.rb +28 -33
  9. data/lib/bashly/commands/init.rb +3 -5
  10. data/lib/bashly/commands/preview.rb +0 -2
  11. data/lib/bashly/commands/validate.rb +1 -9
  12. data/lib/bashly/concerns/validation_helpers.rb +0 -8
  13. data/lib/bashly/config_validator.rb +1 -9
  14. data/lib/bashly/docs/command.yml +1 -1
  15. data/lib/bashly/docs/env.yml +1 -1
  16. data/lib/bashly/docs/flag.yml +11 -1
  17. data/lib/bashly/libraries/base.rb +1 -1
  18. data/lib/bashly/{templates/lib → libraries/colors}/colors.sh +0 -0
  19. data/lib/bashly/libraries/{completions_function.rb → completions/completions_function.rb} +2 -2
  20. data/lib/bashly/libraries/{completions_script.rb → completions/completions_script.rb} +1 -1
  21. data/lib/bashly/libraries/{completions_yaml.rb → completions/completions_yaml.rb} +1 -1
  22. data/lib/bashly/{templates/lib → libraries/config}/config.sh +0 -0
  23. data/lib/bashly/libraries/{help.rb → help/help.rb} +7 -7
  24. data/lib/bashly/{templates → libraries}/help/help_command.sh +0 -0
  25. data/lib/bashly/{templates → libraries}/lib/sample_function.sh +0 -0
  26. data/lib/bashly/libraries/libraries.yml +85 -0
  27. data/lib/bashly/{templates → libraries/settings}/settings.yml +7 -1
  28. data/lib/bashly/{templates → libraries/strings}/strings.yml +0 -0
  29. data/lib/bashly/{templates → libraries}/test/approvals.bash +0 -0
  30. data/lib/bashly/{templates → libraries}/test/approve +0 -0
  31. data/lib/bashly/{templates/lib → libraries}/validations/validate_dir_exists.sh +0 -0
  32. data/lib/bashly/{templates/lib → libraries}/validations/validate_file_exists.sh +0 -0
  33. data/lib/bashly/{templates/lib → libraries}/validations/validate_integer.sh +0 -0
  34. data/lib/bashly/{templates/lib → libraries}/validations/validate_not_empty.sh +0 -0
  35. data/lib/bashly/{templates/lib → libraries/yaml}/yaml.sh +0 -0
  36. data/lib/bashly/library.rb +14 -25
  37. data/lib/bashly/library_source.rb +84 -0
  38. data/lib/bashly/message_strings.rb +1 -1
  39. data/lib/bashly/refinements/compose_refinements.rb +2 -2
  40. data/lib/bashly/script/command.rb +10 -4
  41. data/lib/bashly/script/flag.rb +1 -1
  42. data/lib/bashly/settings.rb +21 -4
  43. data/lib/bashly/version.rb +1 -1
  44. data/lib/bashly/views/command/long_usage.gtx +2 -2
  45. data/lib/bashly/views/command/usage_environment_variables.gtx +1 -1
  46. data/lib/bashly/views/command/usage_flags.gtx +1 -1
  47. metadata +46 -40
  48. data/lib/bashly/deprecation.rb +0 -27
  49. data/lib/bashly/libraries.yml +0 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 810dfb8f0b25029420a1479aa38d682a79787716112d9b5f9c816533fc3e97ea
4
- data.tar.gz: c6782bd0bf01a475b137487dcdec634645484c877386b1ccaaa8432d53831595
3
+ metadata.gz: b23af9b1533c906c685ef6f62620bb32b55fb45599e354e85548e800d7ecf832
4
+ data.tar.gz: e65e8f10fefd0b2945c9c31459ee427b9688a5d8565880ddbce3021d2b8b1c6a
5
5
  SHA512:
6
- metadata.gz: 3c6cb7413b619b50cd76ecfa66d704623780f05f3316e1e9bcb9e7a3c02a4a3b9a9215759e928e32e4d6492993fb5b5cbcb6ba0379bd0fe638f6ab1182b791a4
7
- data.tar.gz: e83491e2a1ab364701351a74bbef05377bbe479521fe907b8f9b1dc3fa567be4f5b53f87c4f4d4dd4313e9fff16ab84e07dd5cbfae5ed7ff0f4c2d44b98d69bd
6
+ metadata.gz: 4c82c7e9a804e2d95d1a4179aaf96948c7f9e8150f64ace8d8b87b990a5157f22def814289f2aebb82869fafdd38fb03fc3aeec4fc752ff836c37efe0e53e389
7
+ data.tar.gz: b82bc5d7be814046b42fc959238f3a455d3f1f9c17fa0d2a5e1a3cd2e516db64db33ed9d62afcdfef8368f33a7c3b5a4b65ac58bd9d3aa308aacc1130e9983de
data/README.md CHANGED
@@ -13,7 +13,7 @@ Create feature-rich bash scripts using simple YAML configuration
13
13
 
14
14
  ---
15
15
 
16
- ![demo](demo/cast.svg)
16
+ ![demo](demo/cast.gif)
17
17
 
18
18
  </div>
19
19
 
data/bin/bashly CHANGED
@@ -12,6 +12,6 @@ rescue Bashly::Interrupt
12
12
  exit 1
13
13
  rescue => e
14
14
  puts e.backtrace.reverse if ENV['DEBUG']
15
- say! "!undred!#{e.class}!txtrst!\n#{e.message}"
15
+ say! "rib` #{e.class} `\n#{e.message}"
16
16
  exit 1
17
17
  end
data/lib/bashly/cli.rb CHANGED
@@ -7,7 +7,7 @@ module Bashly
7
7
  def self.runner
8
8
  runner = MisterBin::Runner.new version: Bashly::VERSION,
9
9
  header: 'Bashly - Bash CLI Generator',
10
- footer: "Help: !txtpur!bashly COMMAND --help!txtrst!\nDocs: !undblu!https://bashly.dannyb.co"
10
+ footer: "Help: m`bashly COMMAND --help`\nDocs: bu`https://bashly.dannyb.co`"
11
11
 
12
12
  runner.route 'init', to: Commands::Init
13
13
  runner.route 'preview', to: Commands::Preview
@@ -3,120 +3,72 @@ module Bashly
3
3
  class Add < Base
4
4
  help 'Add extra features and customization to your script'
5
5
 
6
- usage 'bashly add colors [--force]'
7
- usage 'bashly add comp FORMAT [OUTPUT --force]'
8
- usage 'bashly add config [--force]'
9
- usage 'bashly add help [--force]'
10
- usage 'bashly add lib [--force]'
11
- usage 'bashly add settings [--force]'
12
- usage 'bashly add strings [--force]'
13
- usage 'bashly add test [--force]'
14
- usage 'bashly add validations [--force]'
15
- usage 'bashly add yaml [--force]'
6
+ usage 'bashly add [--source NAME] LIBRARY [ARGS...] [--force]'
7
+ usage 'bashly add [--source NAME] --list'
16
8
  usage 'bashly add (-h|--help)'
17
9
 
18
- option '-f --force', 'Overwrite existing files'
19
-
20
- param 'FORMAT', <<~USAGE
21
- Output format, can be one of:
22
- function : generate a function file to be included in your script.
23
- script : generate a standalone bash completions script.
24
- yaml : generate a yaml compatible with completely.
25
- USAGE
10
+ option '-s --source NAME', <<~USAGE
11
+ Specify a different libraries source. NAME can be:
26
12
 
27
- param 'OUTPUT', <<~USAGE
28
- For the 'comp function' command: Name of the generated function.
29
- For the 'comp script' or 'comp yaml' commands: path to output file.
30
- In all cases, this is optional and will have sensible defaults.
13
+ * Path to a local libraries directory
14
+ * GitHub (HTTPS) repository: github:user/repo[//path@ref]
15
+ * GitHub (SSH) repository: github-ssh:user/repo[//path@ref]
16
+ * Remote git repository: git:repo-url.git[//path@ref]
31
17
  USAGE
32
-
33
- command 'colors', 'Add standard functions for printing colorful and formatted text to the lib directory.'
34
- command 'comp', 'Generate a bash completions script or function.'
35
- command 'config', 'Add standard functions for handling INI files to the lib directory.'
36
- command 'help', 'Add a help command, in addition to the standard --help flag.'
37
- command 'lib', <<~USAGE
38
- Create the lib directory for any additional user scripts.
39
- All *.sh scripts in this directory will be included in the final bash script.
40
- Note that if you configured a different partials_extension, then the extensions of the files in this directory need to match.
41
- USAGE
42
-
43
- command 'settings', 'Copy a sample settings.yml file to your project, allowing you to customize some ' \
44
- 'bashly options.'
45
-
46
- command 'strings', 'Copy an additional configuration file to your project, allowing you to customize all the ' \
47
- 'tips and error strings.'
48
-
49
- command 'test', 'Add approval testing.'
50
- command 'validations', 'Add argument validation functions to the lib directory.'
51
- command 'yaml', 'Add standard functions for reading YAML files to the lib directory.'
52
- example 'bashly add strings --force'
53
- example 'bashly add comp function'
54
- example 'bashly add comp script completions.bash'
55
-
56
- environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source files [default: src]'
57
- environment 'BASHLY_LIB_DIR', 'The path to use for creating the library files, relative to the source dir ' \
58
- '[default: lib]'
18
+ option '-f --force', 'Overwrite existing files'
19
+ option '-l --list', 'Show available libraries'
59
20
 
60
21
  attr_reader :skip_src_check
61
22
 
62
- def colors_command
63
- add_lib 'colors'
64
- end
65
-
66
- def comp_command
67
- format = args['FORMAT']
68
- output = args['OUTPUT']
23
+ def run
24
+ say "Performing git operations, this may take a while...\n" if lib_source.git?
69
25
 
70
- case format
71
- when 'script' then add_lib 'completions_script', output
72
- when 'function' then add_lib 'completions', output
73
- when 'yaml' then add_lib 'completions_yaml', output
74
- else raise Error, "Unrecognized format: #{format}"
26
+ if args['--list']
27
+ show_list
28
+ else
29
+ add_lib args['LIBRARY']
75
30
  end
76
- end
77
31
 
78
- def config_command
79
- add_lib 'config'
32
+ lib_source.cleanup if lib_source.git?
80
33
  end
81
34
 
82
- def lib_command
83
- add_lib 'lib'
84
- end
35
+ private
85
36
 
86
- def settings_command
87
- @skip_src_check = true
88
- add_lib 'settings'
37
+ def source
38
+ args['--source']
89
39
  end
90
40
 
91
- def strings_command
92
- add_lib 'strings'
41
+ def lib_source
42
+ @lib_source ||= Bashly::LibrarySource.new source
93
43
  end
94
44
 
95
- def test_command
96
- add_lib 'test'
45
+ def show_list
46
+ lib_source.config.each do |key, config|
47
+ usage = key
48
+ usage += " #{config['usage']}" if config['usage']
49
+ say "g`#{usage}`"
50
+ say word_wrap(" #{config['help']}")
51
+ say ''
52
+ end
97
53
  end
98
54
 
99
- def help_command
100
- add_lib 'help'
101
- end
55
+ def add_lib(name)
56
+ library = lib_source.libraries[name.to_sym]
57
+ raise "Unknown library: g`#{name}`\nRun m`bashly add --list` to see available libraries" unless library
102
58
 
103
- def validations_command
104
- add_lib 'validations'
105
- end
59
+ library.args = args['ARGS']
60
+ @skip_src_check = lib_source.config.dig name, 'skip_src_check'
106
61
 
107
- def yaml_command
108
- add_lib 'yaml'
62
+ add_library_files library
109
63
  end
110
64
 
111
- private
112
-
113
- def add_lib(name, *args)
114
- library = Bashly::Library.new name, *args
65
+ def add_library_files(library)
115
66
  files_created = 0
116
67
  library.files.each do |file|
117
68
  created = safe_write file[:path], file[:content]
118
69
  files_created += 1 if created
119
70
  end
71
+
120
72
  message = library.post_install_message
121
73
  say "\n#{message}" if message && files_created.positive?
122
74
  end
@@ -124,18 +76,18 @@ module Bashly
124
76
  def safe_write(path, content)
125
77
  if !skip_src_check && !Dir.exist?(Settings.source_dir)
126
78
  raise InitError, <<~ERROR
127
- Directory !txtgrn!#{Settings.source_dir}!txtrst! does not exist
128
- Run !txtpur!bashly init!txtrst! first
79
+ Directory g`#{Settings.source_dir}` does not exist
80
+ Run m`bashly init` first
129
81
  ERROR
130
82
  end
131
83
 
132
84
  if File.exist?(path) && !args['--force']
133
- say "!txtblu!skipped!txtrst! #{path} (exists)"
85
+ say "b`skipped` #{path} (exists)"
134
86
  false
135
87
 
136
88
  else
137
89
  File.deep_write path, content
138
- say "!txtgrn!created!txtrst! #{path}"
90
+ say "g`created` #{path}"
139
91
  true
140
92
 
141
93
  end
@@ -7,7 +7,7 @@ module Bashly
7
7
  include AssetHelper
8
8
 
9
9
  def config
10
- @config ||= Config.new "#{Settings.source_dir}/bashly.yml"
10
+ @config ||= Config.new Settings.config_path
11
11
  end
12
12
 
13
13
  def config_validator
@@ -21,14 +21,6 @@ module Bashly
21
21
  def with_valid_config
22
22
  validate_config
23
23
  yield
24
- show_deprecations
25
- end
26
-
27
- def show_deprecations
28
- return if config_validator.deprecations.empty? || ENV['BASHLY_HIDE_DEPRECATIONS']
29
-
30
- messages = config_validator.deprecations.map(&:message).join("\n\n")
31
- say! "\n#{messages}\n\n"
32
24
  end
33
25
  end
34
26
  end
@@ -35,27 +35,27 @@ module Bashly
35
35
  end
36
36
 
37
37
  def show_key(key)
38
- say "!txtgrn!#{key}"
38
+ say "g`#{key}`"
39
39
  say ''
40
40
  end
41
41
 
42
42
  def show_url(url)
43
- say " See !undblu!#{url}"
43
+ say " See bu`#{url}`"
44
44
  say ''
45
45
  end
46
46
 
47
47
  def show_example(example)
48
48
  example = word_wrap " #{example}"
49
- example.gsub!(/^(\s*- )?(\s*\w+):/, '\1!txtblu!\2!txtrst!:')
50
- example.gsub!(/^(\s*- )/, '!txtylw!\1!txtrst!')
51
- example.gsub!(/^(\s*#.+)/, '!txtpur!\1!txtrst!')
49
+ example.gsub!(/^(\s*- )?(\s*\w+):/, '\1b`\2`:')
50
+ example.gsub!(/^(\s*- )/, 'y`\1`')
51
+ example.gsub!(/^(\s*#.+)/, 'm`\1`')
52
52
  say example
53
53
  say ''
54
54
  end
55
55
 
56
56
  def show_help(help)
57
57
  help = word_wrap " #{help}"
58
- help.gsub!(/`([^`]+)`/, '!txtgrn!\1!txtrst!')
58
+ help.gsub!(/`([^`]+)`/, 'g`\1`')
59
59
  say help
60
60
  say ''
61
61
  end
@@ -63,7 +63,7 @@ module Bashly
63
63
  def data
64
64
  return raw_data unless args['SEARCH']
65
65
 
66
- result = raw_data.select { |k, _v| k.== args['SEARCH'] }
66
+ result = raw_data.select { |k, _v| k == args['SEARCH'] }
67
67
  return result if result.any?
68
68
 
69
69
  result = raw_data.select { |k, _v| k.include? args['SEARCH'] }
@@ -13,26 +13,11 @@ module Bashly
13
13
  option '-u --upgrade', 'Upgrade all added library functions'
14
14
  option '-w --watch', 'Watch the source directory for changes and regenerate on change'
15
15
  option '-r --wrap FUNCTION', 'Wrap the entire script in a function so it can also be sourced'
16
- option '-e --env ENV', 'Force the generation environment (see BASHLY_ENV)'
16
+ option '-e --env ENV', <<~HELP
17
+ Force the generation environment:
17
18
 
18
- environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source ' \
19
- 'files [default: src]'
20
-
21
- environment 'BASHLY_TARGET_DIR', 'The path to use for creating the bash script [default: .]'
22
- environment 'BASHLY_LIB_DIR',
23
- 'The path to use for upgrading library files, relative to the source dir [default: lib]'
24
-
25
- environment 'BASHLY_STRICT', 'When not empty, enable bash strict mode (set -euo pipefail)'
26
- environment 'BASHLY_TAB_INDENT',
27
- 'When not empty, the generated script will use tab indentation instead of spaces ' \
28
- '(every 2 leading spaces will be converted to a tab character)'
29
-
30
- environment 'BASHLY_ENV', <<~HELP
31
- Set to 'production' or 'development':
32
19
  - production generate a smaller script, without file markers
33
20
  - development generate with file markers
34
-
35
- Can be overridden with --env [default: development]
36
21
  HELP
37
22
 
38
23
  example 'bashly generate --force'
@@ -52,25 +37,25 @@ module Bashly
52
37
  private
53
38
 
54
39
  def watch
55
- quiet_say "!txtgrn!watching!txtrst! #{Settings.source_dir}\n"
40
+ quiet_say "g`watching` #{Settings.source_dir}\n"
56
41
 
57
42
  Filewatcher.new([Settings.source_dir]).watch do
58
43
  reset
59
44
  generate
60
45
 
61
46
  rescue Bashly::ConfigurationError => e
62
- say! "!undred!#{e.class}!txtrst!\n#{e.message}"
47
+ say! "rib` #{e.class} `\n#{e.message}"
63
48
 
64
49
  ensure
65
- quiet_say "!txtgrn!waiting\n"
50
+ quiet_say "g`waiting`\n"
66
51
  end
67
52
  end
68
53
 
69
54
  def generate
70
55
  with_valid_config do
71
- quiet_say 'creating !txtgrn!production!txtrst! version' if Settings.production?
56
+ quiet_say 'creating g`production` version' if Settings.production?
72
57
  generate_all_files
73
- quiet_say "run !txtpur!#{master_script_path} --help!txtrst! to test your bash script" unless watching
58
+ quiet_say "run m`#{master_script_path} --help` to test your bash script" unless watching
74
59
  end
75
60
  end
76
61
 
@@ -97,6 +82,7 @@ module Bashly
97
82
  next unless content =~ /\[@bashly-upgrade (.+)\]/
98
83
 
99
84
  args = $1.split
85
+
100
86
  library_name = args.shift
101
87
  upgrade file, library_name, *args
102
88
  end
@@ -107,28 +93,37 @@ module Bashly
107
93
  end
108
94
 
109
95
  def upgrade(existing_file, library_name, *args)
110
- if Library.exist? library_name
111
- upgrade! existing_file, library_name, *args
96
+ if library_name.include? ';'
97
+ source_name, library_name = library_name.split(';')
98
+ source = Bashly::LibrarySource.new source_name
99
+ else
100
+ source = Bashly::LibrarySource.new
101
+ end
102
+
103
+ library = source.libraries[library_name.to_sym]
104
+
105
+ if library
106
+ library.args = args
107
+ upgrade! existing_file, library
112
108
  else
113
- quiet_say "!txtred!warning!txtrst! not upgrading !txtcyn!#{existing_file}!txtrst!, " \
109
+ quiet_say "r`warning` not upgrading c`#{existing_file}`, " \
114
110
  "unknown library '#{library_name}'"
115
111
  end
116
112
  end
117
113
 
118
- def upgrade!(existing_file, library_name, *args)
119
- library = Bashly::Library.new library_name, *args
114
+ def upgrade!(existing_file, library)
120
115
  file = library.find_file existing_file
121
116
 
122
117
  if file
123
118
  File.deep_write file[:path], file[:content]
124
- quiet_say "!txtcyn!updated!txtrst! #{file[:path]}"
119
+ quiet_say "c`updated` #{file[:path]}"
125
120
  else
126
- quiet_say "!txtred!warning!txtrst! not upgrading !txtcyn!#{existing_file}!txtrst!, path mismatch"
121
+ quiet_say "r`warning` not upgrading c`#{existing_file}`, path mismatch"
127
122
  end
128
123
  end
129
124
 
130
125
  def create_user_files
131
- quiet_say "creating user files in !txtgrn!#{Settings.source_dir}"
126
+ quiet_say "creating user files in g`#{Settings.source_dir}`"
132
127
 
133
128
  create_file "#{Settings.source_dir}/initialize.#{Settings.partials_extension}",
134
129
  command.render(:default_initialize_script)
@@ -156,17 +151,17 @@ module Bashly
156
151
 
157
152
  def create_file(file, content)
158
153
  if File.exist?(file) && !args['--force']
159
- quiet_say "!txtblu!skipped!txtrst! #{file} (exists)"
154
+ quiet_say "b`skipped` #{file} (exists)"
160
155
  else
161
156
  File.deep_write file, content
162
- quiet_say "!txtgrn!created!txtrst! #{file}"
157
+ quiet_say "g`created` #{file}"
163
158
  end
164
159
  end
165
160
 
166
161
  def create_master_script
167
162
  File.write master_script_path, script.code(tab_indent: Settings.tab_indent)
168
163
  FileUtils.chmod '+x', master_script_path
169
- quiet_say "!txtgrn!created!txtrst! #{master_script_path}"
164
+ quiet_say "g`created` #{master_script_path}"
170
165
  end
171
166
 
172
167
  def script
@@ -9,17 +9,15 @@ module Bashly
9
9
 
10
10
  option '-m --minimal', 'Use a minimal configuration file (without commands)'
11
11
 
12
- environment 'BASHLY_SOURCE_DIR', 'The path to use for creating the configuration file [default: src]'
13
-
14
12
  def run
15
13
  if Dir.exist?(target_dir) && !Dir.empty?(target_dir)
16
- raise InitError, "Directory !txtgrn!#{target_dir}!txtrst! already exists and is not empty"
14
+ raise InitError, "Directory g`#{target_dir}` already exists and is not empty"
17
15
  end
18
16
 
19
17
  FileUtils.mkdir_p target_dir
20
18
  File.write "#{target_dir}/bashly.yml", yaml_content
21
- say "!txtgrn!created!txtrst! #{target_dir}/bashly.yml"
22
- say 'run !txtpur!bashly generate!txtrst! to create the bash script'
19
+ say "g`created` #{target_dir}/bashly.yml"
20
+ say 'run m`bashly generate` to create the bash script'
23
21
  end
24
22
 
25
23
  private
@@ -6,8 +6,6 @@ module Bashly
6
6
  usage 'bashly preview'
7
7
  usage 'bashly preview (-h|--help)'
8
8
 
9
- environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source files [default: src]'
10
-
11
9
  def run
12
10
  with_valid_config do
13
11
  command = Script::Command.new config
@@ -11,21 +11,13 @@ module Bashly
11
11
  option '-v --verbose', 'Show the bashly configuration file prior to validating. ' \
12
12
  'This is useful when using split config (import) since it will show the final compiled configuration.'
13
13
 
14
- environment 'BASHLY_SOURCE_DIR', 'The path containing the bashly configuration and source files [default: src]'
15
-
16
14
  def run
17
15
  if args['--verbose']
18
16
  lp config
19
17
  puts '---'
20
18
  end
21
19
  validate_config
22
- show_deprecations
23
- deprecations = config_validator.deprecations
24
- if deprecations.empty?
25
- say '!txtgrn!OK'
26
- else
27
- say "!txtred!WARNING!txtrst! Found #{deprecations.count} deprecations"
28
- end
20
+ say 'g`OK`'
29
21
  end
30
22
  end
31
23
  end
@@ -2,10 +2,6 @@ module Bashly
2
2
  # This is a `ConfigValidator` concern responsible for providing basic
3
3
  # assertion methods.
4
4
  module ValidationHelpers
5
- def deprecations
6
- @deprecations ||= []
7
- end
8
-
9
5
  protected
10
6
 
11
7
  def assert(valid, message)
@@ -16,10 +12,6 @@ module Bashly
16
12
  assert !invalid, message
17
13
  end
18
14
 
19
- def deprecate(key, **options)
20
- deprecations.push Deprecation.new(key, **options)
21
- end
22
-
23
15
  def assert_string(key, value)
24
16
  assert value.is_a?(String), "#{key} must be a string"
25
17
  end
@@ -99,6 +99,7 @@ module Bashly
99
99
  assert_optional_string "#{key}.default", value['default']
100
100
  assert_optional_string "#{key}.validate", value['validate']
101
101
 
102
+ assert_boolean "#{key}.private", value['private']
102
103
  assert_boolean "#{key}.repeatable", value['repeatable']
103
104
  assert_boolean "#{key}.required", value['required']
104
105
  assert_array "#{key}.allowed", value['allowed'], of: :string
@@ -131,10 +132,6 @@ module Bashly
131
132
  assert_optional_string "#{key}.default", value['default']
132
133
  assert_boolean "#{key}.required", value['required']
133
134
  assert_boolean "#{key}.private", value['private']
134
-
135
- if value['private']
136
- assert value['default'], "#{key}.private makes no sense without default"
137
- end
138
135
  end
139
136
 
140
137
  def assert_command(key, value)
@@ -196,11 +193,6 @@ module Bashly
196
193
  refute value['version'], "#{key}.version makes no sense"
197
194
  refute value['extensible'], "#{key}.extensible makes no sense"
198
195
  end
199
-
200
- # DEPRECATION 0.8.0
201
- if value['short']
202
- deprecate "#{key}.short", replacement: 'alias', reference: 'https://github.com/DannyBen/bashly/pull/220'
203
- end
204
196
  end
205
197
  end
206
198
  end
@@ -75,7 +75,7 @@ command.commands:
75
75
  help: Register a local repository
76
76
 
77
77
  command.completions:
78
- help: Specify a list of additional completion suggestions when used in conjunction with `bashly add comp`.
78
+ help: Specify a list of additional completion suggestions when used in conjunction with `bashly add completions`.
79
79
  url: https://bashly.dannyb.co/configuration/command/#completions
80
80
  example: |-
81
81
  commands:
@@ -36,7 +36,7 @@ environment_variable.name:
36
36
  help: Your API key
37
37
 
38
38
  environment_variable.private:
39
- help: Specify that this environment variable should not be advertised in the usage text. Only makes sense when accompanied by `default`.
39
+ help: Specify that this environment variable should not be advertised in the usage text.
40
40
  url: https://bashly.dannyb.co/configuration/environment-variable/#private
41
41
  example: |-
42
42
  environment_variables:
@@ -46,7 +46,7 @@ flag.arg:
46
46
  help: Clone using SSH
47
47
 
48
48
  flag.completions:
49
- help: Specify a list of additional completion suggestions when used in conjunction with `bashly add comp`. Must be accompanied by `arg`.
49
+ help: Specify a list of additional completion suggestions when used in conjunction with `bashly add completions`. Must be accompanied by `arg`.
50
50
  url: https://bashly.dannyb.co/configuration/flag/#completions
51
51
  example: |-
52
52
  flags:
@@ -112,6 +112,16 @@ flag.long:
112
112
  short: -s
113
113
  help: Clone using SSH
114
114
 
115
+ flag.private:
116
+ help: Specify that this flag should not be displayed in the help text.
117
+ url: https://bashly.dannyb.co/configuration/flag/#private
118
+ example: |-
119
+ flags:
120
+ - long: --legacy
121
+ short: -l
122
+ help: Run using the legacy mode
123
+ private: true
124
+
115
125
  flag.repeatable:
116
126
  help: |-
117
127
  Specify that this flag can be provided multiple times. When used on a flag with an argument, it will be received as a space-delimited string, which needs to be converted to an array with:
@@ -22,7 +22,7 @@ module Bashly
22
22
  end
23
23
 
24
24
  def config
25
- @config ||= Config.new "#{Settings.source_dir}/bashly.yml"
25
+ @config ||= Config.new Settings.config_path
26
26
  end
27
27
  end
28
28
  end
@@ -12,11 +12,11 @@ module Bashly
12
12
 
13
13
  def post_install_message
14
14
  <<~MESSAGE
15
- In order to enable completions in your script, create a command or a flag (for example: !txtgrn!#{command.name} completions!txtrst! or !txtgrn!#{command.name} --completions!txtrst!) that calls the !txtgrn!#{function_name}!txtrst! function.
15
+ In order to enable completions in your script, create a command or a flag (for example: g`#{command.name} completions` or g`#{command.name} --completions`) that calls the g`#{function_name}` function.
16
16
 
17
17
  Your users can then run something like this to enable completions:
18
18
 
19
- !txtpur!$ eval "$(#{command.name} completions)"
19
+ m`$ eval "$(#{command.name} completions)"`
20
20
  MESSAGE
21
21
  end
22
22
 
@@ -14,7 +14,7 @@ module Bashly
14
14
  <<~MESSAGE
15
15
  In order to enable completions, run:
16
16
 
17
- !txtpur!$ source #{target_path}
17
+ m`$ source #{target_path}`
18
18
  MESSAGE
19
19
  end
20
20
 
@@ -12,7 +12,7 @@ module Bashly
12
12
 
13
13
  def post_install_message
14
14
  <<~MESSAGE
15
- This file can be converted to a completions script using the !txtgrn!completely!txtrst! gem.
15
+ This file can be converted to a completions script using the g`completely` gem.
16
16
  MESSAGE
17
17
  end
18
18