imp 0.2.2 → 0.2.3

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: 89aa2f96352505f2038a3824082459a3012637e6
4
- data.tar.gz: 69aeb301287ff6be0c440695f527548522d9bb38
3
+ metadata.gz: d2bc7bcb3631bd2356b37a67b77a87da17ee755c
4
+ data.tar.gz: bb9a20d78096fae067ad83a458835835af00829c
5
5
  SHA512:
6
- metadata.gz: d44f5b225fdca01fcb88678a8057fed230dfef118b986dca2d2a5f095ca8030cb98cd4634a03968bf6f9a2cde9e0e8b8c0ba6a487adfe2dcd2308abc50ff14ea
7
- data.tar.gz: f1fa1b6808134c5f6fd855fc79fb9505d83084b10f30df8e689efcb37bc83b0c4e813e18414e9787a88f59db57ff8d2dc5301e7c8ef2043eb026e3b5cfe94271
6
+ metadata.gz: 3d5a33257d7c838cd25f6bd0147af934593062d149f539280594da701af85f9d2b2b7bcd5fc4c02123eadcb63f1b1cd41bd6ddc1c7669d63387c561412329d58
7
+ data.tar.gz: 5f280e2d3a257d9f7c1a5f0992093bb4950fbb4744ef98dc122541858830b1f092e9ad6928e7387fbb39b5b494e950980054c9566d9d708e7c671a703ee30e62
data/README.md CHANGED
@@ -10,3 +10,9 @@ and copy these passwords.
10
10
  Allows working with encrypted passwords without them ever appearing on-screen
11
11
  (due to the copy functionality) as they would if using a simple encrypted
12
12
  password file, but without the bloat of larger password managers.
13
+
14
+ ##TODO
15
+
16
+ * Add builtin random password generation
17
+ * More descriptive --help message.
18
+ * Create tests. Seriously.
@@ -0,0 +1,235 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Imp
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index (I)</a> &raquo;
35
+
36
+
37
+ <span class="title">Imp</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: Imp
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/imp/ui.rb<span class="defines">,<br />
83
+ lib/imp.rb,<br /> lib/imp/tree.rb,<br /> lib/imp/util.rb,<br /> lib/imp/crypto.rb,<br /> lib/imp/commands.rb,<br /> lib/imp/encrypted_tree.rb,<br /> lib/imp/encrypted_file.rb</span>
84
+ </dd>
85
+
86
+ </dl>
87
+ <div class="clear"></div>
88
+
89
+ <h2>Overview</h2><div class="docstring">
90
+ <div class="discussion">
91
+
92
+ <p>A small and simple password manager.</p>
93
+
94
+
95
+ </div>
96
+ </div>
97
+ <div class="tags">
98
+
99
+
100
+ </div><h2>Defined Under Namespace</h2>
101
+ <p class="children">
102
+
103
+
104
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Imp/Commands.html" title="Imp::Commands (module)">Commands</a></span>, <span class='object_link'><a href="Imp/Crypto.html" title="Imp::Crypto (module)">Crypto</a></span>, <span class='object_link'><a href="Imp/UI.html" title="Imp::UI (module)">UI</a></span>, <span class='object_link'><a href="Imp/Util.html" title="Imp::Util (module)">Util</a></span>
105
+
106
+
107
+
108
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Imp/EncryptedFile.html" title="Imp::EncryptedFile (class)">EncryptedFile</a></span>, <span class='object_link'><a href="Imp/EncryptedTree.html" title="Imp::EncryptedTree (class)">EncryptedTree</a></span>, <span class='object_link'><a href="Imp/Tree.html" title="Imp::Tree (class)">Tree</a></span>
109
+
110
+
111
+ </p>
112
+
113
+ <h2>Constant Summary</h2>
114
+
115
+ <dl class="constants">
116
+
117
+ <dt id="VERSION-constant" class="">VERSION =
118
+ <div class="docstring">
119
+ <div class="discussion">
120
+
121
+ <p>The current version number.</p>
122
+
123
+
124
+ </div>
125
+ </div>
126
+ <div class="tags">
127
+
128
+
129
+ </div>
130
+ </dt>
131
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2.3</span><span class='tstring_end'>&quot;</span></span></pre></dd>
132
+
133
+ </dl>
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+ <h2>
144
+ Class Method Summary
145
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
146
+ </h2>
147
+
148
+ <ul class="summary">
149
+
150
+ <li class="public ">
151
+ <span class="summary_signature">
152
+
153
+ <a href="#main-class_method" title="main (class method)">+ (Object) <strong>main</strong> </a>
154
+
155
+
156
+
157
+ </span>
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+ <span class="summary_desc"><div class='inline'>
168
+ <p>Run the program.</p>
169
+ </div></span>
170
+
171
+ </li>
172
+
173
+
174
+ </ul>
175
+
176
+
177
+
178
+
179
+ <div id="class_method_details" class="method_details_list">
180
+ <h2>Class Method Details</h2>
181
+
182
+
183
+ <div class="method_details first">
184
+ <h3 class="signature first" id="main-class_method">
185
+
186
+ + (<tt>Object</tt>) <strong>main</strong>
187
+
188
+
189
+
190
+
191
+
192
+ </h3><div class="docstring">
193
+ <div class="discussion">
194
+
195
+ <p>Run the program.</p>
196
+
197
+
198
+ </div>
199
+ </div>
200
+ <div class="tags">
201
+
202
+
203
+ </div><table class="source_code">
204
+ <tr>
205
+ <td>
206
+ <pre class="lines">
207
+
208
+
209
+ 9
210
+ 10
211
+ 11</pre>
212
+ </td>
213
+ <td>
214
+ <pre class="code"><span class="info file"># File 'lib/imp.rb', line 9</span>
215
+
216
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_main'>main</span>
217
+ <span class='const'>UI</span><span class='period'>.</span><span class='id identifier rubyid_main'>main</span>
218
+ <span class='kw'>end</span></pre>
219
+ </td>
220
+ </tr>
221
+ </table>
222
+ </div>
223
+
224
+ </div>
225
+
226
+ </div>
227
+
228
+ <div id="footer">
229
+ Generated on Sun Nov 10 00:39:21 2013 by
230
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
231
+ 0.8.7.3 (ruby-2.0.0).
232
+ </div>
233
+
234
+ </body>
235
+ </html>
@@ -0,0 +1,1211 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Imp::Commands
8
+
9
+ &mdash; Documentation by YARD 0.8.7.3
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../';
20
+ framesUrl = "../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../_index.html">Index (C)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Imp.html" title="Imp (module)">Imp</a></span></span>
36
+ &raquo;
37
+ <span class="title">Commands</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Module: Imp::Commands
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/imp/commands.rb</dd>
83
+
84
+ </dl>
85
+ <div class="clear"></div>
86
+
87
+ <h2>Overview</h2><div class="docstring">
88
+ <div class="discussion">
89
+
90
+ <p>Contains the methods for all commands issued by the user. All commands are
91
+ executed with Commands#send</p>
92
+
93
+
94
+ </div>
95
+ </div>
96
+ <div class="tags">
97
+
98
+
99
+ </div>
100
+ <h2>Constant Summary</h2>
101
+
102
+ <dl class="constants">
103
+
104
+ <dt id="METHODS-constant" class="">METHODS =
105
+ <div class="docstring">
106
+ <div class="discussion">
107
+
108
+ <p>The signals which should be sent to this module.</p>
109
+
110
+
111
+ </div>
112
+ </div>
113
+ <div class="tags">
114
+
115
+
116
+ </div>
117
+ </dt>
118
+ <dd><pre class="code"><span class='lbracket'>[</span>
119
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>help</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
120
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>set</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
121
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>change_passwd</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
122
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>paste</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
123
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>print</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
124
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>copy</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
125
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>copy_raw</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
126
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>copyc</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
127
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>del</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
128
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>exit</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span></pre></dd>
129
+
130
+ </dl>
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <h2>
141
+ Class Method Summary
142
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
143
+ </h2>
144
+
145
+ <ul class="summary">
146
+
147
+ <li class="public ">
148
+ <span class="summary_signature">
149
+
150
+ <a href="#change_passwd-class_method" title="change_passwd (class method)">+ (Object) <strong>change_passwd</strong>(*args) </a>
151
+
152
+
153
+
154
+ </span>
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+ <span class="summary_desc"><div class='inline'>
165
+ <p>Changes the encryption password.</p>
166
+ </div></span>
167
+
168
+ </li>
169
+
170
+
171
+ <li class="public ">
172
+ <span class="summary_signature">
173
+
174
+ <a href="#copy-class_method" title="copy (class method)">+ (Object) <strong>copy</strong>(key) </a>
175
+
176
+
177
+
178
+ </span>
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+ <span class="summary_desc"><div class='inline'>
189
+ <p>Copys the value of a key onto the system clipboard.</p>
190
+ </div></span>
191
+
192
+ </li>
193
+
194
+
195
+ <li class="public ">
196
+ <span class="summary_signature">
197
+
198
+ <a href="#copy_raw-class_method" title="copy_raw (class method)">+ (Object) <strong>copy_raw</strong>(key = nil) </a>
199
+
200
+
201
+
202
+ </span>
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+ <span class="summary_desc"><div class='inline'>
213
+ <p>Copys the value of a key onto the system clipboard.</p>
214
+ </div></span>
215
+
216
+ </li>
217
+
218
+
219
+ <li class="public ">
220
+ <span class="summary_signature">
221
+
222
+ <a href="#copyc-class_method" title="copyc (class method)">+ (Object) <strong>copyc</strong>(argstr) </a>
223
+
224
+
225
+
226
+ </span>
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+ <span class="summary_desc"><div class='inline'>
237
+ <p>Copies the value of a single 1-indexed character of the value of a key to
238
+ the system clipboard.</p>
239
+ </div></span>
240
+
241
+ </li>
242
+
243
+
244
+ <li class="public ">
245
+ <span class="summary_signature">
246
+
247
+ <a href="#del-class_method" title="del (class method)">+ (Object) <strong>del</strong>(key, force = false) </a>
248
+
249
+
250
+
251
+ </span>
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+ <span class="summary_desc"><div class='inline'>
262
+ <p>Deletes a key.</p>
263
+ </div></span>
264
+
265
+ </li>
266
+
267
+
268
+ <li class="public ">
269
+ <span class="summary_signature">
270
+
271
+ <a href="#help-class_method" title="help (class method)">+ (Object) <strong>help</strong>(*args) </a>
272
+
273
+
274
+
275
+ </span>
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+ <span class="summary_desc"><div class='inline'>
286
+ <p>Prints help text.</p>
287
+ </div></span>
288
+
289
+ </li>
290
+
291
+
292
+ <li class="public ">
293
+ <span class="summary_signature">
294
+
295
+ <a href="#paste-class_method" title="paste (class method)">+ (Object) <strong>paste</strong>(key) </a>
296
+
297
+
298
+
299
+ </span>
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+ <span class="summary_desc"><div class='inline'>
310
+ <p>Sets a value from the system clipboard.</p>
311
+ </div></span>
312
+
313
+ </li>
314
+
315
+
316
+ <li class="public ">
317
+ <span class="summary_signature">
318
+
319
+ <a href="#print-class_method" title="print (class method)">+ (Object) <strong>print</strong>(key = nil) </a>
320
+
321
+
322
+
323
+ </span>
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+ <span class="summary_desc"><div class='inline'>
334
+ <p>Prints either the tree if no argument is provided, or prints the value of a
335
+ certain key.</p>
336
+ </div></span>
337
+
338
+ </li>
339
+
340
+
341
+ <li class="public ">
342
+ <span class="summary_signature">
343
+
344
+ <a href="#quit-class_method" title="quit (class method)">+ (Object) <strong>quit</strong>(*args) </a>
345
+
346
+
347
+
348
+ </span>
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+ <span class="summary_desc"><div class='inline'>
359
+ <p>Quits.</p>
360
+ </div></span>
361
+
362
+ </li>
363
+
364
+
365
+ <li class="public ">
366
+ <span class="summary_signature">
367
+
368
+ <a href="#set-class_method" title="set (class method)">+ (Object) <strong>set</strong>(key) </a>
369
+
370
+
371
+
372
+ </span>
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+ <span class="summary_desc"><div class='inline'>
383
+ <p>Set a value.</p>
384
+ </div></span>
385
+
386
+ </li>
387
+
388
+
389
+ </ul>
390
+
391
+
392
+
393
+
394
+ <div id="class_method_details" class="method_details_list">
395
+ <h2>Class Method Details</h2>
396
+
397
+
398
+ <div class="method_details first">
399
+ <h3 class="signature first" id="change_passwd-class_method">
400
+
401
+ + (<tt>Object</tt>) <strong>change_passwd</strong>(*args)
402
+
403
+
404
+
405
+
406
+
407
+ </h3><div class="docstring">
408
+ <div class="discussion">
409
+
410
+ <p>Changes the encryption password.</p>
411
+
412
+
413
+ </div>
414
+ </div>
415
+ <div class="tags">
416
+ <p class="tag_title">Parameters:</p>
417
+ <ul class="param">
418
+
419
+ <li>
420
+
421
+ <span class='name'>args</span>
422
+
423
+
424
+ <span class='type'>(<tt>Array</tt>)</span>
425
+
426
+
427
+
428
+ &mdash;
429
+ <div class='inline'>
430
+ <p>Ignored.</p>
431
+ </div>
432
+
433
+ </li>
434
+
435
+ </ul>
436
+
437
+
438
+ </div><table class="source_code">
439
+ <tr>
440
+ <td>
441
+ <pre class="lines">
442
+
443
+
444
+ 104
445
+ 105
446
+ 106
447
+ 107
448
+ 108
449
+ 109</pre>
450
+ </td>
451
+ <td>
452
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 104</span>
453
+
454
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_change_passwd'>change_passwd</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
455
+ <span class='id identifier rubyid_pass'>pass</span> <span class='op'>=</span> <span class='const'>Util</span><span class='period'>.</span><span class='id identifier rubyid_read_passwd'>read_passwd</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>password for file &#39;</span><span class='embexpr_beg'>#{</span><span class='gvar'>$file</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
456
+ <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_pass'>pass</span>
457
+ <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_password'>password</span> <span class='op'>=</span> <span class='id identifier rubyid_pass'>pass</span>
458
+ <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
459
+ <span class='kw'>end</span></pre>
460
+ </td>
461
+ </tr>
462
+ </table>
463
+ </div>
464
+
465
+ <div class="method_details ">
466
+ <h3 class="signature " id="copy-class_method">
467
+
468
+ + (<tt>Object</tt>) <strong>copy</strong>(key)
469
+
470
+
471
+
472
+
473
+
474
+ </h3><div class="docstring">
475
+ <div class="discussion">
476
+
477
+ <p>Copys the value of a key onto the system clipboard. And auto-clears it
478
+ afterwards.</p>
479
+
480
+
481
+ </div>
482
+ </div>
483
+ <div class="tags">
484
+ <p class="tag_title">Parameters:</p>
485
+ <ul class="param">
486
+
487
+ <li>
488
+
489
+ <span class='name'>key</span>
490
+
491
+
492
+ <span class='type'>(<tt>String</tt>)</span>
493
+
494
+
495
+
496
+ &mdash;
497
+ <div class='inline'>
498
+ <p>The key of the value to copy.</p>
499
+ </div>
500
+
501
+ </li>
502
+
503
+ </ul>
504
+
505
+
506
+ </div><table class="source_code">
507
+ <tr>
508
+ <td>
509
+ <pre class="lines">
510
+
511
+
512
+ 158
513
+ 159
514
+ 160
515
+ 161
516
+ 162
517
+ 163
518
+ 164
519
+ 165
520
+ 166
521
+ 167
522
+ 168
523
+ 169</pre>
524
+ </td>
525
+ <td>
526
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 158</span>
527
+
528
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
529
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Key must be supplied.</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span>
530
+ <span class='kw'>begin</span>
531
+ <span class='const'>UI</span><span class='period'>.</span><span class='id identifier rubyid_timeout'>timeout</span> <span class='kw'>do</span>
532
+ <span class='id identifier rubyid_copy_raw'>copy_raw</span> <span class='id identifier rubyid_key'>key</span>
533
+ <span class='gvar'>$stdout</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Value copied. Press enter to wipe...</span><span class='tstring_end'>&quot;</span></span>
534
+ <span class='id identifier rubyid_gets'>gets</span>
535
+ <span class='kw'>end</span>
536
+ <span class='kw'>ensure</span>
537
+ <span class='const'>Clipboard</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
538
+ <span class='kw'>end</span>
539
+ <span class='kw'>end</span></pre>
540
+ </td>
541
+ </tr>
542
+ </table>
543
+ </div>
544
+
545
+ <div class="method_details ">
546
+ <h3 class="signature " id="copy_raw-class_method">
547
+
548
+ + (<tt>Object</tt>) <strong>copy_raw</strong>(key = nil)
549
+
550
+
551
+
552
+
553
+
554
+ </h3><div class="docstring">
555
+ <div class="discussion">
556
+
557
+ <p>Copys the value of a key onto the system clipboard.</p>
558
+
559
+
560
+ </div>
561
+ </div>
562
+ <div class="tags">
563
+ <p class="tag_title">Parameters:</p>
564
+ <ul class="param">
565
+
566
+ <li>
567
+
568
+ <span class='name'>key</span>
569
+
570
+
571
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
572
+
573
+
574
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
575
+
576
+
577
+ &mdash;
578
+ <div class='inline'>
579
+ <p>The key of the value to copy. If nil, clears the clipboard instead.</p>
580
+ </div>
581
+
582
+ </li>
583
+
584
+ </ul>
585
+
586
+
587
+ </div><table class="source_code">
588
+ <tr>
589
+ <td>
590
+ <pre class="lines">
591
+
592
+
593
+ 140
594
+ 141
595
+ 142
596
+ 143
597
+ 144
598
+ 145
599
+ 146
600
+ 147
601
+ 148
602
+ 149
603
+ 150
604
+ 151
605
+ 152</pre>
606
+ </td>
607
+ <td>
608
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 140</span>
609
+
610
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_copy_raw'>copy_raw</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
611
+ <span class='kw'>begin</span>
612
+ <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span>
613
+ <span class='const'>Clipboard</span><span class='period'>.</span><span class='id identifier rubyid_copy'>copy</span><span class='lparen'>(</span><span class='gvar'>$tree</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='rparen'>)</span>
614
+ <span class='kw'>else</span>
615
+ <span class='const'>Clipboard</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
616
+ <span class='kw'>end</span>
617
+ <span class='comment'># No method error arises from trying to work on a nil tree (or trying to
618
+ </span> <span class='comment'># decrypt a nil value).
619
+ </span> <span class='kw'>rescue</span> <span class='const'>NoMethodError</span>
620
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No value entered for key &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;.</span><span class='tstring_end'>&quot;</span></span>
621
+ <span class='kw'>end</span>
622
+ <span class='kw'>end</span></pre>
623
+ </td>
624
+ </tr>
625
+ </table>
626
+ </div>
627
+
628
+ <div class="method_details ">
629
+ <h3 class="signature " id="copyc-class_method">
630
+
631
+ + (<tt>Object</tt>) <strong>copyc</strong>(argstr)
632
+
633
+
634
+
635
+
636
+
637
+ </h3><div class="docstring">
638
+ <div class="discussion">
639
+
640
+ <p>Copies the value of a single 1-indexed character of the value of a key to
641
+ the system clipboard.</p>
642
+
643
+
644
+ </div>
645
+ </div>
646
+ <div class="tags">
647
+ <p class="tag_title">Parameters:</p>
648
+ <ul class="param">
649
+
650
+ <li>
651
+
652
+ <span class='name'>argstr</span>
653
+
654
+
655
+ <span class='type'>(<tt>String</tt>)</span>
656
+
657
+
658
+
659
+ &mdash;
660
+ <div class='inline'>
661
+ <p>The index to copy followed by the key, seperated by whitespace.</p>
662
+ </div>
663
+
664
+ </li>
665
+
666
+ </ul>
667
+
668
+
669
+ </div><table class="source_code">
670
+ <tr>
671
+ <td>
672
+ <pre class="lines">
673
+
674
+
675
+ 176
676
+ 177
677
+ 178
678
+ 179
679
+ 180</pre>
680
+ </td>
681
+ <td>
682
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 176</span>
683
+
684
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_copyc'>copyc</span><span class='lparen'>(</span><span class='id identifier rubyid_argstr'>argstr</span><span class='rparen'>)</span>
685
+ <span class='id identifier rubyid_pos'>pos</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_argstr'>argstr</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span>
686
+ <span class='id identifier rubyid_pos'>pos</span> <span class='op'>=</span> <span class='id identifier rubyid_pos'>pos</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
687
+ <span class='id identifier rubyid_copyc_expanded'>copyc_expanded</span><span class='lparen'>(</span><span class='id identifier rubyid_char'>char</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
688
+ <span class='kw'>end</span></pre>
689
+ </td>
690
+ </tr>
691
+ </table>
692
+ </div>
693
+
694
+ <div class="method_details ">
695
+ <h3 class="signature " id="del-class_method">
696
+
697
+ + (<tt>Object</tt>) <strong>del</strong>(key, force = false)
698
+
699
+
700
+
701
+
702
+
703
+ </h3><div class="docstring">
704
+ <div class="discussion">
705
+
706
+ <p>Deletes a key. If the key has no children, it is removed from the tree. If
707
+ it has children, it is removed from the tree if and only if it&#39;s value
708
+ was previously nil. Otherwise it&#39;s value is set to nil.</p>
709
+
710
+
711
+ </div>
712
+ </div>
713
+ <div class="tags">
714
+ <p class="tag_title">Parameters:</p>
715
+ <ul class="param">
716
+
717
+ <li>
718
+
719
+ <span class='name'>key</span>
720
+
721
+
722
+ <span class='type'>(<tt>String</tt>)</span>
723
+
724
+
725
+
726
+ &mdash;
727
+ <div class='inline'>
728
+ <p>The key to delete.</p>
729
+ </div>
730
+
731
+ </li>
732
+
733
+ <li>
734
+
735
+ <span class='name'>force</span>
736
+
737
+
738
+ <span class='type'>(<tt>Boolean</tt>)</span>
739
+
740
+
741
+ <em class="default">(defaults to: <tt>false</tt>)</em>
742
+
743
+
744
+ &mdash;
745
+ <div class='inline'>
746
+ <p>Doesn&#39;t require confirmation from the user if it is true.</p>
747
+ </div>
748
+
749
+ </li>
750
+
751
+ </ul>
752
+
753
+
754
+ </div><table class="source_code">
755
+ <tr>
756
+ <td>
757
+ <pre class="lines">
758
+
759
+
760
+ 33
761
+ 34
762
+ 35
763
+ 36
764
+ 37
765
+ 38
766
+ 39
767
+ 40
768
+ 41
769
+ 42
770
+ 43
771
+ 44
772
+ 45
773
+ 46
774
+ 47
775
+ 48
776
+ 49
777
+ 50</pre>
778
+ </td>
779
+ <td>
780
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 33</span>
781
+
782
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_del'>del</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_force'>force</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
783
+ <span class='kw'>unless</span> <span class='id identifier rubyid_force'>force</span> <span class='op'>||</span>
784
+ <span class='id identifier rubyid_agree'>agree</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Are you sure you want to delete the key &#39;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;? </span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
785
+ <span class='kw'>return</span>
786
+ <span class='kw'>end</span>
787
+ <span class='id identifier rubyid_node'>node</span> <span class='op'>=</span> <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_cont'>cont</span><span class='period'>.</span><span class='id identifier rubyid_descendant'>descendant</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
788
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Key does not exist.</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span> <span class='op'>==</span> <span class='kw'>nil</span>
789
+
790
+ <span class='kw'>if</span> <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='op'>==</span> <span class='kw'>nil</span>
791
+ <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span> <span class='id identifier rubyid_key'>key</span>
792
+ <span class='kw'>else</span>
793
+ <span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='op'>=</span> <span class='kw'>nil</span>
794
+ <span class='kw'>end</span>
795
+ <span class='comment'># Remove any nil-leaves. (This may remove key IF it is a leaf)
796
+ </span> <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_prune'>prune</span>
797
+ <span class='comment'># Write out the tree.
798
+ </span> <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
799
+ <span class='kw'>end</span></pre>
800
+ </td>
801
+ </tr>
802
+ </table>
803
+ </div>
804
+
805
+ <div class="method_details ">
806
+ <h3 class="signature " id="help-class_method">
807
+
808
+ + (<tt>Object</tt>) <strong>help</strong>(*args)
809
+
810
+
811
+
812
+
813
+
814
+ </h3><div class="docstring">
815
+ <div class="discussion">
816
+
817
+ <p>Prints help text.</p>
818
+
819
+
820
+ </div>
821
+ </div>
822
+ <div class="tags">
823
+ <p class="tag_title">Parameters:</p>
824
+ <ul class="param">
825
+
826
+ <li>
827
+
828
+ <span class='name'>args</span>
829
+
830
+
831
+ <span class='type'>(<tt>Array</tt>)</span>
832
+
833
+
834
+
835
+ &mdash;
836
+ <div class='inline'>
837
+ <p>Ignored.</p>
838
+ </div>
839
+
840
+ </li>
841
+
842
+ </ul>
843
+
844
+
845
+ </div><table class="source_code">
846
+ <tr>
847
+ <td>
848
+ <pre class="lines">
849
+
850
+
851
+ 55
852
+ 56
853
+ 57
854
+ 58
855
+ 59
856
+ 60
857
+ 61
858
+ 62
859
+ 63
860
+ 64
861
+ 65
862
+ 66
863
+ 67
864
+ 68
865
+ 69
866
+ 70
867
+ 71
868
+ 72
869
+ 73
870
+ 74
871
+ 75
872
+ 76
873
+ 77
874
+ 78
875
+ 79
876
+ 80
877
+ 81
878
+ 82
879
+ 83
880
+ 84
881
+ 85
882
+ 86
883
+ 87</pre>
884
+ </td>
885
+ <td>
886
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 55</span>
887
+
888
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_help'>help</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
889
+ <span class='id identifier rubyid_puts'>puts</span> <span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>
890
+ help - Prints this help text
891
+ set KEY - Sets the value of the key to a value entered by the user.
892
+ change_passwd - Changes the password of the current file.
893
+ paste KEY - Sets the value of the key from the system clipboard.
894
+ print - Prints a representation of the tree, without values.
895
+ print KEY - Prints the value of the key.
896
+ copy KEY - Copies the value of the key, auto clears clipboard afterward.
897
+ copy_raw - Clears the clipboard.
898
+ copy_raw KEY - Copies the value of a key, without clearing the clipboard.
899
+ Useful for moving values around between keys.
900
+ copyc INT KEY - Copies the (1-indexed) character from the value of the key.
901
+ del KEY - Deletes the key from the tree. If it has subtrees, the
902
+ subtrees get deleted if and only if the key had no value.
903
+ exit - Exit.
904
+
905
+ Keys are sorted in forward-slash seperated tree structure (slightly
906
+ remenicient of urls). E.g. in a tree structure like
907
+
908
+ some/
909
+ long/
910
+ path
911
+ other/
912
+ path
913
+
914
+ &#39;some/long/path&#39; would be a valid key.
915
+
916
+ Nodes can also have values, so path &#39;some/long/path&#39; and &#39;some/long&#39; can both
917
+ have values assigned to them.
918
+
919
+ Nodes are automatically created and destroyed as needed.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
920
+ <span class='kw'>end</span></pre>
921
+ </td>
922
+ </tr>
923
+ </table>
924
+ </div>
925
+
926
+ <div class="method_details ">
927
+ <h3 class="signature " id="paste-class_method">
928
+
929
+ + (<tt>Object</tt>) <strong>paste</strong>(key)
930
+
931
+
932
+
933
+
934
+
935
+ </h3><div class="docstring">
936
+ <div class="discussion">
937
+
938
+ <p>Sets a value from the system clipboard. Fails if the clipboard is empty.</p>
939
+
940
+
941
+ </div>
942
+ </div>
943
+ <div class="tags">
944
+ <p class="tag_title">Parameters:</p>
945
+ <ul class="param">
946
+
947
+ <li>
948
+
949
+ <span class='name'>key</span>
950
+
951
+
952
+ <span class='type'>(<tt>String</tt>)</span>
953
+
954
+
955
+
956
+ &mdash;
957
+ <div class='inline'>
958
+ <p>The key to set.</p>
959
+ </div>
960
+
961
+ </li>
962
+
963
+ </ul>
964
+
965
+
966
+ </div><table class="source_code">
967
+ <tr>
968
+ <td>
969
+ <pre class="lines">
970
+
971
+
972
+ 128
973
+ 129
974
+ 130
975
+ 131
976
+ 132
977
+ 133
978
+ 134</pre>
979
+ </td>
980
+ <td>
981
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 128</span>
982
+
983
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_paste'>paste</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
984
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Key must be supplied.</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span>
985
+ <span class='id identifier rubyid_pass'>pass</span> <span class='op'>=</span> <span class='const'>Clipboard</span><span class='period'>.</span><span class='id identifier rubyid_paste'>paste</span>
986
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Clipboard empty, could not paste.</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_pass'>pass</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
987
+ <span class='gvar'>$tree</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_pass'>pass</span>
988
+ <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
989
+ <span class='kw'>end</span></pre>
990
+ </td>
991
+ </tr>
992
+ </table>
993
+ </div>
994
+
995
+ <div class="method_details ">
996
+ <h3 class="signature " id="print-class_method">
997
+
998
+ + (<tt>Object</tt>) <strong>print</strong>(key = nil)
999
+
1000
+
1001
+
1002
+
1003
+
1004
+ </h3><div class="docstring">
1005
+ <div class="discussion">
1006
+
1007
+ <p>Prints either the tree if no argument is provided, or prints the value of a
1008
+ certain key.</p>
1009
+
1010
+
1011
+ </div>
1012
+ </div>
1013
+ <div class="tags">
1014
+ <p class="tag_title">Parameters:</p>
1015
+ <ul class="param">
1016
+
1017
+ <li>
1018
+
1019
+ <span class='name'>key</span>
1020
+
1021
+
1022
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
1023
+
1024
+
1025
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1026
+
1027
+
1028
+ &mdash;
1029
+ <div class='inline'>
1030
+ <p>The key if provided, or nil to print the tree.</p>
1031
+ </div>
1032
+
1033
+ </li>
1034
+
1035
+ </ul>
1036
+
1037
+
1038
+ </div><table class="source_code">
1039
+ <tr>
1040
+ <td>
1041
+ <pre class="lines">
1042
+
1043
+
1044
+ 93
1045
+ 94
1046
+ 95
1047
+ 96
1048
+ 97
1049
+ 98
1050
+ 99</pre>
1051
+ </td>
1052
+ <td>
1053
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 93</span>
1054
+
1055
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
1056
+ <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span>
1057
+ <span class='id identifier rubyid_print_val'>print_val</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1058
+ <span class='kw'>else</span>
1059
+ <span class='id identifier rubyid_print_tree'>print_tree</span>
1060
+ <span class='kw'>end</span>
1061
+ <span class='kw'>end</span></pre>
1062
+ </td>
1063
+ </tr>
1064
+ </table>
1065
+ </div>
1066
+
1067
+ <div class="method_details ">
1068
+ <h3 class="signature " id="quit-class_method">
1069
+
1070
+ + (<tt>Object</tt>) <strong>quit</strong>(*args)
1071
+
1072
+
1073
+
1074
+
1075
+
1076
+ </h3><div class="docstring">
1077
+ <div class="discussion">
1078
+
1079
+ <p>Quits.</p>
1080
+
1081
+
1082
+ </div>
1083
+ </div>
1084
+ <div class="tags">
1085
+ <p class="tag_title">Parameters:</p>
1086
+ <ul class="param">
1087
+
1088
+ <li>
1089
+
1090
+ <span class='name'>args</span>
1091
+
1092
+
1093
+ <span class='type'>(<tt>Array</tt>)</span>
1094
+
1095
+
1096
+
1097
+ &mdash;
1098
+ <div class='inline'>
1099
+ <p>Ignored.</p>
1100
+ </div>
1101
+
1102
+ </li>
1103
+
1104
+ </ul>
1105
+
1106
+
1107
+ </div><table class="source_code">
1108
+ <tr>
1109
+ <td>
1110
+ <pre class="lines">
1111
+
1112
+
1113
+ 185
1114
+ 186
1115
+ 187</pre>
1116
+ </td>
1117
+ <td>
1118
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 185</span>
1119
+
1120
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_quit'>quit</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
1121
+ <span class='id identifier rubyid_exit'>exit</span>
1122
+ <span class='kw'>end</span></pre>
1123
+ </td>
1124
+ </tr>
1125
+ </table>
1126
+ </div>
1127
+
1128
+ <div class="method_details ">
1129
+ <h3 class="signature " id="set-class_method">
1130
+
1131
+ + (<tt>Object</tt>) <strong>set</strong>(key)
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+ </h3><div class="docstring">
1138
+ <div class="discussion">
1139
+
1140
+ <p>Set a value. Require entering the value to set it to twice until they
1141
+ match. An empty value will cancel setting.</p>
1142
+
1143
+
1144
+ </div>
1145
+ </div>
1146
+ <div class="tags">
1147
+ <p class="tag_title">Parameters:</p>
1148
+ <ul class="param">
1149
+
1150
+ <li>
1151
+
1152
+ <span class='name'>key</span>
1153
+
1154
+
1155
+ <span class='type'>(<tt>String</tt>)</span>
1156
+
1157
+
1158
+
1159
+ &mdash;
1160
+ <div class='inline'>
1161
+ <p>The key to set the value for.</p>
1162
+ </div>
1163
+
1164
+ </li>
1165
+
1166
+ </ul>
1167
+
1168
+
1169
+ </div><table class="source_code">
1170
+ <tr>
1171
+ <td>
1172
+ <pre class="lines">
1173
+
1174
+
1175
+ 115
1176
+ 116
1177
+ 117
1178
+ 118
1179
+ 119
1180
+ 120
1181
+ 121
1182
+ 122</pre>
1183
+ </td>
1184
+ <td>
1185
+ <pre class="code"><span class="info file"># File 'lib/imp/commands.rb', line 115</span>
1186
+
1187
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_set'>set</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
1188
+ <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Key must be supplied.</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span>
1189
+ <span class='id identifier rubyid_pass'>pass</span> <span class='op'>=</span> <span class='const'>Util</span><span class='period'>.</span><span class='id identifier rubyid_read_passwd'>read_passwd</span>
1190
+ <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_pass'>pass</span>
1191
+ <span class='gvar'>$tree</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_pass'>pass</span>
1192
+ <span class='comment'># We save the tree whenever it is modified.
1193
+ </span> <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
1194
+ <span class='kw'>end</span></pre>
1195
+ </td>
1196
+ </tr>
1197
+ </table>
1198
+ </div>
1199
+
1200
+ </div>
1201
+
1202
+ </div>
1203
+
1204
+ <div id="footer">
1205
+ Generated on Sun Nov 10 00:39:21 2013 by
1206
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1207
+ 0.8.7.3 (ruby-2.0.0).
1208
+ </div>
1209
+
1210
+ </body>
1211
+ </html>