bashly 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c219a4bf3f32f47434d1a855a620ea62caaafe336a8647e8ef84529eb7023b8
4
- data.tar.gz: d18b7f6bdfeb43fc4a27fb9e5f617d1c0c9c6f5783f5c7dc1df8f6eff575c8ab
3
+ metadata.gz: a333ce419f5ba64e38000497f245fc5baf822243cd2765c1805ebdf6de2e3b46
4
+ data.tar.gz: 0c9ab24cc2cecd88cbd20a06ab11028740ce3000aec75080ca9a12c6769110c1
5
5
  SHA512:
6
- metadata.gz: 38cf3b1d1c49c447f0e2817b57cb03362e528cefe22dc0f4d9c1dcfcb7b52859c034bc012bfb7ec769b6c94801c102bfe74d9c336e0dbc8ee060027c10b1b242
7
- data.tar.gz: e64ced05cc15cd4cb66cc2dc6696cb522db87843c9fc8826d69500cfb1aafb8aa3ad13ccf36bca806ce262cece7c30763229d82f297bbf471ee71ca5807eaaec
6
+ metadata.gz: ff95fd919a29a16d610d8f3c069f2de17b9984a41251de56e484a5dc49e86dd4114934c47ccb2274521f7f8bd5078287a54ef10478c5e18b6c8a93f462f1c503
7
+ data.tar.gz: 65a1be57601cc7a560a19ef48dc75b09647244fe477327f23ae52a37f8114afca4ee3871a1f72e1b046589e252a57701956a93e9015907bf76fd24455da341ff
data/README.md CHANGED
@@ -32,7 +32,6 @@ a [docker image](https://hub.docker.com/r/dannyben/bashly).
32
32
  <table>
33
33
  <tr>
34
34
  <td><a href="https://rhodecode.com/"><img src='support/img/RhodeCode-logo.png' width=240></a></td>
35
- <td><a href="https://decisiohealth.com/"><img src='support/img/decisio-logo.png' width=240></a></td>
36
35
  </tr>
37
36
  </table>
38
37
 
@@ -82,11 +81,6 @@ to contribute, feel free to [open an issue][issues] or
82
81
 
83
82
  Visit the *[How to contribute][contributing]* page for more information.
84
83
 
85
- ## Stargazers and Forkers
86
-
87
- [![Stargazers repo roster for @DannyBen/bashly](https://reporoster.com/stars/DannyBen/bashly)](https://github.com/DannyBen/bashly/stargazers)
88
-
89
- [![Forkers repo roster for @DannyBen/bashly](https://reporoster.com/forks/DannyBen/bashly)](https://github.com/DannyBen/bashly/network/members)
90
84
 
91
85
  [issues]: https://github.com/DannyBen/bashly/issues
92
86
  [discussions]: https://github.com/DannyBen/bashly/discussions
data/lib/bashly/cli.rb CHANGED
@@ -9,13 +9,14 @@ module Bashly
9
9
  header: 'Bashly - Bash CLI Generator',
10
10
  footer: "Help: m`bashly COMMAND --help`\nDocs: bu`https://bashly.dannyb.co`"
11
11
 
12
- runner.route 'init', to: Commands::Init
13
- runner.route 'preview', to: Commands::Preview
14
- runner.route 'validate', to: Commands::Validate
15
- runner.route 'generate', to: Commands::Generate
16
- runner.route 'add', to: Commands::Add
17
- runner.route 'doc', to: Commands::Doc
18
- runner.route 'shell', to: Commands::Shell unless ENV['BASHLY_SHELL']
12
+ runner.route 'init', to: Commands::Init
13
+ runner.route 'preview', to: Commands::Preview
14
+ runner.route 'validate', to: Commands::Validate
15
+ runner.route 'generate', to: Commands::Generate
16
+ runner.route 'add', to: Commands::Add
17
+ runner.route 'doc', to: Commands::Doc
18
+ runner.route 'completions', to: Commands::Completions
19
+ runner.route 'shell', to: Commands::Shell unless ENV['BASHLY_SHELL']
19
20
 
20
21
  runner
21
22
  end
@@ -0,0 +1,56 @@
1
+ module Bashly
2
+ module Commands
3
+ class Completions < Base
4
+ summary 'Install bash completions for bashly itself'
5
+ help 'Display the bash completions script or install it directly to your bash completions directory'
6
+
7
+ usage 'bashly completions [--install --uninstall]'
8
+ usage 'bashly completions (-h|--help)'
9
+
10
+ option '-i --install', 'Install the completions script to your bash completions directory'
11
+ option '-u --uninstall', 'Uninstall the completions script from your bash completions directory'
12
+
13
+ def run
14
+ if args['--install']
15
+ install_completions
16
+ elsif args['--uninstall']
17
+ uninstall_completions
18
+ else
19
+ puts script
20
+ end
21
+ end
22
+
23
+ def installer
24
+ @installer ||= Completely::Installer.new program: 'bashly', script_path: script_path
25
+ end
26
+
27
+ private
28
+
29
+ def install_completions
30
+ success = installer.install force: true
31
+ raise Error, "Failed running command:\nnb`#{installer.install_command_string}`" unless success
32
+
33
+ say 'Completions installed'
34
+ say "Source: m`#{installer.script_path}`"
35
+ say "Target: m`#{installer.target_path}`"
36
+ say 'Restart your session for the changes to take effect'
37
+ end
38
+
39
+ def uninstall_completions
40
+ success = installer.uninstall
41
+ raise Error, "Failed running command:\nnb`#{installer.uninstall_command_string}`" unless success
42
+
43
+ say 'Completions uninstalled'
44
+ say 'Restart your session for the changes to take effect'
45
+ end
46
+
47
+ def script_path
48
+ @script_path ||= asset('completions/bashly-completions.bash')
49
+ end
50
+
51
+ def script
52
+ @script ||= asset_content('completions/bashly-completions.bash')
53
+ end
54
+ end
55
+ end
56
+ end
@@ -42,10 +42,8 @@ module Bashly
42
42
  Filewatcher.new([Settings.source_dir]).watch do
43
43
  reset
44
44
  generate
45
-
46
45
  rescue Bashly::ConfigurationError => e
47
46
  say! "rib` #{e.class} `\n#{e.message}"
48
-
49
47
  ensure
50
48
  quiet_say "g`waiting`\n"
51
49
  end
@@ -19,7 +19,7 @@ module Bashly
19
19
  terminal = MisterBin::Terminal.new runner, {
20
20
  autocomplete: autocomplete,
21
21
  show_usage: true,
22
- prompt: "\n\e[33m\e[1mbashly\e[0m > ",
22
+ prompt: "\n$> bashly ",
23
23
  }
24
24
 
25
25
  terminal.on('help') { runner.run %w[--help] }
@@ -0,0 +1,24 @@
1
+ # Completions for bashly executable
2
+
3
+ This directory contains templates for generating bash completions.
4
+
5
+ ## For developers
6
+
7
+ From the root directory of the repository, run `run completions`. This will:
8
+
9
+ 1. Read the `completely.yaml.gtx` template
10
+ 2. Write the `completely.yaml` file (to allow testing with completely)
11
+ 3. Generate the `bashly-completions.bash` file
12
+ 4. Copy it to the completions directory with `sudo`
13
+
14
+ Note that for production use, only the `bashly-completions.bash` is used.
15
+
16
+ ## For users
17
+
18
+ Install completions in one of two ways:
19
+
20
+ 1. Run `bashly completions --install`. This will make a best effort to copy
21
+ the completions script to your completions directory.
22
+ 2. If the above fails, run `bashly completions > out.bash`, then copy the file
23
+ manually to your completions directory (or simply get the
24
+ `bashly-completions.bash` from this directory).
@@ -0,0 +1,115 @@
1
+ # bashly completion -*- shell-script -*-
2
+
3
+ # This bash completions script was generated by
4
+ # completely (https://github.com/dannyben/completely)
5
+ # Modifying it manually is not recommended
6
+
7
+ _bashly_completions_filter() {
8
+ local words="$1"
9
+ local cur=${COMP_WORDS[COMP_CWORD]}
10
+ local result=()
11
+
12
+ if [[ "${cur:0:1}" == "-" ]]; then
13
+ echo "$words"
14
+
15
+ else
16
+ for word in $words; do
17
+ [[ "${word:0:1}" != "-" ]] && result+=("$word")
18
+ done
19
+
20
+ echo "${result[*]}"
21
+
22
+ fi
23
+ }
24
+
25
+ _bashly_completions() {
26
+ local cur=${COMP_WORDS[COMP_CWORD]}
27
+ local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")
28
+ local compline="${compwords[*]}"
29
+
30
+ case "$compline" in
31
+ 'generate'*'--env')
32
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "development production")" -- "$cur" )
33
+ ;;
34
+
35
+ 'generate'*'-e')
36
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "development production")" -- "$cur" )
37
+ ;;
38
+
39
+ 'completions'*)
40
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --install -i")" -- "$cur" )
41
+ ;;
42
+
43
+ 'validate'*)
44
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --verbose -v")" -- "$cur" )
45
+ ;;
46
+
47
+ 'generate'*)
48
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --env --force --quiet --upgrade --watch --wrap -e -f -q -r -u -w")" -- "$cur" )
49
+ ;;
50
+
51
+ 'preview'*)
52
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h")" -- "$cur" )
53
+ ;;
54
+
55
+ 'g'*'--env')
56
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "development production")" -- "$cur" )
57
+ ;;
58
+
59
+ 'shell'*)
60
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h")" -- "$cur" )
61
+ ;;
62
+
63
+ 'init'*)
64
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --minimal -m")" -- "$cur" )
65
+ ;;
66
+
67
+ 'g'*'-e')
68
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "development production")" -- "$cur" )
69
+ ;;
70
+
71
+ 'add'*)
72
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --force --list --source -f -l -s colors completions completions_script completions_yaml config help hooks lib settings strings test validations yaml")" -- "$cur" )
73
+ ;;
74
+
75
+ 'doc'*)
76
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --index -i arg arg.allowed arg.default arg.help arg.name arg.repeatable arg.required arg.validate command command.alias command.args command.catch_all command.commands command.completions command.default command.dependencies command.environment_variables command.examples command.expose command.extensible command.filename command.filters command.flags command.footer command.function command.group command.help command.name command.private command.version environment_variable environment_variable.default environment_variable.help environment_variable.name environment_variable.private environment_variable.required flag flag.allowed flag.arg flag.completions flag.conflicts flag.default flag.help flag.long flag.private flag.repeatable flag.required flag.short flag.validate")" -- "$cur" )
77
+ ;;
78
+
79
+ 'i'*)
80
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --minimal -m")" -- "$cur" )
81
+ ;;
82
+
83
+ 'p'*)
84
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h")" -- "$cur" )
85
+ ;;
86
+
87
+ 'v'*)
88
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --verbose -v")" -- "$cur" )
89
+ ;;
90
+
91
+ 'g'*)
92
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --env --force --quiet --upgrade --watch --wrap -e -f -q -r -u -w")" -- "$cur" )
93
+ ;;
94
+
95
+ 'a'*)
96
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --force --list --source -f -l -s colors completions completions_script completions_yaml config help hooks lib settings strings test validations yaml")" -- "$cur" )
97
+ ;;
98
+
99
+ 'c'*)
100
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --install -i")" -- "$cur" )
101
+ ;;
102
+
103
+ 's'*)
104
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h")" -- "$cur" )
105
+ ;;
106
+
107
+ *)
108
+ while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_bashly_completions_filter "--help -h --version -v init preview validate generate add doc completions shell")" -- "$cur" )
109
+ ;;
110
+
111
+ esac
112
+ } &&
113
+ complete -F _bashly_completions bashly
114
+
115
+ # ex: filetype=sh
@@ -0,0 +1,155 @@
1
+ bashly:
2
+ - --help
3
+ - -h
4
+ - --version
5
+ - -v
6
+ - init
7
+ - preview
8
+ - validate
9
+ - generate
10
+ - add
11
+ - doc
12
+ - completions
13
+ - shell
14
+
15
+ bashly init: &init
16
+ - --help
17
+ - -h
18
+ - --minimal
19
+ - -m
20
+
21
+ bashly i: *init
22
+
23
+ bashly preview: &preview
24
+ - --help
25
+ - -h
26
+
27
+ bashly p: *preview
28
+
29
+ bashly validate: &validate
30
+ - --help
31
+ - -h
32
+ - --verbose
33
+ - -v
34
+
35
+ bashly v: *validate
36
+
37
+ bashly generate: &generate
38
+ - --help
39
+ - -h
40
+ - --env
41
+ - --force
42
+ - --quiet
43
+ - --upgrade
44
+ - --watch
45
+ - --wrap
46
+ - -e
47
+ - -f
48
+ - -q
49
+ - -r
50
+ - -u
51
+ - -w
52
+
53
+ bashly g: *generate
54
+
55
+ bashly generate*--env: &env
56
+ - development
57
+ - production
58
+
59
+ bashly generate*-e: *env
60
+ bashly g*--env: *env
61
+ bashly g*-e: *env
62
+
63
+ bashly add: &add
64
+ - --help
65
+ - -h
66
+ - --force
67
+ - --list
68
+ - --source
69
+ - -f
70
+ - -l
71
+ - -s
72
+ - colors
73
+ - completions
74
+ - completions_script
75
+ - completions_yaml
76
+ - config
77
+ - help
78
+ - hooks
79
+ - lib
80
+ - settings
81
+ - strings
82
+ - test
83
+ - validations
84
+ - yaml
85
+
86
+ bashly a: *add
87
+
88
+ bashly doc: &doc
89
+ - --help
90
+ - -h
91
+ - --index
92
+ - -i
93
+ - arg
94
+ - arg.allowed
95
+ - arg.default
96
+ - arg.help
97
+ - arg.name
98
+ - arg.repeatable
99
+ - arg.required
100
+ - arg.validate
101
+ - command
102
+ - command.alias
103
+ - command.args
104
+ - command.catch_all
105
+ - command.commands
106
+ - command.completions
107
+ - command.default
108
+ - command.dependencies
109
+ - command.environment_variables
110
+ - command.examples
111
+ - command.expose
112
+ - command.extensible
113
+ - command.filename
114
+ - command.filters
115
+ - command.flags
116
+ - command.footer
117
+ - command.function
118
+ - command.group
119
+ - command.help
120
+ - command.name
121
+ - command.private
122
+ - command.version
123
+ - environment_variable
124
+ - environment_variable.default
125
+ - environment_variable.help
126
+ - environment_variable.name
127
+ - environment_variable.private
128
+ - environment_variable.required
129
+ - flag
130
+ - flag.allowed
131
+ - flag.arg
132
+ - flag.completions
133
+ - flag.conflicts
134
+ - flag.default
135
+ - flag.help
136
+ - flag.long
137
+ - flag.private
138
+ - flag.repeatable
139
+ - flag.required
140
+ - flag.short
141
+ - flag.validate
142
+
143
+ bashly completions: &completions
144
+ - --help
145
+ - -h
146
+ - --install
147
+ - -i
148
+
149
+ bashly c: *completions
150
+
151
+ bashly shell: &shell
152
+ - --help
153
+ - -h
154
+
155
+ bashly s: *shell
@@ -0,0 +1,85 @@
1
+ > bashly:
2
+ = help_flags
3
+ > - --version
4
+ > - -v
5
+ commands.each do |command|
6
+ = "- #{command}"
7
+ end
8
+ >
9
+ > bashly init: &init
10
+ = help_flags
11
+ > - --minimal
12
+ > - -m
13
+ >
14
+ > bashly i: *init
15
+ >
16
+ > bashly preview: &preview
17
+ = help_flags
18
+ >
19
+ > bashly p: *preview
20
+ >
21
+ > bashly validate: &validate
22
+ = help_flags
23
+ > - --verbose
24
+ > - -v
25
+ >
26
+ > bashly v: *validate
27
+ >
28
+ > bashly generate: &generate
29
+ = help_flags
30
+ > - --env
31
+ > - --force
32
+ > - --quiet
33
+ > - --upgrade
34
+ > - --watch
35
+ > - --wrap
36
+ > - -e
37
+ > - -f
38
+ > - -q
39
+ > - -r
40
+ > - -u
41
+ > - -w
42
+ >
43
+ > bashly g: *generate
44
+ >
45
+ > bashly generate*--env: &env
46
+ > - development
47
+ > - production
48
+ >
49
+ > bashly generate*-e: *env
50
+ > bashly g*--env: *env
51
+ > bashly g*-e: *env
52
+ >
53
+ > bashly add: &add
54
+ = help_flags
55
+ > - --force
56
+ > - --list
57
+ > - --source
58
+ > - -f
59
+ > - -l
60
+ > - -s
61
+ libs.each do |lib|
62
+ = "- #{lib}"
63
+ end
64
+ >
65
+ > bashly a: *add
66
+ >
67
+ > bashly doc: &doc
68
+ = help_flags
69
+ > - --index
70
+ > - -i
71
+ docs.each do |doc|
72
+ = "- #{doc}"
73
+ end
74
+ >
75
+ > bashly completions: &completions
76
+ = help_flags
77
+ > - --install
78
+ > - -i
79
+ >
80
+ > bashly c: *completions
81
+ >
82
+ > bashly shell: &shell
83
+ = help_flags
84
+ >
85
+ > bashly s: *shell
data/lib/bashly/config.rb CHANGED
@@ -2,7 +2,11 @@ require 'yaml'
2
2
 
