completely 0.4.1 → 0.4.2

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: 2012c5d2e6bdbdc4105a86bb535bcaacec54623b75ed4a68dfed59d7283b806f
4
- data.tar.gz: 35b022231df795d3820c3c22df622351a83c8c5720becde6ce4cde05cccb5643
3
+ metadata.gz: cb9fe8791d64ddc71e8ee082ce9fc9cf028376f61c71bf354b758f38ecfded86
4
+ data.tar.gz: 9fa6a5ced31c2fafdebfbd0172f939cccd9aa95b48eedd5ca528ab5a3b03eee2
5
5
  SHA512:
6
- metadata.gz: cabb44f5d2e22d3fcaf2dba81c8bcca443f3ae06ce2201023cd7babd2f93792c754e97d1816a649b23139cb0b89d1ed4a23cbe875774cfa6f68bd0f055dfeb68
7
- data.tar.gz: 9c74a483866d9b1b487f721d8ea19ea8523906986992d7df64b2b96945898ba667641c9d849f23ccdb9453635ecf088f1651b7d8346566eb7fd461fa4e76e170
6
+ metadata.gz: ea9dcf451393c1b242bebcf0766a2d56e847005da451557aa601893536fdb7a2773bd1abbeb6a3b510abae3ffa87258fd6bbc45641405a991690c2bd0441a623
7
+ data.tar.gz: 77ee32ac693f7cdee5953e173974e84ddee4380b0298b3caf3a68a79208bae2ab6f856ae0e8f49b9c15d152b171ad7ad5186837e56cfcbc69b5abe4bd82a6873
@@ -5,15 +5,13 @@ module Completely
5
5
  class Test < Base
6
6
  summary "Test completions"
7
7
 
8
- help <<~EOF
9
- This command can be used to test that any completion script (either generated by compeltely or not) responds with the right completions.
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."
10
9
 
11
- In order to test on a completely configuration file other than 'completely.yaml', set the COMPLETELY_CONFIG_PATH environemnt variable.
12
- EOF
13
-
14
- usage "completely test COMPLINE"
10
+ usage "completely test [--keep] COMPLINE"
15
11
  usage "completely test (-h|--help)"
16
12
 
13
+ option "-k --keep", "Keep the temporary testing script in the current directory"
14
+
17
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."
18
16
 
19
17
  environment_config_path
@@ -24,6 +22,10 @@ module Completely
24
22
 
25
23
  def run
26
24
  puts tester.test(compline).join "\n"
25
+ if args['--keep']
26
+ File.write 'completely-tester.sh', tester_script
27
+ puts 'saved completely-tester.sh'
28
+ end
27
29
  end
28
30
 
29
31
  private
@@ -32,9 +34,16 @@ module Completely
32
34
  args['COMPLINE']
33
35
  end
34
36
 
37
+ def completions
38
+ @completions ||= Completions.load config_path
39
+ end
40
+
35
41
  def tester
36
- completions = Completions.load config_path
37
- completions.tester
42
+ @tester ||= completions.tester
43
+ end
44
+
45
+ def tester_script
46
+ @tester_script ||= tester.tester_script compline
38
47
  end
39
48
 
40
49
  end
@@ -1,7 +1,14 @@
1
1
  #!/usr/bin/env bash
2
+ if [[ -n $ZSH_VERSION ]]; then
3
+ autoload -U +X bashcompinit && bashcompinit
4
+ autoload -U +X compinit && compinit
5
+ fi
6
+
7
+ # === COMPLETION SCRIPT START ===
8
+
2
9
  <%= script || %Q[source "#{absolute_script_path}"] %>
3
10
 
4
- # END OF COMPLETION SCRIPT
11
+ # === COMPLETION SCRIPT END ===
5
12
 
6
13
  COMP_WORDS=( <%= compline %> )
7
14
  COMP_LINE="<%= compline %>"
@@ -1,3 +1,3 @@
1
1
  module Completely
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: completely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
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-05-21 00:00:00.000000000 Z
11
+ date: 2022-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole