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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 742d772fd41915d53998bdf400f07c1f73b30cd4
4
- data.tar.gz: 93c07c5e52b8c0541c16bec379ba66022010f967
3
+ metadata.gz: edd93c185b1359d17eb42c2016bda31262160139
4
+ data.tar.gz: b9cd0898da65f652b6797907b34c3278998baee4
5
5
  SHA512:
6
- metadata.gz: 09462f738568505761cc9a135feba9b2721a22dbca5ccfd419ced36d761a7be79f2484c6e5e1458978295383abde14c5a3bc45764f4fa96f02619d04ab122fb3
7
- data.tar.gz: 81c769dd62c6ac6fb16bc3b909e64d86f1eef1a4982fff559636c03959cf0779e8b55108a5e79c13657930675811ced85d358a00e750ca2ed452c04907ee3449
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
- extend CliTalkyTalk::ClassMethods
8
+ options = OpenStruct.new
7
9
 
8
- speak
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
@@ -1,55 +1,66 @@
1
- module CliTalkyTalk
2
- def self.included(base)
3
- binding.pry
4
- base.extend(ClassMethods)
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
- module ClassMethods
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
- def speak
48
- `say -v#{rand(VOICES)} #{random_sentence}`
49
- end
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
- def random_sentence
52
- "#{rand GREETINGS}, #{rand NAMES}! #{rand STATUSES}"
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
- module CliTalkyTalk
2
- VERSION = "0.0.2"
1
+ class CliTalkyTalk
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cli-talky-talk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean McCleary