shh 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +19 -2
  2. data/lib/shh/entry_menu.rb +20 -0
  3. metadata +3 -3
data/README.rdoc CHANGED
@@ -68,6 +68,7 @@ This mode allows you to view (but not edit) an existing entry
68
68
  * view <key> - view entry value on screen
69
69
  * copy <key> - copy entry value to clipboard
70
70
  * launch <key> - launch entry value in default browser (available if it starts with http)
71
+ * run <key> - execute ruby script (available if it starts with #!/usr/bin/env ruby)
71
72
  * quit
72
73
 
73
74
  == Editing mode
@@ -88,9 +89,25 @@ This mode is viewing mode plus some editing commands
88
89
 
89
90
  You don't want to be a quitter
90
91
 
92
+ == Scripting
93
+
94
+ In a script the following objects are available:
95
+
96
+ * splat.clipboard = <text> - allows content to be copied to the clipboard
97
+ * splat.browser - a watir compatible browser
98
+ * hash - the current selected entry
99
+
100
+ Example:
101
+
102
+ browser = splat.browser
103
+ browser.goto 'http://www.github.com/login'
104
+ browser.text_field(:id, 'login_field').set hash['username']
105
+ browser.text_field(:id, 'password').set hash['password']
106
+ browser.button(:name, 'commit').click
107
+
91
108
  = Future plans for world domination
92
109
 
93
110
  * Add some color
94
111
  * Add help
95
- * Include uuid as part of encryption key (and upgrade encryption on existing entries)
96
- * add some source control (hg/git) commands
112
+ * add some source control (hg/git) commands
113
+ * add commands for displaying history of entries
@@ -31,6 +31,10 @@ module Shh
31
31
  delete $1
32
32
  when /^view (.*)/
33
33
  view $1
34
+ when /^run (.*)/
35
+ run $1
36
+ else
37
+ puts "I can't imagine what you mean by that"
34
38
  end
35
39
  end
36
40
  rescue Interrupt => e
@@ -50,6 +54,10 @@ private
50
54
  @splat.supported? and @hash[key] =~ /^http/
51
55
  end
52
56
 
57
+ def can_run? key
58
+ @splat.supported? and @hash[key] =~ /^#!\/usr\/bin\/env ruby/
59
+ end
60
+
53
61
  def view key
54
62
  say(@hash[key]) if @hash[key]
55
63
  end
@@ -58,6 +66,17 @@ private
58
66
  @splat.clipboard = @hash[key]
59
67
  end
60
68
 
69
+ def run key
70
+ begin
71
+ hash = @hash
72
+ splat = @splat
73
+ eval @hash[key]
74
+ rescue Exception => e
75
+ puts e.message
76
+ e.backtrace.each {|t| puts " > #{t}" }
77
+ end
78
+ end
79
+
61
80
  def set key
62
81
  if can_edit?
63
82
  set_value key
@@ -92,6 +111,7 @@ private
92
111
  commands << "view #{key}"
93
112
  commands << "copy #{key}" if @splat.supported?
94
113
  commands << "launch #{key}" if can_launch?(key)
114
+ commands << "run #{key}" if can_run?(key)
95
115
  end
96
116
  Readline.completion_proc = lambda do |text|
97
117
  commands.grep( /^#{Regexp.escape(text)}/ ).sort
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Ryall
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-31 00:00:00 +11:00
12
+ date: 2010-02-06 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ~>
62
62
  - !ruby/object:Gem::Version
63
- version: 0.0.1
63
+ version: 0.0.2
64
64
  version:
65
65
  description: |
66
66
  A command line utility that manages accounts and passwords as individual encypted files