completely 0.5.1 → 0.5.3

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: 133a4cb7fec5b868e4c98e594bc6ffc228c25eee4b85a58801f03fc78d9b1cbf
4
- data.tar.gz: 5073efb37aba0c9601875d05a9b9acce469d71d182f91c8729f18052bdcfc915
3
+ metadata.gz: a935ee0ae2ceb0c9c7b1f579c876a97068c45f133cfeaebcc2e6a6578216af22
4
+ data.tar.gz: 624cc5668dd558f54aa8d66e6b6af765131c2f0a2442fe3c024247a52687a2fa
5
5
  SHA512:
6
- metadata.gz: 63029b5f2cfd9362a7daa0e0d940e5f296d42962c2d0e9b2bda2297fe0c95b5abd3e6c9029f6c3781932b7fa2d2e122b0672ca6708774c375bcb277db48e5cf3
7
- data.tar.gz: 9ec01adf53afe6d2aaa14ca6a369754adb76ef0043a51663183807eee3d0266c74c18bfd2518ff2d5bf1a5ba04216e0ac9fe0af3a3435b3ee2816115570cc568
6
+ metadata.gz: 0a08c66582789427539a284b8b7e037643178cdfc602ea2621366fcd0de37bba34a6bd05a712ac5243e5538ddf19cc042549a9c6ecce1694cf8dabf5189f6e75
7
+ data.tar.gz: e654bff7e530d8cb5414a1bcefe52081542041c57387c2b71cf61d8d49f26b2b8b5df96c648b51fa83594c828f597f8f0f814e7f6760fac3cc8f5c8fb5b76aa0
data/bin/completely CHANGED
@@ -10,6 +10,6 @@ begin
10
10
  exit runner.run ARGV
11
11
  rescue => e
12
12
  puts e.backtrace.reverse if ENV['DEBUG']
13
- say! "!undred!#{e.class}!txtrst!\n#{e.message}"
13
+ say! "rib` #{e.class} `\n#{e.message}"
14
14
  exit 1
15
15
  end
@@ -10,7 +10,7 @@ module Completely
10
10
  def self.runner
11
11
  runner = MisterBin::Runner.new version: Completely::VERSION,
12
12
  header: 'Completely - Bash Completions Generator',
13
- footer: 'Run !txtpur!completely COMMAND --help!txtrst! for more information'
13
+ footer: 'Run m`completely COMMAND --help` for more information'
14
14
 
15
15
  runner.route 'init', to: Commands::Init
16
16
  runner.route 'preview', to: Commands::Preview
@@ -5,19 +5,26 @@ module Completely
5
5
  class Base < MisterBin::Command
6
6
  class << self
7
7
  def param_config_path
8
- param 'CONFIG_PATH', "Path to the YAML configuration file [default: completely.yaml]\nCan also be set by an environment variable"
8
+ param 'CONFIG_PATH', <<~USAGE
9
+ Path to the YAML configuration file [default: completely.yaml].
10
+ Can also be set by an environment variable.
11
+ USAGE
9
12
  end
10
13
 
11
14
  def option_function
12
- option '-f --function NAME', 'Modify the name of the function in the generated script'
15
+ option '-f --function NAME',
16
+ 'Modify the name of the function in the generated script.'
13
17
  end
14
18
 
15
19
  def environment_config_path
16
- environment 'COMPLETELY_CONFIG_PATH', 'Path to a completely configuration file [default: completely.yaml]'
20
+ environment 'COMPLETELY_CONFIG_PATH',
21
+ 'Path to a completely configuration file [default: completely.yaml].'
17
22
  end
18
23
 
19
24
  def environment_debug
20
- environment 'COMPLETELY_DEBUG', 'It not empty, the generated script will include an additional debugging snippet that outputs the compline and current word to a text file when a completion is requested'
25
+ environment 'COMPLETELY_DEBUG', 'If not empty, the generated script will include ' \
26
+ 'an additional debugging snippet that outputs the compline and current word to ' \
27
+ 'a text file when a completion is requested.'
21
28
  end
22
29
  end
23
30
 
@@ -44,8 +51,8 @@ module Completely
44
51
  end
45
52
 
46
53
  def syntax_warning
47
- say! "\n!txtred!WARNING:\nYour configuration is invalid."
48
- say! '!txtred!All patterns must start with the same word.'
54
+ say! "\nr`WARNING:`\nr`Your configuration is invalid.`"
55
+ say! 'r`All patterns must start with the same word.`'
49
56
  end
50
57
  end
51
58
  end
@@ -9,20 +9,25 @@ module Completely
9
9
  usage 'completely generate (-h|--help)'
10
10
 
11
11
  option_function
12
- option '-w --wrap NAME', 'Wrap the completion script inside a function that echos the script. This is useful if you wish to embed it directly in your script'
12
+ option '-w --wrap NAME', 'Wrap the completion script inside a function that echos the ' \
13
+ 'script. This is useful if you wish to embed it directly in your script.'
13
14
 
14
15
  param_config_path
