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.
@@ -0,0 +1,1086 @@
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: PasswdManage::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="../PasswdManage.html" title="PasswdManage (module)">PasswdManage</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: PasswdManage::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/passwd_manage/ui.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'>copyc</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'>del</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'>exit</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span></pre></dd>
128
+
129
+ </dl>
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+ <h2>
140
+ Class Method Summary
141
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
142
+ </h2>
143
+
144
+ <ul class="summary">
145
+
146
+ <li class="public ">
147
+ <span class="summary_signature">
148
+
149
+ <a href="#change_passwd-class_method" title="change_passwd (class method)">+ (Object) <strong>change_passwd</strong>(*args) </a>
150
+
151
+
152
+
153
+ </span>
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+ <span class="summary_desc"><div class='inline'>
164
+ <p>Changes the encryption password.</p>
165
+ </div></span>
166
+
167
+ </li>
168
+
169
+
170
+ <li class="public ">
171
+ <span class="summary_signature">
172
+
173
+ <a href="#copy-class_method" title="copy (class method)">+ (Object) <strong>copy</strong>(key = nil) </a>
174
+
175
+
176
+
177
+ </span>
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+ <span class="summary_desc"><div class='inline'>
188
+ <p>Copys the value of a key onto the system clipboard.</p>
189
+ </div></span>
190
+
191
+ </li>
192
+
193
+
194
+ <li class="public ">
195
+ <span class="summary_signature">
196
+
197
+ <a href="#copyc-class_method" title="copyc (class method)">+ (Object) <strong>copyc</strong>(argstr) </a>
198
+
199
+
200
+
201
+ </span>
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ <span class="summary_desc"><div class='inline'>
212
+ <p>Copies the value of a single 1-indexed character of the value of a key to
213
+ 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="#del-class_method" title="del (class method)">+ (Object) <strong>del</strong>(key, force = false) </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>Deletes a key.</p>
238
+ </div></span>
239
+
240
+ </li>
241
+
242
+
243
+ <li class="public ">
244
+ <span class="summary_signature">
245
+
246
+ <a href="#help-class_method" title="help (class method)">+ (Object) <strong>help</strong>(*args) </a>
247
+
248
+
249
+
250
+ </span>
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+ <span class="summary_desc"><div class='inline'>
261
+ <p>Prints help text.</p>
262
+ </div></span>
263
+
264
+ </li>
265
+
266
+
267
+ <li class="public ">
268
+ <span class="summary_signature">
269
+
270
+ <a href="#paste-class_method" title="paste (class method)">+ (Object) <strong>paste</strong>(key) </a>
271
+
272
+
273
+
274
+ </span>
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+ <span class="summary_desc"><div class='inline'>
285
+ <p>Sets a value from the system clipboard.</p>
286
+ </div></span>
287
+
288
+ </li>
289
+
290
+
291
+ <li class="public ">
292
+ <span class="summary_signature">
293
+
294
+ <a href="#print-class_method" title="print (class method)">+ (Object) <strong>print</strong>(key = nil) </a>
295
+
296
+
297
+
298
+ </span>
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+
308
+ <span class="summary_desc"><div class='inline'>
309
+ <p>Prints either the tree if no argument is provided, or prints the value of a
310
+ certain key.</p>
311
+ </div></span>
312
+
313
+ </li>
314
+
315
+
316
+ <li class="public ">
317
+ <span class="summary_signature">
318
+
319
+ <a href="#quit-class_method" title="quit (class method)">+ (Object) <strong>quit</strong>(*args) </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>Quits.</p>
335
+ </div></span>
336
+
337
+ </li>
338
+
339
+
340
+ <li class="public ">
341
+ <span class="summary_signature">
342
+
343
+ <a href="#set-class_method" title="set (class method)">+ (Object) <strong>set</strong>(key) </a>
344
+
345
+
346
+
347
+ </span>
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+ <span class="summary_desc"><div class='inline'>
358
+ <p>Set a value.</p>
359
+ </div></span>
360
+
361
+ </li>
362
+
363
+
364
+ </ul>
365
+
366
+
367
+
368
+
369
+ <div id="class_method_details" class="method_details_list">
370
+ <h2>Class Method Details</h2>
371
+
372
+
373
+ <div class="method_details first">
374
+ <h3 class="signature first" id="change_passwd-class_method">
375
+
376
+ + (<tt>Object</tt>) <strong>change_passwd</strong>(*args)
377
+
378
+
379
+
380
+
381
+
382
+ </h3><div class="docstring">
383
+ <div class="discussion">
384
+
385
+ <p>Changes the encryption password.</p>
386
+
387
+
388
+ </div>
389
+ </div>
390
+ <div class="tags">
391
+ <p class="tag_title">Parameters:</p>
392
+ <ul class="param">
393
+
394
+ <li>
395
+
396
+ <span class='name'>args</span>
397
+
398
+
399
+ <span class='type'>(<tt>Array</tt>)</span>
400
+
401
+
402
+
403
+ &mdash;
404
+ <div class='inline'>
405
+ <p>Ignored.</p>
406
+ </div>
407
+
408
+ </li>
409
+
410
+ </ul>
411
+
412
+
413
+ </div><table class="source_code">
414
+ <tr>
415
+ <td>
416
+ <pre class="lines">
417
+
418
+
419
+ 275
420
+ 276
421
+ 277
422
+ 278
423
+ 279
424
+ 280</pre>
425
+ </td>
426
+ <td>
427
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 275</span>
428
+
429
+ <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>
430
+ <span class='id identifier rubyid_pass'>pass</span> <span class='op'>=</span> <span class='id identifier rubyid_read_passwd'>read_passwd</span>
431
+ <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_pass'>pass</span>
432
+ <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>
433
+ <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
434
+ <span class='kw'>end</span></pre>
435
+ </td>
436
+ </tr>
437
+ </table>
438
+ </div>
439
+
440
+ <div class="method_details ">
441
+ <h3 class="signature " id="copy-class_method">
442
+
443
+ + (<tt>Object</tt>) <strong>copy</strong>(key = nil)
444
+
445
+
446
+
447
+
448
+
449
+ </h3><div class="docstring">
450
+ <div class="discussion">
451
+
452
+ <p>Copys the value of a key onto the system clipboard. et</p>
453
+
454
+
455
+ </div>
456
+ </div>
457
+ <div class="tags">
458
+ <p class="tag_title">Parameters:</p>
459
+ <ul class="param">
460
+
461
+ <li>
462
+
463
+ <span class='name'>key</span>
464
+
465
+
466
+ <span class='type'>(<tt>String</tt>)</span>
467
+
468
+
469
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
470
+
471
+
472
+ &mdash;
473
+ <div class='inline'>
474
+ <p>The key of the value to copy. If nil, clears the clipboard instead.</p>
475
+ </div>
476
+
477
+ </li>
478
+
479
+ </ul>
480
+
481
+
482
+ </div><table class="source_code">
483
+ <tr>
484
+ <td>
485
+ <pre class="lines">
486
+
487
+
488
+ 311
489
+ 312
490
+ 313
491
+ 314
492
+ 315
493
+ 316
494
+ 317
495
+ 318
496
+ 319
497
+ 320
498
+ 321
499
+ 322
500
+ 323
501
+ 324
502
+ 325
503
+ 326</pre>
504
+ </td>
505
+ <td>
506
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 311</span>
507
+
508
+ <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='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
509
+ <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>
510
+ <span class='kw'>begin</span>
511
+ <span class='const'>UI</span><span class='period'>.</span><span class='id identifier rubyid_timeout'>timeout</span> <span class='kw'>do</span>
512
+ <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>
513
+ <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'>Copy copied. Press enter to wipe...</span><span class='tstring_end'>&quot;</span></span>
514
+ <span class='id identifier rubyid_gets'>gets</span>
515
+ <span class='kw'>end</span>
516
+ <span class='comment'># No method error arises from trying to work on a nil tree (or trying to
517
+ </span> <span class='comment'># decrypt a nil value).
518
+ </span> <span class='kw'>rescue</span> <span class='const'>NoMethodError</span>
519
+ <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>
520
+ <span class='kw'>ensure</span>
521
+ <span class='const'>Clipboard</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
522
+ <span class='kw'>end</span>
523
+ <span class='kw'>end</span></pre>
524
+ </td>
525
+ </tr>
526
+ </table>
527
+ </div>
528
+
529
+ <div class="method_details ">
530
+ <h3 class="signature " id="copyc-class_method">
531
+
532
+ + (<tt>Object</tt>) <strong>copyc</strong>(argstr)
533
+
534
+
535
+
536
+
537
+
538
+ </h3><div class="docstring">
539
+ <div class="discussion">
540
+
541
+ <p>Copies the value of a single 1-indexed character of the value of a key to
542
+ the system clipboard.</p>
543
+
544
+
545
+ </div>
546
+ </div>
547
+ <div class="tags">
548
+ <p class="tag_title">Parameters:</p>
549
+ <ul class="param">
550
+
551
+ <li>
552
+
553
+ <span class='name'>argstr</span>
554
+
555
+
556
+ <span class='type'>(<tt>String</tt>)</span>
557
+
558
+
559
+
560
+ &mdash;
561
+ <div class='inline'>
562
+ <p>The index to copy followed by the key, seperated by whitespace.</p>
563
+ </div>
564
+
565
+ </li>
566
+
567
+ </ul>
568
+
569
+
570
+ </div><table class="source_code">
571
+ <tr>
572
+ <td>
573
+ <pre class="lines">
574
+
575
+
576
+ 333
577
+ 334
578
+ 335
579
+ 336
580
+ 337</pre>
581
+ </td>
582
+ <td>
583
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 333</span>
584
+
585
+ <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>
586
+ <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>
587
+ <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>
588
+ <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>
589
+ <span class='kw'>end</span></pre>
590
+ </td>
591
+ </tr>
592
+ </table>
593
+ </div>
594
+
595
+ <div class="method_details ">
596
+ <h3 class="signature " id="del-class_method">
597
+
598
+ + (<tt>Object</tt>) <strong>del</strong>(key, force = false)
599
+
600
+
601
+
602
+
603
+
604
+ </h3><div class="docstring">
605
+ <div class="discussion">
606
+
607
+ <p>Deletes a key. If the key has no children, it is removed from the tree. If
608
+ it has children, it is removed from the tree if and only if it&#39;s value
609
+ was previously nil. Otherwise it&#39;s value is set to nil.</p>
610
+
611
+
612
+ </div>
613
+ </div>
614
+ <div class="tags">
615
+ <p class="tag_title">Parameters:</p>
616
+ <ul class="param">
617
+
618
+ <li>
619
+
620
+ <span class='name'>key</span>
621
+
622
+
623
+ <span class='type'>(<tt>String</tt>)</span>
624
+
625
+
626
+
627
+ &mdash;
628
+ <div class='inline'>
629
+ <p>The key to delete.</p>
630
+ </div>
631
+
632
+ </li>
633
+
634
+ <li>
635
+
636
+ <span class='name'>force</span>
637
+
638
+
639
+ <span class='type'>(<tt>Boolean</tt>)</span>
640
+
641
+
642
+ <em class="default">(defaults to: <tt>false</tt>)</em>
643
+
644
+
645
+ &mdash;
646
+ <div class='inline'>
647
+ <p>Doesn&#39;t require confirmation from the user if it is true.</p>
648
+ </div>
649
+
650
+ </li>
651
+
652
+ </ul>
653
+
654
+
655
+ </div><table class="source_code">
656
+ <tr>
657
+ <td>
658
+ <pre class="lines">
659
+
660
+
661
+ 217
662
+ 218
663
+ 219
664
+ 220
665
+ 221
666
+ 222
667
+ 223
668
+ 224
669
+ 225
670
+ 226
671
+ 227
672
+ 228
673
+ 229
674
+ 230
675
+ 231
676
+ 232
677
+ 233
678
+ 234</pre>
679
+ </td>
680
+ <td>
681
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 217</span>
682
+
683
+ <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>
684
+ <span class='kw'>unless</span> <span class='id identifier rubyid_force'>force</span> <span class='op'>||</span>
685
+ <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>
686
+ <span class='kw'>return</span>
687
+ <span class='kw'>end</span>
688
+ <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>
689
+ <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>
690
+
691
+ <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>
692
+ <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>
693
+ <span class='kw'>else</span>
694
+ <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>
695
+ <span class='kw'>end</span>
696
+ <span class='comment'># Remove any nil-leaves. (This may remove key IF it is a leaf)
697
+ </span> <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_prune'>prune</span>
698
+ <span class='comment'># Write out the tree.
699
+ </span> <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
700
+ <span class='kw'>end</span></pre>
701
+ </td>
702
+ </tr>
703
+ </table>
704
+ </div>
705
+
706
+ <div class="method_details ">
707
+ <h3 class="signature " id="help-class_method">
708
+
709
+ + (<tt>Object</tt>) <strong>help</strong>(*args)
710
+
711
+
712
+
713
+
714
+
715
+ </h3><div class="docstring">
716
+ <div class="discussion">
717
+
718
+ <p>Prints help text.</p>
719
+
720
+
721
+ </div>
722
+ </div>
723
+ <div class="tags">
724
+ <p class="tag_title">Parameters:</p>
725
+ <ul class="param">
726
+
727
+ <li>
728
+
729
+ <span class='name'>args</span>
730
+
731
+
732
+ <span class='type'>(<tt>Array</tt>)</span>
733
+
734
+
735
+
736
+ &mdash;
737
+ <div class='inline'>
738
+ <p>Ignored.</p>
739
+ </div>
740
+
741
+ </li>
742
+
743
+ </ul>
744
+
745
+
746
+ </div><table class="source_code">
747
+ <tr>
748
+ <td>
749
+ <pre class="lines">
750
+
751
+
752
+ 239
753
+ 240
754
+ 241
755
+ 242
756
+ 243
757
+ 244
758
+ 245
759
+ 246
760
+ 247
761
+ 248
762
+ 249
763
+ 250
764
+ 251
765
+ 252
766
+ 253
767
+ 254
768
+ 255
769
+ 256
770
+ 257
771
+ 258</pre>
772
+ </td>
773
+ <td>
774
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 239</span>
775
+
776
+ <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>
777
+ <span class='id identifier rubyid_puts'>puts</span> <span class='lparen'>(</span>
778
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>help\t\t - Prints this help text\n</span><span class='tstring_end'>&quot;</span></span>\
779
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>set KEY\t\t - Sets the value of the key to a value entered by the </span><span class='tstring_end'>&quot;</span></span>\
780
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>user.\n</span><span class='tstring_end'>&quot;</span></span>\
781
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>change_passwd\t - Changes the password of the current file.\n</span><span class='tstring_end'>&quot;</span></span>\
782
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>paste KEY\t - Sets the value of the key from the system </span><span class='tstring_end'>&quot;</span></span>\
783
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>clipboard.\n</span><span class='tstring_end'>&quot;</span></span>\
784
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>print\t\t - Prins a representation of the tree, without values.\n</span><span class='tstring_end'>&quot;</span></span>\
785
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>print KEY\t - Prints the value of the key.\n</span><span class='tstring_end'>&quot;</span></span>\
786
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>copy KEY\t - Copies the value of the key.\n</span><span class='tstring_end'>&quot;</span></span>\
787
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>copyc INT KEY\t - Copies the (1-indexed) character from the value </span><span class='tstring_end'>&quot;</span></span>\
788
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>of the key.\n</span><span class='tstring_end'>&quot;</span></span>\
789
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>del KEY\t\t - Deletes the key from the tree. If it has subtrees, </span><span class='tstring_end'>&quot;</span></span>\
790
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>the subtrees get deleted\n\t\t if and only if the key had no </span><span class='tstring_end'>&quot;</span></span>\
791
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>value.\n</span><span class='tstring_end'>&quot;</span></span>\
792
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>exit\t\t - Exit.\n\n</span><span class='tstring_end'>&quot;</span></span>\
793
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Keys are sorted in forward-slash seperated tree structure. </span><span class='tstring_end'>&quot;</span></span>\
794
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>(slightly remenicient of urls).</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
795
+ <span class='kw'>end</span></pre>
796
+ </td>
797
+ </tr>
798
+ </table>
799
+ </div>
800
+
801
+ <div class="method_details ">
802
+ <h3 class="signature " id="paste-class_method">
803
+
804
+ + (<tt>Object</tt>) <strong>paste</strong>(key)
805
+
806
+
807
+
808
+
809
+
810
+ </h3><div class="docstring">
811
+ <div class="discussion">
812
+
813
+ <p>Sets a value from the system clipboard. Fails if the clipboard is empty.</p>
814
+
815
+
816
+ </div>
817
+ </div>
818
+ <div class="tags">
819
+ <p class="tag_title">Parameters:</p>
820
+ <ul class="param">
821
+
822
+ <li>
823
+
824
+ <span class='name'>key</span>
825
+
826
+
827
+ <span class='type'>(<tt>String</tt>)</span>
828
+
829
+
830
+
831
+ &mdash;
832
+ <div class='inline'>
833
+ <p>The key to set.</p>
834
+ </div>
835
+
836
+ </li>
837
+
838
+ </ul>
839
+
840
+
841
+ </div><table class="source_code">
842
+ <tr>
843
+ <td>
844
+ <pre class="lines">
845
+
846
+
847
+ 299
848
+ 300
849
+ 301
850
+ 302
851
+ 303
852
+ 304
853
+ 305</pre>
854
+ </td>
855
+ <td>
856
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 299</span>
857
+
858
+ <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>
859
+ <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>
860
+ <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>
861
+ <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>
862
+ <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>
863
+ <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
864
+ <span class='kw'>end</span></pre>
865
+ </td>
866
+ </tr>
867
+ </table>
868
+ </div>
869
+
870
+ <div class="method_details ">
871
+ <h3 class="signature " id="print-class_method">
872
+
873
+ + (<tt>Object</tt>) <strong>print</strong>(key = nil)
874
+
875
+
876
+
877
+
878
+
879
+ </h3><div class="docstring">
880
+ <div class="discussion">
881
+
882
+ <p>Prints either the tree if no argument is provided, or prints the value of a
883
+ certain key.</p>
884
+
885
+
886
+ </div>
887
+ </div>
888
+ <div class="tags">
889
+ <p class="tag_title">Parameters:</p>
890
+ <ul class="param">
891
+
892
+ <li>
893
+
894
+ <span class='name'>key</span>
895
+
896
+
897
+ <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
898
+
899
+
900
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
901
+
902
+
903
+ &mdash;
904
+ <div class='inline'>
905
+ <p>The key if provided, or nil to print the tree.</p>
906
+ </div>
907
+
908
+ </li>
909
+
910
+ </ul>
911
+
912
+
913
+ </div><table class="source_code">
914
+ <tr>
915
+ <td>
916
+ <pre class="lines">
917
+
918
+
919
+ 264
920
+ 265
921
+ 266
922
+ 267
923
+ 268
924
+ 269
925
+ 270</pre>
926
+ </td>
927
+ <td>
928
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 264</span>
929
+
930
+ <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>
931
+ <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span>
932
+ <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>
933
+ <span class='kw'>else</span>
934
+ <span class='id identifier rubyid_print_tree'>print_tree</span>
935
+ <span class='kw'>end</span>
936
+ <span class='kw'>end</span></pre>
937
+ </td>
938
+ </tr>
939
+ </table>
940
+ </div>
941
+
942
+ <div class="method_details ">
943
+ <h3 class="signature " id="quit-class_method">
944
+
945
+ + (<tt>Object</tt>) <strong>quit</strong>(*args)
946
+
947
+
948
+
949
+
950
+
951
+ </h3><div class="docstring">
952
+ <div class="discussion">
953
+
954
+ <p>Quits.</p>
955
+
956
+
957
+ </div>
958
+ </div>
959
+ <div class="tags">
960
+ <p class="tag_title">Parameters:</p>
961
+ <ul class="param">
962
+
963
+ <li>
964
+
965
+ <span class='name'>args</span>
966
+
967
+
968
+ <span class='type'>(<tt>Array</tt>)</span>
969
+
970
+
971
+
972
+ &mdash;
973
+ <div class='inline'>
974
+ <p>Ignored.</p>
975
+ </div>
976
+
977
+ </li>
978
+
979
+ </ul>
980
+
981
+
982
+ </div><table class="source_code">
983
+ <tr>
984
+ <td>
985
+ <pre class="lines">
986
+
987
+
988
+ 342
989
+ 343
990
+ 344</pre>
991
+ </td>
992
+ <td>
993
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 342</span>
994
+
995
+ <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>
996
+ <span class='id identifier rubyid_exit'>exit</span>
997
+ <span class='kw'>end</span></pre>
998
+ </td>
999
+ </tr>
1000
+ </table>
1001
+ </div>
1002
+
1003
+ <div class="method_details ">
1004
+ <h3 class="signature " id="set-class_method">
1005
+
1006
+ + (<tt>Object</tt>) <strong>set</strong>(key)
1007
+
1008
+
1009
+
1010
+
1011
+
1012
+ </h3><div class="docstring">
1013
+ <div class="discussion">
1014
+
1015
+ <p>Set a value. Require entering the value to set it to twice until they
1016
+ match. An empty value will cancel setting.</p>
1017
+
1018
+
1019
+ </div>
1020
+ </div>
1021
+ <div class="tags">
1022
+ <p class="tag_title">Parameters:</p>
1023
+ <ul class="param">
1024
+
1025
+ <li>
1026
+
1027
+ <span class='name'>key</span>
1028
+
1029
+
1030
+ <span class='type'>(<tt>String</tt>)</span>
1031
+
1032
+
1033
+
1034
+ &mdash;
1035
+ <div class='inline'>
1036
+ <p>The key to set the value for.</p>
1037
+ </div>
1038
+
1039
+ </li>
1040
+
1041
+ </ul>
1042
+
1043
+
1044
+ </div><table class="source_code">
1045
+ <tr>
1046
+ <td>
1047
+ <pre class="lines">
1048
+
1049
+
1050
+ 286
1051
+ 287
1052
+ 288
1053
+ 289
1054
+ 290
1055
+ 291
1056
+ 292
1057
+ 293</pre>
1058
+ </td>
1059
+ <td>
1060
+ <pre class="code"><span class="info file"># File 'lib/passwd_manage/ui.rb', line 286</span>
1061
+
1062
+ <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>
1063
+ <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>
1064
+ <span class='id identifier rubyid_pass'>pass</span> <span class='op'>=</span> <span class='id identifier rubyid_read_passwd'>read_passwd</span>
1065
+ <span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_pass'>pass</span>
1066
+ <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>
1067
+ <span class='comment'># We save the tree whenever it is modified.
1068
+ </span> <span class='gvar'>$tree</span><span class='period'>.</span><span class='id identifier rubyid_flush'>flush</span>
1069
+ <span class='kw'>end</span></pre>
1070
+ </td>
1071
+ </tr>
1072
+ </table>
1073
+ </div>
1074
+
1075
+ </div>
1076
+
1077
+ </div>
1078
+
1079
+ <div id="footer">
1080
+ Generated on Sat Nov 9 18:07:45 2013 by
1081
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1082
+ 0.8.7.3 (ruby-2.0.0).
1083
+ </div>
1084
+
1085
+ </body>
1086
+ </html>