bashly 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b90c79b66c9396dc7fda026e19761818e7db33c8b19b0e0501486b3cdf7f1e0
4
- data.tar.gz: be2b5e3ae996189263e604421910ebc3b8a597e3cf9c525cf19b94e2e4434fd3
3
+ metadata.gz: 8c219a4bf3f32f47434d1a855a620ea62caaafe336a8647e8ef84529eb7023b8
4
+ data.tar.gz: d18b7f6bdfeb43fc4a27fb9e5f617d1c0c9c6f5783f5c7dc1df8f6eff575c8ab
5
5
  SHA512:
6
- metadata.gz: 1414d602e5fabf5e9b98dfb1811276601f01de83dc0c866ce155ab22a2246122c9a6a2605c9f83dedc70f21a47c5f397b5ed59339412d8eccf09a319429b7271
7
- data.tar.gz: 8bef6713c24b2a2d24d0ef97b54c1fd957ad8ff28e041ec08fdfa96c3bedc22a5a41c6b4691367357e63e404ba87dbd9599d7eddd0102cbe9bac9184f0d1dcee
6
+ metadata.gz: 38cf3b1d1c49c447f0e2817b57cb03362e528cefe22dc0f4d9c1dcfcb7b52859c034bc012bfb7ec769b6c94801c102bfe74d9c336e0dbc8ee060027c10b1b242
7
+ data.tar.gz: e64ced05cc15cd4cb66cc2dc6696cb522db87843c9fc8826d69500cfb1aafb8aa3ad13ccf36bca806ce262cece7c30763229d82f297bbf471ee71ca5807eaaec
data/lib/bashly/cli.rb CHANGED
@@ -15,6 +15,7 @@ module Bashly
15
15
  runner.route 'generate', to: Commands::Generate
16
16
  runner.route 'add', to: Commands::Add
17
17
  runner.route 'doc', to: Commands::Doc
18
+ runner.route 'shell', to: Commands::Shell unless ENV['BASHLY_SHELL']
18
19
 
19
20
  runner
20
21
  end
@@ -2,7 +2,6 @@ module Bashly
2
2
  module Commands
3
3
  class Doc < Base
4
4
  summary 'Show bashly reference documentation'
5
- help 'This command displays bite-sized help for all the bashly configuration options in the terminal.'
6
5
 
7
6
  usage 'bashly doc [SEARCH] [--index]'
8
7
  usage 'bashly doc (-h|--help)'
@@ -2,7 +2,7 @@ module Bashly
2
2
  module Commands
3
3
  class Init < Base
4
4
  summary 'Initialize a new workspace'
5
- help 'This command will create the source folder, and place a template configuration file in it.'
5
+ help 'Create the bashly source folder, and place a template configuration file in it'
6
6
 
7
7
  usage 'bashly init [--minimal]'
8
8
  usage 'bashly init (-h|--help)'
@@ -0,0 +1,40 @@
1
+ module Bashly
2
+ module Commands
3
+ class Shell < Base
4
+ summary 'Start an interactive bashly shell'
5
+ help 'Start an interactive shell where you can run bashly commands'
6
+
7
+ usage 'bashly shell'
8
+ usage 'bashly shell (-h|--help)'
9
+
10
+ def run
11
+ ENV['BASHLY_SHELL'] = '1'
12
+ terminal.start
13
+ end
14
+
15
+ private
16
+
17
+ def terminal
18
+ @terminal ||= begin
19
+ terminal = MisterBin::Terminal.new runner, {
20
+ autocomplete: autocomplete,
21
+ show_usage: true,
22
+ prompt: "\n\e[33m\e[1mbashly\e[0m > ",
23
+ }
24
+
25
+ terminal.on('help') { runner.run %w[--help] }
26
+ terminal.on('version') { runner.run %w[--version] }
27
+ terminal
28
+ end
29
+ end
30
+
31
+ def runner
32
+ @runner ||= Bashly::CLI.runner
33
+ end
34
+
35
+ def autocomplete
36
+ @autocomplete ||= %w[help version] + runner.commands.keys
37
+ end
38
+ end
39
+ end
40
+ end
@@ -29,7 +29,7 @@ module Bashly
29
29
  end
30
30
  end
31
31
 
32
- commands.each do |command|
32
+ public_commands.each do |command|
33
33
  result.merge! command.completion_data(with_version: false)
34
34
  end
35
35
 
@@ -62,7 +62,7 @@ module Bashly
62
62
  end
63
63
 
64
64
  def completion_flag_names
65
- flags.map(&:name) + flags.map(&:short)
65
+ public_flags.map(&:name) + public_flags.map(&:short)
66
66
  end
67
67
 
68
68
  def completion_allowed_args
@@ -73,7 +73,7 @@ module Bashly
73
73
  trivial_flags = %w[--help -h]
74
74
  trivial_flags += %w[--version -v] if with_version
75
75
  all = (
76
- command_aliases + trivial_flags +
76
+ public_command_aliases + trivial_flags +
77
77
  completion_flag_names + completion_allowed_args
78
78
  )
79
79
 
@@ -223,6 +223,11 @@ module Bashly
223
223
  commands.reject(&:private)
224
224
  end
225
225
 
226
+ # Returns a full list of the public Command names and aliases combined
227
+ def public_command_aliases
228
+ public_commands.map(&:aliases).flatten
229
+ end
230
+
226
231
  # Returns only environment variables that are not private
227
232
  def public_environment_variables
228
233
  environment_variables.reject(&:private)
@@ -56,9 +56,9 @@ module Bashly
56
56
  end
57
57
 
58
58
  def strict_string
59
- if Settings.strict.is_a? String
60
- Settings.strict
61
- elsif Settings.strict
59
+ if strict.is_a? String
60
+ strict
61
+ elsif strict
62
62
  'set -euo pipefail'
63
63
  else
64
64
  'set -e'
@@ -101,7 +101,13 @@ module Bashly
101
101
  end
102
102
 
103
103
  def user_settings_path
104
- ENV['BASHLY_SETTINGS_PATH'] || 'settings.yml'
104
+ @user_settings_path ||= if ENV['BASHLY_SETTINGS_PATH']
105
+ ENV['BASHLY_SETTINGS_PATH']
106
+ elsif File.exist? 'bashly-settings.yml'
107
+ 'bashly-settings.yml'
108
+ else
109
+ 'settings.yml'
110
+ end
105
111
  end
106
112
 
107
113
  def defsult_settings
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.5'
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.3
4
+ version: 1.0.5
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-04-08 00:00:00.000000000 Z
11
+ date: 2023-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole
@@ -131,6 +131,7 @@ files:
131
131
  - lib/bashly/commands/generate.rb
132
132
  - lib/bashly/commands/init.rb
133
133
  - lib/bashly/commands/preview.rb
134
+ - lib/bashly/commands/shell.rb
134
135
  - lib/bashly/commands/validate.rb
135
136
  - lib/bashly/concerns/asset_helper.rb
136
137
  - lib/bashly/concerns/completions.rb
@@ -262,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
263
  - !ruby/object:Gem::Version
263
264
  version: '0'
264
265
  requirements: []
265
- rubygems_version: 3.4.10
266
+ rubygems_version: 3.4.13
266
267
  signing_key:
267
268
  specification_version: 4
268
269
  summary: Bash Command Line Tool Generator