3
3
  module Bashly
4
4
  # A convenience class to use either a hash or a filename as a configuration
5
- # source
5
+ # source.
6
+ #
7
+ # When a filename is provided, it is loaded with these extra features:
8
+ # - Support for `import` keyword to merge additional YAML files
9
+ # - Preprocessing with ERB
6
10
  class Config
7
11
  using ComposeRefinements
8
12
 
@@ -10,7 +14,7 @@ module Bashly
10
14
 
11
15
  def self.new(config)
12
16
  if config.is_a? String
13
- YAML.properly_load_file(config).compose
17
+ YAML.load_erb_file(config).compose
14
18
  else
15
19
  config
16
20
  end
@@ -13,6 +13,10 @@ class String
13
13
  gsub(/(.)([A-Z])/, '\1_\2').gsub(/[- ]/, '_').downcase
14
14
  end
15
15
 
16
+ def to_path
17
+ tr(' ', '/').downcase
18
+ end
19
+
16
20
  def wrap(length = 80)
17
21
  strip!
18
22
  split("\n").collect! do |line|
@@ -1,10 +1,12 @@
1
1
  module YAML
2
- # This awkward patch is due to https://bugs.ruby-lang.org/issues/17866
3
- def self.properly_load_file(path)
4
- YAML.load_file path, aliases: true
5
- rescue ArgumentError
6
- # :nocov:
7
- YAML.load_file path
8
- # :nocov:
2
+ # We trust our loaded YAMLs
3
+ # This patch is due to https://bugs.ruby-lang.org/issues/17866
4
+ # StackOverflow: https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias/71192990#71192990
5
+ class << self
6
+ alias load unsafe_load
7
+
8
+ def load_erb_file(path)
9
+ YAML.load ERB.new(File.read(path)).result
10
+ end
9
11
  end
10
12
  end
@@ -18,9 +18,15 @@ config_path: "%{source_dir}/bashly.yml"
18
18
  # The path to use for creating the bash script
19
19
  target_dir: .
20
20
 
21
- # The path to use for common library files, relative to the source dir
21
+ # The path to use for common library files, relative to source_dir
22
22
  lib_dir: lib
23
23
 
24
+ # The path to use for command files, relative to source_dir
25
+ # When set to nil (~), command files will be placed directly under source_dir
26
+ # When set to any other string, command files will be placed under this
27
+ # directory, and each command will get its own subdirectory
28
+ commands_dir: ~
29
+
24
30
  # Configure the bash options that will be added to the initialize function:
25
31
  # strict: true Bash strict mode (set -euo pipefail)
26
32
  # strict: false Only exit on errors (set -e)
@@ -14,7 +14,7 @@ module Bashly
14
14
  end
15
15
 
16
16
  def config
17
- @config ||= YAML.properly_load_file config_path
17
+ @config ||= YAML.load_file config_path
18
18
  end
19
19
 
20
20
  def libraries
@@ -13,7 +13,7 @@ module Bashly
13
13
  private
14
14
 
15
15
  def values!
16
- defaults = YAML.properly_load_file asset('libraries/strings/strings.yml')
16
+ defaults = YAML.load_file asset('libraries/strings/strings.yml')
17
17
  defaults.merge project_strings
