13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/shhh/app/commands/show_language_examples.rb', line 13
def execute
output = []
output << Shhh::App::NLP::Base.usage
output << example(comment: 'generate a new private key and copy to the clipboard but do not print to terminal',
command: 'shhh create new key to clipboard quietly'
)
output << example(comment: 'generate and save to a file a password-protected key, silently',
command: 'shhh create a secure key and save it to "my.key"',
)
output << example(comment: 'encrypt a plain text string with a key, and save the output to a file',
command: 'shhh encrypt string "secret string" using $(cat my.key) save to file.enc')
output << example(comment: 'decrypt a previously encrypted string:',
command: 'shhh decrypt string $ENC using $(cat my.key)')
output << example(comment: 'encrypt "file.txt" with key from my.key and save it to file.enc',
command: 'shhh encrypt file file.txt with key from my.key and save it to file.enc')
output << example(comment: 'decrypt an encrypted file and print it to STDOUT:',
command: 'shhh decrypt file file.enc with key from "my.key"')
output << example(comment: 'edit an encrypted file in $EDITOR, ask for key, and create a backup upon save',
command: 'shhh edit file file.enc ask for a key and make a backup',
)
if Shhh::App.is_osx?
output << example(comment: 'generate a new password-encrypted key, save it to your Keychain:',
command: 'shhh create a new protected key store in keychain "my-keychain-key"')
output << example(comment: 'print the key stored in the keychain item "my-keychain-key"',
command: 'shhh print keychain "my-keychain-key"')
output << example(comment: 'use the new key to encrypt a file:',
command: 'shhh encrypt with keychain "my-keychain-key" file "password.txt" and write to "passwords.enc"')
end
output.flatten.compact.join("\n")
end
|