rubeepass 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1244eae333d927767643b37d6d6612800fc12a5d
4
- data.tar.gz: 3818c6ae675fa05c04df6d62466809b02eccac27
3
+ metadata.gz: 88ea712dd5f74c73236a618c5d372fecf37c5d46
4
+ data.tar.gz: a1903d7e08f34d93a6b36e1289bbe39e4299c28c
5
5
  SHA512:
6
- metadata.gz: eba9bb74e5da41f1aa2c49ac4672a7c23e459cfe31cb2ef9b1bd29e8d0fc2b8ebb32f4bf15eaf03588016768e4cd85d9b5b56d1db4db8ea4ac785d97060f697f
7
- data.tar.gz: 9bfd779dcf88b6a38358162aeb01762e6a9144a3db92771d562a5b94795a44385aa57f1b92f77ce84707df9f09be8c755baa4fc268a6c20ea9aa7e6792fbe196
6
+ metadata.gz: 4879ef2590d50c6103e2a4007fc0f954b8bb0b00eeab5a4afcab20e231e4e3254e26f6ecde3c74ea2349418f87aa0c3a1cda7fe24840261f161472b222717cbf
7
+ data.tar.gz: 71d1411ad94c214dac2aa250e4fb00e006b4892541c6d4156c3925a8f7e984117885bc3b8904786b063c9bc71c2124f29c657ff7a94ff0770162a78c3a463a69
@@ -0,0 +1,79 @@
1
+ require "djinni"
2
+ require "string"
3
+
4
+ class ShowAllWish < Djinni::Wish
5
+ def aliases
6
+ return [ "showall" ]
7
+ end
8
+
9
+ def description
10
+ return "Show group/entry contents, including passwords"
11
+ end
12
+
13
+ def execute(args, djinni_env = {})
14
+ keepass = djinni_env["keepass"]
15
+ cwd = djinni_env["cwd"]
16
+ args = cwd.path if (args.nil? || args.empty?)
17
+
18
+ args = keepass.absolute_path(args, cwd.path)
19
+ path, target = args.rsplit("/")
20
+ new_cwd = keepass.find_group(path)
21
+
22
+ if (new_cwd)
23
+ if (target.empty?)
24
+ puts new_cwd.details(0, true)
25
+ elsif (new_cwd.has_group?(target))
26
+ puts new_cwd.groups[target].details(0, true)
27
+ elsif (new_cwd.has_entry?(target))
28
+ new_cwd.entry_titles.select do |entry|
29
+ target.downcase == entry.downcase
30
+ end.each do |entry|
31
+ puts new_cwd.entries[entry].details(0, true)
32
+ end
33
+ else
34
+ puts "Group/entry \"#{args}\" doesn't exist!"
35
+ end
36
+ else
37
+ puts "Group/entry \"#{args}\" doesn't exist!"
38
+ end
39
+ end
40
+
41
+ def tab_complete(input, djinni_env = {})
42
+ cwd = djinni_env["cwd"]
43
+ input, groups, entries = cwd.fuzzy_find(input)
44
+ if (groups.empty? && entries.empty?)
45
+ return input.gsub(%r{^#{cwd.path}/?}, "")
46
+ end
47
+
48
+ path, target = input.rsplit("/")
49
+
50
+ if (target.empty?)
51
+ if ((groups.length == 1) && entries.empty?)
52
+ input = "#{path}/#{groups.first}/"
53
+ return input.gsub(%r{^#{cwd.path}/?}, "")
54
+ elsif (groups.empty? && (entries.length == 1))
55
+ input = "#{path}/#{entries.first}"
56
+ return input.gsub(%r{^#{cwd.path}/?}, "")
57
+ end
58
+ puts
59
+ groups.each do |group|
60
+ puts "#{group}/"
61
+ end
62
+ puts entries
63
+ return input.gsub(%r{^#{cwd.path}/?}, "")
64
+ end
65
+
66
+ if (!groups.empty?)
67
+ input = "#{path}/#{groups.first}/"
68
+ elsif (!entries.empty?)
69
+ input = "#{path}/#{entries.first}"
70
+ end
71
+
72
+ return input.gsub(%r{^#{cwd.path}/?}, "")
73
+ end
74
+
75
+ def usage
76
+ puts "#{aliases.join(", ")} [group|entry]"
77
+ puts "\t#{description}."
78
+ end
79
+ end
@@ -7,7 +7,7 @@ class ShowWish < Djinni::Wish
7
7
  end
8
8
 
9
9
  def description
10
- return "Show group contents"
10
+ return "Show group/entry contents"
11
11
  end
12
12
 
13
13
  def execute(args, djinni_env = {})
@@ -73,7 +73,7 @@ class ShowWish < Djinni::Wish
73
73
  end
74
74
 
75
75
  def usage
76
- puts "#{aliases.join(", ")} [group]"
76
+ puts "#{aliases.join(", ")} [group|entry]"
77
77
  puts "\t#{description}."
78
78
  end
79
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubeepass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
@@ -123,6 +123,7 @@ files:
123
123
  - lib/builtins/copy_wish.rb
124
124
  - lib/builtins/ls_wish.rb
125
125
  - lib/builtins/pwd_wish.rb
126
+ - lib/builtins/show_all_wish.rb
126
127
  - lib/builtins/show_wish.rb
127
128
  - lib/rubeepass.rb
128
129
  - lib/rubeepass/entry.rb