cli-talky-talk 0.0.2 → 0.1.0
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 +4 -4
- data/README.md +2 -0
- data/bin/speak +26 -2
- data/lib/cli-talky-talk.rb +59 -48
- data/lib/cli_talky_talk/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd93c185b1359d17eb42c2016bda31262160139
|
4
|
+
data.tar.gz: b9cd0898da65f652b6797907b34c3278998baee4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f6dbcd675ee0aa6a4624e8101c21a0143886b44c0bc940527b0a578fdd665cec528db6d1ba0fed8424631d94efa3f6ccbf6d359f6d0bd47eac064922de52414
|
7
|
+
data.tar.gz: ddd520c2aafb9c563eec1793f9daa086e7f3ba4e77d42d8c85489159e822039272950285b58ba0ea3f1e0f088cb15c6b47e97c2fde8e111b157231bda03e638e
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Ever find yourself checking the terminal to see if the last command you ran is finished? I do all the time so I wrote cli-talky-talk.
|
4
4
|
|
5
|
+
This currently only works on OS X. I'll be able to add Linux support soon. I just need to get the code off another machine.
|
6
|
+
|
5
7
|
## Usage
|
6
8
|
|
7
9
|
cli-talky-talk is very easy to use. All you need to do is add `&& speak` at the end of a long running terminal command. When the command is done your computer will address you with a random message letting you know that the work is finished.
|
data/bin/speak
CHANGED
@@ -1,8 +1,32 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'optparse'
|
4
|
+
require 'ostruct'
|
3
5
|
require 'bundler/setup'
|
4
6
|
require 'cli-talky-talk'
|
5
7
|
|
6
|
-
|
8
|
+
options = OpenStruct.new
|
7
9
|
|
8
|
-
|
10
|
+
OptionParser.new do |opts|
|
11
|
+
opts.banner = "Usage: speak [options]"
|
12
|
+
|
13
|
+
# set defaults
|
14
|
+
options.debug = false
|
15
|
+
|
16
|
+
opts.on('-d', '--debug', 'debug mode') do
|
17
|
+
puts "setting debug true"
|
18
|
+
options.debug = true
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on('-s sentence', '--sentence sentence') do |sentence|
|
22
|
+
options.sentence = sentence
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on('-v voice', '--voice=voice', 'use specific voice') do |voice|
|
26
|
+
options.voice = voice
|
27
|
+
end
|
28
|
+
|
29
|
+
end.parse!
|
30
|
+
|
31
|
+
talker = CliTalkyTalk.new(options)
|
32
|
+
talker.speak
|
data/lib/cli-talky-talk.rb
CHANGED
@@ -1,55 +1,66 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require 'pry'
|
2
|
+
class CliTalkyTalk
|
3
|
+
|
4
|
+
attr_accessor :options
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
@options = options || OpenStruct.new
|
5
8
|
end
|
6
9
|
|
7
|
-
|
8
|
-
VOICES = `say -v \?`.split("\n").select { |v| v =~ /en_US/ }.map { |v| v.gsub(/\s+en_US.*$/,"")}
|
9
|
-
|
10
|
-
GREETINGS = [
|
11
|
-
'ahoy',
|
12
|
-
'greeting',
|
13
|
-
'saalutations',
|
14
|
-
'waazame',
|
15
|
-
'bleep booop',
|
16
|
-
'exceslior',
|
17
|
-
'land hoe',
|
18
|
-
'hail',
|
19
|
-
]
|
20
|
-
|
21
|
-
NAMES = [
|
22
|
-
`whoami`.chomp,
|
23
|
-
'Govna',
|
24
|
-
'captain',
|
25
|
-
'boss',
|
26
|
-
'cheef',
|
27
|
-
'over loard',
|
28
|
-
'dragon commander',
|
29
|
-
'your excellence',
|
30
|
-
'exhaulted one',
|
31
|
-
]
|
32
|
-
|
33
|
-
STATUSES = [
|
34
|
-
'all done here',
|
35
|
-
'works done',
|
36
|
-
'bingo!',
|
37
|
-
'hazaa',
|
38
|
-
'flip Yeah',
|
39
|
-
'get back to work',
|
40
|
-
'all systems go',
|
41
|
-
]
|
42
|
-
|
43
|
-
def rand(arr)
|
44
|
-
arr.sample
|
45
|
-
end
|
10
|
+
VOICES = `say -v \?`.split("\n").select { |v| v =~ /en_/ }.map { |v| v.gsub(/\s+en_US.*$/,"")}
|
46
11
|
|
47
|
-
|
48
|
-
|
49
|
-
|
12
|
+
GREETINGS = [
|
13
|
+
'ahoy',
|
14
|
+
'greeting',
|
15
|
+
'saalutations',
|
16
|
+
'waazame',
|
17
|
+
'bleep booop',
|
18
|
+
'exceslior',
|
19
|
+
'land hoe',
|
20
|
+
'hail',
|
21
|
+
]
|
22
|
+
|
23
|
+
NAMES = [
|
24
|
+
`whoami`.chomp,
|
25
|
+
'Govna',
|
26
|
+
'captain',
|
27
|
+
'boss',
|
28
|
+
'cheef',
|
29
|
+
'over loard',
|
30
|
+
'dragon commander',
|
31
|
+
'your excellence',
|
32
|
+
'exhaulted one',
|
33
|
+
]
|
34
|
+
|
35
|
+
STATUSES = [
|
36
|
+
'all done here',
|
37
|
+
'works done',
|
38
|
+
'bingo!',
|
39
|
+
'hazaa',
|
40
|
+
'flip Yeah',
|
41
|
+
'get back to work',
|
42
|
+
'all systems go',
|
43
|
+
]
|
44
|
+
|
45
|
+
def rand(arr)
|
46
|
+
arr.sample
|
47
|
+
end
|
48
|
+
|
49
|
+
def speak
|
50
|
+
voice = options.voice || rand(VOICES)
|
51
|
+
log "voice: #{voice}"
|
52
|
+
sentence = options.sentence || random_sentence
|
53
|
+
log "sentence: #{sentence}"
|
54
|
+
`say -v#{voice} #{sentence}`
|
55
|
+
end
|
56
|
+
|
57
|
+
def random_sentence
|
58
|
+
"#{rand GREETINGS}, #{rand NAMES}! #{rand STATUSES}"
|
59
|
+
end
|
50
60
|
|
51
|
-
|
52
|
-
|
61
|
+
def log(str)
|
62
|
+
if options and options.debug
|
63
|
+
puts str
|
53
64
|
end
|
54
65
|
end
|
55
66
|
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.0
|
1
|
+
class CliTalkyTalk
|
2
|
+
VERSION = "0.1.0"
|
3
3
|
end
|