15
- param 'OUTPUT_PATH', "Path to the output bash script. When not provided, the name of the input file will be used with a .bash extension\nCan also be set by an environment variable"
16
+ param 'OUTPUT_PATH', <<~USAGE
17
+ Path to the output bash script.
18
+ When not provided, the name of the input file will be used with a .bash extension.
19
+ Can also be set by an environment variable.
20
+ USAGE
16
21
 
17
22
  environment_config_path
18
- environment 'COMPLETELY_OUTPUT_PATH', 'Path to the output bash script'
23
+ environment 'COMPLETELY_OUTPUT_PATH', 'Path to the output bash script.'
19
24
  environment_debug
20
25
 
21
26
  def run
22
27
  wrap = args['--wrap']
23
28
  output = wrap ? wrapper_function(wrap) : script
24
29
  File.write output_path, output
25
- say "Saved !txtpur!#{output_path}"
30
+ say "Saved m`#{output_path}`"
26
31
  syntax_warning unless completions.valid?
27
32
  end
28
33
 
@@ -15,7 +15,7 @@ module Completely
15
15
  raise "File already exists: #{config_path}" if File.exist? config_path
16
16
 
17
17
  File.write config_path, sample
18
- say "Saved !txtpur!#{config_path}"
18
+ say "Saved m`#{config_path}`"
19
19
  end
20
20
 
21
21
  private
@@ -5,27 +5,30 @@ module Completely
5
5
  class Test < Base
6
6
  summary 'Test completions'
7
7
 
8
- help 'This command can be used to test that your completions script responds with the right completions. It works by reading your completely.yaml file, generating a completions script, and generating a temporary testing script.'
8
+ help 'This command can be used to test that your completions script responds with ' \
9
+ 'the right completions. It works by reading your completely.yaml file, generating ' \
10
+ 'a completions script, and generating a temporary testing script.'
9
11
 
10
- usage 'completely test [--keep] COMPLINE'
12
+ usage 'completely test [--keep] COMPLINE...'
11
13
  usage 'completely test (-h|--help)'
12
14
 
13
- option '-k --keep', 'Keep the temporary testing script in the current directory'
15
+ option '-k --keep', 'Keep the temporary testing script in the current directory.'
14
16
 
15
- param 'COMPLINE', 'The command to test completions for. This will be handled as if a TAB was pressed immediately at the end of it, so the last word is considered the active cursor. If you wish to complete for the next word instead, end your command with a space.'
17
+ param 'COMPLINE', 'One or more commands to test completions for. ' \
18
+ 'This will be handled as if a TAB was pressed immediately at the end of it, ' \
19
+ 'so the last word is considered the active cursor. ' \
20
+ 'If you wish to complete for the next word instead, end your command with a space.'
16
21
 
17
22
  environment_config_path
18
23
  environment_debug
19
24
 
20
- example 'completely test "mygit pu"'
21
- example 'completely test "mygit pull "'
25
+ example 'completely test "mygit "'
26
+ example 'completely test --keep "mygit status "'
27
+ example 'completely test "mygit status --" "mygit init "'
22
28
 
23
29
  def run
24
- puts tester.test(compline).join "\n"
25
-
26
- if args['--keep']
27
- File.write 'completely-tester.sh', tester_script
28
- puts 'saved completely-tester.sh'
30
+ complines.each_with_index do |compline, i|
31
+ show_compline compline, filename: "completely-tester-#{i + 1}.sh"
29
32
  end
30
33
 
31
34
  syntax_warning unless completions.valid?
@@ -33,8 +36,24 @@ module Completely
33
36
 
34
37
  private
35
38
 
36
- def compline
37
- args['COMPLINE']
39
+ def show_compline(compline, filename: nil)
40
+ filename ||= 'completely-tester.sh'
41
+ say "b`$` g`#{compline}`<tab>"
42
+ puts tester.test(compline).join "\n"
43
+ puts
44
+
45
+ return unless keep
46
+
47
+ File.write filename, tester_script(compline)
48
+ say "Saved m`#{filename}`"
49
+ end
50
+
51
+ def complines
52
+ @complines ||= args['COMPLINE']
53
+ end
54
+
55
+ def keep
56
+ @keep ||= args['--keep']
38
57
  end
39
58
 
40
59
  def completions
@@ -45,8 +64,8 @@ module Completely
45
64
  @tester ||= completions.tester
46
65
  end
47
66
 
48
- def tester_script
49
- @tester_script ||= tester.tester_script compline
67
+ def tester_script(compline)
68
+ tester.tester_script compline
50
69
  end
51
70
  end
52
71
  end
@@ -1,3 +1,3 @@
1
1
  module Completely
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.3'
3
3
  end
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: completely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
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: 2022-11-28 00:00:00.000000000 Z
11
+ date: 2023-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.1
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '0.6'
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.1
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '0.6'
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: mister_bin
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 0.7.2
39
+ version: '0.7'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: 0.7.2
46
+ version: '0.7'
41
47
  description: Generate bash completion scripts using simple YAML configuration
42
48
  email: db@dannyben.com
43
49
  executables:
@@ -81,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
87
  - !ruby/object:Gem::Version
82
88
  version: '0'
83
89
  requirements: []
84
- rubygems_version: 3.3.26
90
+ rubygems_version: 3.4.5
85
91
  signing_key:
86
92
  specification_version: 4
87
93
  summary: Bash Completions Generator