completely 0.7.3 → 0.7.5
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 +4 -4
- data/README.md +9 -0
- data/lib/completely/commands/generate.rb +1 -1
- data/lib/completely/installer.rb +17 -30
- data/lib/completely/pattern.rb +4 -0
- data/lib/completely/templates/template.erb +3 -0
- data/lib/completely/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bc1feb2ea4f84471fa2e014aed467122163556f6f92c0ec5ad536065f3789438
|
|
4
|
+
data.tar.gz: 747d77ca9ce9f351bd914656423f92d8501aa2e0b19789f227bbcd1130de7cb2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9bd666b63af2f8a48a085d7025d39d5980eb93c796193144a29e3c730f80f9c409b99584ffbd6bbbd240819ba3af9013915ff090f04850e9bd09c01d928d056e
|
|
7
|
+
data.tar.gz: b2a6fa4704ba2c6004e4ceb4735a7cc92cfb24bc9e277779562180153102d1983f1716a59a829f2269042f2e02528af1d75de87196c8e86a17a043097e4c0d42
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Completely - Bash Completions Generator
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+
|
|
3
5
|
Completely is a command line utility and a Ruby library that lets you generate
|
|
4
6
|
bash completion scripts from simple YAML configuration.
|
|
5
7
|
|
|
@@ -167,6 +169,13 @@ mygit:
|
|
|
167
169
|
The `2> /dev/null` is used so that if the command is executed in a directory
|
|
168
170
|
without a git repository, it will still behave as expected.
|
|
169
171
|
|
|
172
|
+
### Completion scope and limitations
|
|
173
|
+
|
|
174
|
+
- Completion words are treated as whitespace-delimited tokens.
|
|
175
|
+
- Literal completion phrases that contain spaces are not supported as a single completion item.
|
|
176
|
+
- Quotes and other special shell characters in literal completion words are not escaped automatically.
|
|
177
|
+
- Dynamic `$(...)` completion commands should output plain whitespace-delimited words.
|
|
178
|
+
|
|
170
179
|
### Suggesting flag arguments
|
|
171
180
|
|
|
172
181
|
Adding a `*` wildcard in the middle of a pattern can be useful for suggesting
|
data/lib/completely/installer.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
|
|
1
3
|
module Completely
|
|
2
4
|
class Installer
|
|
3
5
|
class << self
|
|
@@ -38,18 +40,8 @@ module Completely
|
|
|
38
40
|
@script_path = script_path
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
def target_directories
|
|
42
|
-
@target_directories ||= %W[
|
|
43
|
-
/usr/share/bash-completion/completions
|
|
44
|
-
/usr/local/etc/bash_completion.d
|
|
45
|
-
#{Dir.home}/.local/share/bash-completion/completions
|
|
46
|
-
#{Dir.home}/.bash_completion.d
|
|
47
|
-
]
|
|
48
|
-
end
|
|
49
|
-
|
|
50
43
|
def install_command
|
|
51
|
-
|
|
52
|
-
result + %W[cp #{script_path} #{target_path}]
|
|
44
|
+
%W[cp #{script_path} #{target_path}]
|
|
53
45
|
end
|
|
54
46
|
|
|
55
47
|
def install_command_string
|
|
@@ -57,8 +49,7 @@ module Completely
|
|
|
57
49
|
end
|
|
58
50
|
|
|
59
51
|
def uninstall_command
|
|
60
|
-
|
|
61
|
-
result + %w[rm -f] + target_directories.map { |dir| "#{dir}/#{program}" }
|
|
52
|
+
%W[rm -f #{target_path}]
|
|
62
53
|
end
|
|
63
54
|
|
|
64
55
|
def uninstall_command_string
|
|
@@ -70,14 +61,12 @@ module Completely
|
|
|
70
61
|
end
|
|
71
62
|
|
|
72
63
|
def install(force: false)
|
|
73
|
-
unless completions_path
|
|
74
|
-
raise InstallError, 'Cannot determine system completions directory'
|
|
75
|
-
end
|
|
76
|
-
|
|
77
64
|
unless script_exist?
|
|
78
65
|
raise InstallError, "Cannot find script: m`#{script_path}`"
|
|
79
66
|
end
|
|
80
67
|
|
|
68
|
+
FileUtils.mkdir_p completions_path
|
|
69
|
+
|
|
81
70
|
if target_exist? && !force
|
|
82
71
|
raise InstallError, "File exists: m`#{target_path}`"
|
|
83
72
|
end
|
|
@@ -99,22 +88,20 @@ module Completely
|
|
|
99
88
|
File.exist? script_path
|
|
100
89
|
end
|
|
101
90
|
|
|
102
|
-
def
|
|
103
|
-
|
|
91
|
+
def completions_path
|
|
92
|
+
@completions_path ||= "#{user_completions_base_dir}/completions"
|
|
104
93
|
end
|
|
105
94
|
|
|
106
|
-
def
|
|
107
|
-
@
|
|
108
|
-
|
|
109
|
-
target_directories.each do |target|
|
|
110
|
-
if Dir.exist? target
|
|
111
|
-
result = target
|
|
112
|
-
break
|
|
113
|
-
end
|
|
114
|
-
end
|
|
95
|
+
def user_completions_base_dir
|
|
96
|
+
@user_completions_base_dir ||= bash_completion_user_dir || "#{data_home}/bash-completion"
|
|
97
|
+
end
|
|
115
98
|
|
|
116
|
-
|
|
117
|
-
|
|
99
|
+
def bash_completion_user_dir
|
|
100
|
+
ENV['BASH_COMPLETION_USER_DIR']&.split(':')&.find { |entry| !entry.empty? }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def data_home
|
|
104
|
+
ENV['XDG_DATA_HOME'] || "#{Dir.home}/.local/share"
|
|
118
105
|
end
|
|
119
106
|
end
|
|
120
107
|
end
|
data/lib/completely/pattern.rb
CHANGED
|
@@ -60,6 +60,9 @@
|
|
|
60
60
|
% patterns.each do |pattern|
|
|
61
61
|
% next if pattern.empty?
|
|
62
62
|
<%= pattern.case_string %>)
|
|
63
|
+
% if pattern.filename_action?
|
|
64
|
+
compopt -o filenames 2>/dev/null
|
|
65
|
+
% end
|
|
63
66
|
while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen <%= pattern.compgen %> -- "$cur")
|
|
64
67
|
;;
|
|
65
68
|
|
data/lib/completely/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: completely
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Danny Ben Shitrit
|
|
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
89
|
version: '0'
|
|
90
90
|
requirements: []
|
|
91
|
-
rubygems_version:
|
|
91
|
+
rubygems_version: 4.0.6
|
|
92
92
|
specification_version: 4
|
|
93
93
|
summary: Bash Completions Generator
|
|
94
94
|
test_files: []
|