18
18
  end
19
19
 
@@ -23,7 +23,7 @@ module Bashly
23
23
 
24
24
  def project_strings!
25
25
  if File.exist? project_strings_path
26
- YAML.properly_load_file project_strings_path
26
+ YAML.load_file project_strings_path
27
27
  else
28
28
  {}
29
29
  end
@@ -22,7 +22,7 @@ module ComposeRefinements
22
22
  end
23
23
 
24
24
  def safe_load_yaml(path)
25
- loaded = YAML.properly_load_file path
25
+ loaded = YAML.load_erb_file path
26
26
  return loaded if loaded.is_a?(Array) || loaded.is_a?(Hash)
27
27
 
28
28
  raise Bashly::ConfigurationError, "Cannot find a valid YAML in g`#{path}`"
@@ -159,10 +159,10 @@ module Bashly
159
159
  options['examples'].is_a?(Array) ? options['examples'] : [options['examples']]
160
160
  end
161
161
 
162
- # Returns the bash filename that is expected to hold the user code
163
- # for this command
162
+ # Returns the filename that is expected to hold the user code for this
163
+ # command
164
164
  def filename
165
- options['filename'] || "#{action_name.to_underscore}_command.#{Settings.partials_extension}"
165
+ options['filename'] || implicit_filename
166
166
  end
167
167
 
168
168
  # Returns an array of Flags
@@ -240,7 +240,7 @@ module Bashly
240
240
 
241
241
  # Returns true if one of the args is repeatable
242
242
  def repeatable_arg_exist?
243
- args.select(&:repeatable).any?
243
+ args.any?(&:repeatable)
244
244
  end
245
245
 
246
246
  # Returns an array of all the required Arguments
@@ -265,7 +265,7 @@ module Bashly
265
265
 
266
266
  # Returns true if one of the flags matches the provided short code
267
267
  def short_flag_exist?(flag)
268
- flags.select { |f| f.short == flag }.any?
268
+ flags.any? { |f| f.short == flag }
269
269
  end
270
270
 
271
271
  # Returns the summary string
@@ -314,6 +314,18 @@ module Bashly
314
314
  def whitelisted_flags
315
315
  flags.select(&:allowed)
316
316
  end
317
+
318
+ private
319
+
320
+ # Returns either a flat filename (docker_status_command.sh) or a nested
321
+ # path (commands/docker/status.sh)
322
+ def implicit_filename
323
+ if Settings.commands_dir
324
+ "#{Settings.commands_dir}/#{action_name.to_path}.#{Settings.partials_extension}"
325
+ else
326
+ "#{action_name.to_underscore}_command.#{Settings.partials_extension}"
327
+ end
328
+ end
317
329
  end
318
330
  end
319
331
  end
@@ -4,6 +4,7 @@ module Bashly
4
4
  include AssetHelper
5
5
 
6
6
  attr_writer(
7
+ :commands_dir,
7
8
  :compact_short_flags,
8
9
  :config_path,
9
10
  :lib_dir,
@@ -15,6 +16,10 @@ module Bashly
15
16
  :usage_colors
16
17
  )
17
18
 
19
+ def commands_dir
20
+ @commands_dir ||= get :commands_dir
21
+ end
22
+
18
23
  def compact_short_flags
19
24
  @compact_short_flags ||= get :compact_short_flags
20
25
  end
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bashly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-02 00:00:00.000000000 Z
11
+ date: 2023-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.5'
39
+ version: 0.6.1
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.5'
46
+ version: 0.6.1
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: filewatcher
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -127,12 +127,17 @@ files:
127
127
  - lib/bashly/cli.rb
128
128
  - lib/bashly/commands/add.rb
129
129
  - lib/bashly/commands/base.rb
130
+ - lib/bashly/commands/completions.rb
130
131
  - lib/bashly/commands/doc.rb
131
132
  - lib/bashly/commands/generate.rb
132
133
  - lib/bashly/commands/init.rb
133
134
  - lib/bashly/commands/preview.rb
134
135
  - lib/bashly/commands/shell.rb
135
136
  - lib/bashly/commands/validate.rb
137
+ - lib/bashly/completions/README.md
138
+ - lib/bashly/completions/bashly-completions.bash
139
+ - lib/bashly/completions/completely.yaml
140
+ - lib/bashly/completions/completely.yaml.gtx
136
141
  - lib/bashly/concerns/asset_helper.rb
137
142
  - lib/bashly/concerns/completions.rb
138
143
  - lib/bashly/concerns/renderable.rb
@@ -263,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
268
  - !ruby/object:Gem::Version
264
269
  version: '0'
265
270
  requirements: []
266
- rubygems_version: 3.4.13
271
+ rubygems_version: 3.4.10
267
272
  signing_key:
268
273
  specification_version: 4
269
274
  summary: Bash Command Line Tool Generator