rubeepass 2.0.9 → 3.0.0
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/lib/rubeepass/group.rb +44 -28
- data/lib/rubeepass/wish/copy_wish.rb +3 -4
- data/lib/rubeepass/wish/echo_wish.rb +3 -4
- data/lib/rubeepass/wish/show_wish.rb +2 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91862604b6d530be51df7825db096ccad76a0e8dd1dbd263ae153d6a91f5e27b
|
4
|
+
data.tar.gz: 7f43ea94b77cbdbed2c5956cca66f74fbc080bb704db47b1d597fd35e24cf143
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a084c97770183b0ebcc079cd262cfe4bb70a8de47836682c69520c0e046ab269621fe3e67db56e6abbd3904c908da352d1e6bf5ab3978581831314b1ff5338a
|
7
|
+
data.tar.gz: a630da76572f741def57282da179b5572b88ec78e7bacbd337d06aa1065616d9a3efe9a87ea18fb2002cd72dc08e49494d98f066af40469aebbcb20bc942d472
|
data/lib/rubeepass/group.rb
CHANGED
@@ -48,12 +48,28 @@ class RubeePass::Group
|
|
48
48
|
return out.join("\n")
|
49
49
|
end
|
50
50
|
|
51
|
+
def entry_by_uuid(uuid)
|
52
|
+
return @entries[uuid]
|
53
|
+
end
|
54
|
+
|
51
55
|
def entry_titles
|
52
|
-
return @entries.
|
56
|
+
return @entries.values.map do |entry|
|
57
|
+
entry.title
|
58
|
+
end.sort do |a, b|
|
53
59
|
a.downcase <=> b.downcase
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
63
|
+
def entries_by_title(title, case_insensitive = false)
|
64
|
+
return @entries.values.select do |entry|
|
65
|
+
(entry.title == title) ||
|
66
|
+
(
|
67
|
+
case_insensitive &&
|
68
|
+
(entry.title.downcase == title.downcase)
|
69
|
+
)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
57
73
|
def find_group(path, case_insensitive = false)
|
58
74
|
return nil if (@keepass.nil?)
|
59
75
|
|
@@ -62,20 +78,10 @@ class RubeePass::Group
|
|
62
78
|
|
63
79
|
path.split("/").each do |group|
|
64
80
|
next if (group.empty?)
|
65
|
-
if (
|
66
|
-
|
67
|
-
cwd = cwd.groups.select do |k, v|
|
68
|
-
k.downcase == group.downcase
|
69
|
-
end.values.first
|
70
|
-
else
|
71
|
-
return nil
|
72
|
-
end
|
81
|
+
if (cwd.has_group_like?(group))
|
82
|
+
cwd = cwd.groups_by_name(group, case_insensitive)[0]
|
73
83
|
else
|
74
|
-
|
75
|
-
cwd = cwd.groups[group]
|
76
|
-
else
|
77
|
-
return nil
|
78
|
-
end
|
84
|
+
return nil
|
79
85
|
end
|
80
86
|
end
|
81
87
|
|
@@ -111,7 +117,7 @@ class RubeePass::Group
|
|
111
117
|
group,
|
112
118
|
entry_xml
|
113
119
|
)
|
114
|
-
group.entries[entry.
|
120
|
+
group.entries[entry.uuid] = entry
|
115
121
|
end
|
116
122
|
end
|
117
123
|
|
@@ -122,7 +128,7 @@ class RubeePass::Group
|
|
122
128
|
group,
|
123
129
|
group_xml
|
124
130
|
)
|
125
|
-
group.groups[child.
|
131
|
+
group.groups[child.uuid] = child
|
126
132
|
end
|
127
133
|
end
|
128
134
|
|
@@ -140,9 +146,7 @@ class RubeePass::Group
|
|
140
146
|
return [Array.new, Array.new] if (new_cwd.nil?)
|
141
147
|
|
142
148
|
if (new_cwd.has_group_like?(target))
|
143
|
-
new_cwd = new_cwd.
|
144
|
-
k.downcase == target.downcase
|
145
|
-
end.values.first
|
149
|
+
new_cwd = new_cwd.groups_by_name(target, true)[0]
|
146
150
|
target = ""
|
147
151
|
end
|
148
152
|
|
@@ -163,30 +167,42 @@ class RubeePass::Group
|
|
163
167
|
return [group_completions, entry_completions]
|
164
168
|
end
|
165
169
|
|
170
|
+
def group_by_uuid(uuid)
|
171
|
+
return @groups[uuid]
|
172
|
+
end
|
173
|
+
|
166
174
|
def group_names
|
167
|
-
return @groups.
|
175
|
+
return @groups.values.map do |group|
|
176
|
+
group.name
|
177
|
+
end.sort do |a, b|
|
168
178
|
a.downcase <=> b.downcase
|
169
179
|
end
|
170
180
|
end
|
171
181
|
|
182
|
+
def groups_by_name(name, case_insensitive = false)
|
183
|
+
return @groups.values.select do |group|
|
184
|
+
(group.name == name) ||
|
185
|
+
(
|
186
|
+
case_insensitive &&
|
187
|
+
(group.name.downcase == name.downcase)
|
188
|
+
)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
172
192
|
def has_entry?(entry)
|
173
|
-
return
|
193
|
+
return !entries_by_title(entry).empty?
|
174
194
|
end
|
175
195
|
|
176
196
|
def has_entry_like?(entry)
|
177
|
-
return
|
178
|
-
title.downcase == entry.downcase
|
179
|
-
end
|
197
|
+
return !entries_by_title(entry, true).empty?
|
180
198
|
end
|
181
199
|
|
182
200
|
def has_group?(group)
|
183
|
-
return
|
201
|
+
return !groups_by_name(group).empty?
|
184
202
|
end
|
185
203
|
|
186
204
|
def has_group_like?(group)
|
187
|
-
return
|
188
|
-
name.downcase == group.downcase
|
189
|
-
end
|
205
|
+
return !groups_by_name(group, true).empty?
|
190
206
|
end
|
191
207
|
|
192
208
|
def hilight_header(header)
|
@@ -41,11 +41,10 @@ class CopyWish < Djinni::Wish
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# Prefer exact match
|
44
|
-
entry = new_cwd.
|
44
|
+
entry = new_cwd.entries_by_title(target)[0]
|
45
|
+
|
45
46
|
# Fallback to case-insensitive match
|
46
|
-
entry ||= new_cwd.
|
47
|
-
k.downcase == target.downcase
|
48
|
-
end.values.first
|
47
|
+
entry ||= new_cwd.entries_by_title(target, true)[0]
|
49
48
|
|
50
49
|
case field
|
51
50
|
when "pass"
|
@@ -40,11 +40,10 @@ class EchoWish < Djinni::Wish
|
|
40
40
|
end
|
41
41
|
|
42
42
|
# Prefer exact match
|
43
|
-
entry = new_cwd.
|
43
|
+
entry = new_cwd.entries_by_title(target)[0]
|
44
|
+
|
44
45
|
# Fallback to case-insensitive match
|
45
|
-
entry ||= new_cwd.
|
46
|
-
k.downcase == target.downcase
|
47
|
-
end.values.first
|
46
|
+
entry ||= new_cwd.entries_by_title(target, true)[0]
|
48
47
|
|
49
48
|
case field
|
50
49
|
when "pass"
|
@@ -31,9 +31,7 @@ class ShowWish < Djinni::Wish
|
|
31
31
|
puts new_cwd
|
32
32
|
end
|
33
33
|
elsif (new_cwd.has_group_like?(target))
|
34
|
-
new_cwd.
|
35
|
-
k.downcase == target.downcase
|
36
|
-
end.values.each do |group|
|
34
|
+
new_cwd.groups_by_name(target, true).each do |group|
|
37
35
|
case djinni_env["djinni_input"]
|
38
36
|
when "showall"
|
39
37
|
puts group.details(0, true)
|
@@ -42,9 +40,7 @@ class ShowWish < Djinni::Wish
|
|
42
40
|
end
|
43
41
|
end
|
44
42
|
elsif (new_cwd.has_entry_like?(target))
|
45
|
-
new_cwd.
|
46
|
-
k.downcase == target.downcase
|
47
|
-
end.values.each do |entry|
|
43
|
+
new_cwd.entries_by_title(target, true).each do |entry|
|
48
44
|
case djinni_env["djinni_input"]
|
49
45
|
when "showall"
|
50
46
|
puts entry.details(0, true)
|