in_our_time 0.0.3 → 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 +27 -0
- data/VERSION +1 -1
- data/dark_theme.png +0 -0
- data/in_our_time.gemspec +1 -0
- data/lib/in_our_time.rb +0 -1
- data/lib/iot/iot.rb +102 -70
- data/light_theme.png +0 -0
- metadata +18 -2
- data/lib/iot/colour_prompt.rb +0 -129
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95c440df705ea2afb85d4c4ea6caa5fa03b67732
|
4
|
+
data.tar.gz: c61b39babdf2dbd70ea44df6656cfb108b829d42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff9aa5de8973ea63ed168df39bf1e540dd7de222e7fcc4bf4c90551659eb74a17432893ad89aaf8ec6f9b7defcdc79ce5b059e1981d89134ab3d0489ee3f05c
|
7
|
+
data.tar.gz: 94d19d14be5efafcdb409b82f5765cc263308aac43052804812ca3df7cce1ce3f97a55caae14d0ca35139c89da2d5c09e576179a24ee8e6dfd41bc06d8f481fd
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
## In Our Time
|
2
|
+
|
3
|
+
Select, auto-download, and play **BBC In Our Time** podcasts easily, from the command line [link](http://www.bbc.co.uk/programmes/b006qykl).
|
4
|
+
|
5
|
+
When played, podcast is archived locally for offline access in the future.
|
6
|
+
|
7
|
+
Checks regularly for new podcasts and adds to the list.
|
8
|
+
|
9
|
+

|
10
|
+
|
11
|
+

|
12
|
+
|
13
|
+
## Installation:
|
14
|
+
|
15
|
+
```sh
|
16
|
+
gem install in_our_time
|
17
|
+
iot
|
18
|
+
```
|
19
|
+
|
20
|
+
## Config:
|
21
|
+
|
22
|
+
Config can be found at '~/.in_our_time/config.yml'
|
23
|
+
|
24
|
+
## mp3 player:
|
25
|
+
|
26
|
+
By default uses **afplay** on **OSX** but can also be configured to use **mpg123**. Use **aplay** on **Linux**.
|
27
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/dark_theme.png
ADDED
Binary file
|
data/in_our_time.gemspec
CHANGED
@@ -19,5 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
spec.required_ruby_version = '>= 2.0.0'
|
21
21
|
spec.add_runtime_dependency 'nokogiri', '>= 1.6.8'
|
22
|
+
spec.add_runtime_dependency 'colorize', '>= 0.8.1'
|
22
23
|
spec.add_development_dependency 'version', '>= 1.0.0'
|
23
24
|
end
|
data/lib/in_our_time.rb
CHANGED
data/lib/iot/iot.rb
CHANGED
@@ -5,10 +5,12 @@ require 'net/http'
|
|
5
5
|
require 'open-uri'
|
6
6
|
require 'yaml'
|
7
7
|
require 'fileutils'
|
8
|
+
require 'colorize'
|
8
9
|
|
9
10
|
class InOurTime
|
10
|
-
|
11
|
-
|
11
|
+
|
12
|
+
ROOT = File.expand_path '~/'
|
13
|
+
IN_OUR_TIME = File.join ROOT, '.in_our_time'
|
12
14
|
CONFIG = File.join IN_OUR_TIME, 'config.yml'
|
13
15
|
UPDATE_INTERVAL = 604800
|
14
16
|
AUDIO_DIRECTORY = 'audio'
|
@@ -20,11 +22,14 @@ class InOurTime
|
|
20
22
|
|
21
23
|
@arrow = 0
|
22
24
|
|
25
|
+
def reset
|
26
|
+
$stdin.flush
|
27
|
+
end
|
28
|
+
|
23
29
|
def input
|
24
|
-
sleep 0.001
|
25
30
|
begin
|
26
31
|
system("stty raw -echo")
|
27
|
-
str =
|
32
|
+
str = $stdin.getc
|
28
33
|
ensure
|
29
34
|
system("stty -raw echo")
|
30
35
|
end
|
@@ -82,14 +87,14 @@ class InOurTime
|
|
82
87
|
run
|
83
88
|
end
|
84
89
|
|
85
|
-
def iot_print x,
|
86
|
-
|
87
|
-
print
|
90
|
+
def iot_print x, col = @text_colour
|
91
|
+
print x.colorize col if @config[:colour]
|
92
|
+
print x unless @config[:colour]
|
88
93
|
end
|
89
94
|
|
90
|
-
def iot_puts x,
|
91
|
-
|
92
|
-
puts
|
95
|
+
def iot_puts x, col = @text_colour
|
96
|
+
puts x.colorize col if @config[:colour]
|
97
|
+
puts x unless @config[:colour]
|
93
98
|
end
|
94
99
|
|
95
100
|
def now
|
@@ -120,7 +125,22 @@ class InOurTime
|
|
120
125
|
:sort => :age,
|
121
126
|
:show_count => true,
|
122
127
|
:page_height => PAGE_HEIGHT,
|
123
|
-
:page_width => PAGE_WIDTH
|
128
|
+
:page_width => PAGE_WIDTH,
|
129
|
+
:colour_theme => :light_theme,
|
130
|
+
:light_theme => {
|
131
|
+
:selection_colour => {:colour => :magenta, :background => :light_white},
|
132
|
+
:count_sel_colour => {:colour => :cyan, :background => :light_white},
|
133
|
+
:count_colour => :yellow,
|
134
|
+
:text_colour => :default,
|
135
|
+
:system_colour => :yellow
|
136
|
+
},
|
137
|
+
:dark_theme => {
|
138
|
+
:selection_colour => {:colour => :light_yellow, :background => :light_black},
|
139
|
+
:count_sel_colour => {:colur => :blue, :background => :yellow},
|
140
|
+
:count_colour => :yellow,
|
141
|
+
:text_colour => :default,
|
142
|
+
:system_colour => :yellow
|
143
|
+
}
|
124
144
|
}
|
125
145
|
end
|
126
146
|
|
@@ -130,6 +150,12 @@ class InOurTime
|
|
130
150
|
end
|
131
151
|
@config = YAML::load_file(CONFIG)
|
132
152
|
@line_count = @config[:page_height]
|
153
|
+
theme = @config[:colour_theme]
|
154
|
+
@selection_colour = @config[theme][:selection_colour]
|
155
|
+
@count_sel_colour = @config[theme][:count_sel_colour]
|
156
|
+
@count_colour = @config[theme][:count_colour]
|
157
|
+
@text_colour = @config[theme][:text_colour]
|
158
|
+
@system_colour = @config[theme][:system_colour]
|
133
159
|
end
|
134
160
|
|
135
161
|
def save_config cfg = @config
|
@@ -176,13 +202,13 @@ class InOurTime
|
|
176
202
|
case res
|
177
203
|
when Net::HTTPOK
|
178
204
|
File.open(filename_from_title(program[:title]) , 'wb') do |f|
|
179
|
-
iot_print "writing #{filename_from_title(program[:title])}...",
|
205
|
+
iot_print "writing #{filename_from_title(program[:title])}...", @system_colour
|
180
206
|
f.print(res.body)
|
181
|
-
iot_puts " written.",
|
207
|
+
iot_puts " written.", @system_colour
|
182
208
|
end
|
183
209
|
program[:have_locally] = true
|
184
210
|
else
|
185
|
-
iot_puts 'audio download failed. Retrying...',
|
211
|
+
iot_puts 'audio download failed. Retrying...', @system_colour
|
186
212
|
end
|
187
213
|
end
|
188
214
|
|
@@ -200,9 +226,9 @@ class InOurTime
|
|
200
226
|
|
201
227
|
def check_remote
|
202
228
|
if update_remote?
|
203
|
-
iot_print "checking rss feeds ",
|
229
|
+
iot_print "checking rss feeds ", @system_colour
|
204
230
|
local_rss.length.times do |count|
|
205
|
-
|
231
|
+
iot_print '.', @system_colour
|
206
232
|
fetch_uri rss_addresses[count], rss_files[count]
|
207
233
|
end
|
208
234
|
iot_puts ''
|
@@ -294,12 +320,12 @@ class InOurTime
|
|
294
320
|
def run_program prg
|
295
321
|
unless prg[:have_locally]
|
296
322
|
retries = 0
|
297
|
-
iot_puts "fetching #{prg[:title]}",
|
323
|
+
iot_puts "fetching #{prg[:title]}", @system_colour
|
298
324
|
10.times do
|
299
325
|
res = Net::HTTP.get_response(URI.parse(prg[:link]))
|
300
326
|
case res
|
301
327
|
when Net::HTTPFound
|
302
|
-
iot_puts 'redirecting...',
|
328
|
+
iot_puts 'redirecting...', @system_colour
|
303
329
|
@doc = Nokogiri::XML(res.body)
|
304
330
|
redirect = @doc.css("body p a").text
|
305
331
|
break if download_audio(prg, redirect)
|
@@ -326,10 +352,10 @@ class InOurTime
|
|
326
352
|
def print_playing_maybe
|
327
353
|
iot_puts ''
|
328
354
|
if @playing
|
329
|
-
iot_puts "Playing '#{@playing}'"
|
355
|
+
iot_puts "Playing '#{@playing}'", @selection_colour
|
330
356
|
elsif @started.nil?
|
331
357
|
@started = true
|
332
|
-
iot_puts "? or h for instructions"
|
358
|
+
iot_puts "? or h for instructions", @text_colour
|
333
359
|
else
|
334
360
|
iot_puts ''
|
335
361
|
end
|
@@ -344,15 +370,16 @@ class InOurTime
|
|
344
370
|
end
|
345
371
|
|
346
372
|
def idx_format idx
|
347
|
-
sprintf("%03d
|
373
|
+
sprintf("%03d", idx + 1)
|
348
374
|
end
|
349
375
|
|
350
376
|
def show_count_maybe idx
|
351
377
|
if have_locally?(@sorted_titles[idx])
|
352
|
-
iot_print idx_format(idx),
|
378
|
+
iot_print idx_format(idx), @count_sel_colour if @config[:show_count]
|
353
379
|
else
|
354
|
-
iot_print idx_format(idx),
|
380
|
+
iot_print idx_format(idx), @count_colour if @config[:show_count]
|
355
381
|
end
|
382
|
+
iot_print ' '
|
356
383
|
end
|
357
384
|
|
358
385
|
def draw_page
|
@@ -361,16 +388,16 @@ class InOurTime
|
|
361
388
|
if idx < @sorted_titles.length
|
362
389
|
iot_print "> " if(idx == @selected) unless @config[:colour]
|
363
390
|
show_count_maybe idx
|
364
|
-
iot_puts @sorted_titles[idx],
|
365
|
-
iot_puts @sorted_titles[idx],
|
391
|
+
iot_puts @sorted_titles[idx], @selection_colour if (idx == @selected)
|
392
|
+
iot_puts @sorted_titles[idx], @text_colour unless(idx == @selected)
|
366
393
|
end
|
367
394
|
end
|
368
395
|
else
|
369
396
|
@line_count = 0
|
370
397
|
0.upto(@config[:page_height] - 1) do |idx|
|
371
|
-
iot_print "> " if(idx == @selected)
|
398
|
+
iot_print "> ", @selection_colour if(idx == @selected)
|
372
399
|
show_count_maybe(idx) unless @sorted_titles[idx].nil?
|
373
|
-
iot_puts @sorted_titles[idx] unless @sorted_titles[idx].nil?
|
400
|
+
iot_puts @sorted_titles[idx], @text_colour unless @sorted_titles[idx].nil?
|
374
401
|
end
|
375
402
|
end
|
376
403
|
@line_count += @config[:page_height]
|
@@ -458,10 +485,10 @@ class InOurTime
|
|
458
485
|
|
459
486
|
def info
|
460
487
|
if @info.nil?
|
488
|
+
prg = select_program @sorted_titles[@selected]
|
461
489
|
system 'clear'
|
462
490
|
iot_puts ''
|
463
|
-
prg
|
464
|
-
iot_puts justify(prg[:subtitle].gsub(/\s+/, ' '))
|
491
|
+
justify(prg[:subtitle].gsub(/\s+/, ' ')).map{|x| iot_puts x}
|
465
492
|
iot_puts ''
|
466
493
|
iot_puts "Date Broadcast: #{prg[:date]}"
|
467
494
|
iot_puts "Duration: #{prg[:duration].to_i/60} mins"
|
@@ -469,11 +496,11 @@ class InOurTime
|
|
469
496
|
(prg[:have_locally] ? "Downloaded" : "Requires Download")
|
470
497
|
@info = 1
|
471
498
|
elsif @info == 1
|
472
|
-
system 'clear'
|
473
|
-
iot_puts ''
|
474
499
|
prg = select_program @sorted_titles[@selected]
|
475
500
|
info = prg[:summary].gsub(/\s+/, ' ')
|
476
|
-
|
501
|
+
system 'clear'
|
502
|
+
iot_puts ''
|
503
|
+
justify(reformat(info)).map{|x| iot_puts x}
|
477
504
|
@info = -1
|
478
505
|
else
|
479
506
|
display_list :same_page
|
@@ -482,53 +509,58 @@ class InOurTime
|
|
482
509
|
end
|
483
510
|
|
484
511
|
def run
|
512
|
+
action = :unknown
|
485
513
|
display_list :same_page
|
486
514
|
key = KeyboardEvents.new
|
487
515
|
loop do
|
516
|
+
unless action == :unknown
|
517
|
+
key.reset
|
518
|
+
end
|
519
|
+
|
488
520
|
ip = key.input
|
489
521
|
@info = nil unless ip == :info
|
490
522
|
@help = nil unless ip == :help
|
491
523
|
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
when :previous
|
501
|
-
@selected -= 1 if @selected > 0
|
502
|
-
if @selected >= @line_count -
|
503
|
-
@config[:page_height]
|
504
|
-
display_list :same_page
|
505
|
-
else
|
506
|
-
display_list :previous_page
|
507
|
-
end
|
508
|
-
when :next
|
509
|
-
@selected += 1
|
510
|
-
if @selected <= @line_count - 1
|
511
|
-
display_list :same_page
|
512
|
-
else
|
524
|
+
action =
|
525
|
+
case ip
|
526
|
+
when :list
|
527
|
+
@line_count = 0
|
528
|
+
@selected = 0
|
529
|
+
display_list :draw_page
|
530
|
+
when :page_forward
|
531
|
+
@selected = @line_count
|
513
532
|
display_list :draw_page
|
533
|
+
when :previous
|
534
|
+
@selected -= 1 if @selected > 0
|
535
|
+
if @selected >= @line_count -
|
536
|
+
@config[:page_height]
|
537
|
+
display_list :same_page
|
538
|
+
else
|
539
|
+
display_list :previous_page
|
540
|
+
end
|
541
|
+
when :next
|
542
|
+
@selected += 1
|
543
|
+
if @selected <= @line_count - 1
|
544
|
+
display_list :same_page
|
545
|
+
else
|
546
|
+
display_list :draw_page
|
547
|
+
end
|
548
|
+
when :play
|
549
|
+
kill_audio
|
550
|
+
title = @sorted_titles[@selected]
|
551
|
+
pr = select_program title
|
552
|
+
run_program pr
|
553
|
+
display_list :same_page
|
554
|
+
when :stop
|
555
|
+
kill_audio
|
556
|
+
when :info
|
557
|
+
info
|
558
|
+
when :help
|
559
|
+
help
|
560
|
+
when :quit
|
561
|
+
kill_audio
|
562
|
+
exit 0
|
514
563
|
end
|
515
|
-
when :play
|
516
|
-
kill_audio
|
517
|
-
title = @sorted_titles[@selected]
|
518
|
-
pr = select_program title
|
519
|
-
run_program pr
|
520
|
-
display_list :same_page
|
521
|
-
when :stop
|
522
|
-
kill_audio
|
523
|
-
when :info
|
524
|
-
info
|
525
|
-
when :help
|
526
|
-
help
|
527
|
-
when :quit
|
528
|
-
kill_audio
|
529
|
-
exit 0
|
530
|
-
end
|
531
|
-
sleep 0.001
|
532
564
|
end
|
533
565
|
end
|
534
566
|
end
|
data/light_theme.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: in_our_time
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martyn Jago
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.6.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colorize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.1
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: version
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,13 +62,15 @@ extra_rdoc_files: []
|
|
48
62
|
files:
|
49
63
|
- ".gitignore"
|
50
64
|
- Gemfile
|
65
|
+
- README.md
|
51
66
|
- Rakefile
|
52
67
|
- VERSION
|
53
68
|
- bin/iot
|
69
|
+
- dark_theme.png
|
54
70
|
- in_our_time.gemspec
|
55
71
|
- lib/in_our_time.rb
|
56
|
-
- lib/iot/colour_prompt.rb
|
57
72
|
- lib/iot/iot.rb
|
73
|
+
- light_theme.png
|
58
74
|
homepage: https://github.com/mjago/In_Our_Time
|
59
75
|
licenses:
|
60
76
|
- MIT
|
data/lib/iot/colour_prompt.rb
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
# ==========================================
|
2
|
-
# Unity Project - A Test Framework for C
|
3
|
-
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
4
|
-
# [Released under MIT License. Please refer to license.txt for details]
|
5
|
-
# ==========================================
|
6
|
-
|
7
|
-
if RUBY_PLATFORM =~/(win|w)32$/
|
8
|
-
begin
|
9
|
-
require 'Win32API'
|
10
|
-
rescue LoadError
|
11
|
-
puts "ERROR! \"Win32API\" library not found"
|
12
|
-
puts "\"Win32API\" is required for colour on a windows machine"
|
13
|
-
puts " try => \"gem install Win32API\" on the command line"
|
14
|
-
puts
|
15
|
-
end
|
16
|
-
# puts
|
17
|
-
# puts 'Windows Environment Detected...'
|
18
|
-
# puts 'Win32API Library Found.'
|
19
|
-
# puts
|
20
|
-
end
|
21
|
-
|
22
|
-
class ColourCommandLine
|
23
|
-
def initialize
|
24
|
-
if RUBY_PLATFORM =~/(win|w)32$/
|
25
|
-
get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L')
|
26
|
-
@set_console_txt_attrb =
|
27
|
-
Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I')
|
28
|
-
@hout = get_std_handle.call(-11)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def change_to(new_colour)
|
33
|
-
if RUBY_PLATFORM =~/(win|w)32$/
|
34
|
-
@set_console_txt_attrb.call(@hout,self.win32_colour(new_colour))
|
35
|
-
else
|
36
|
-
"\033[30;#{posix_colour(new_colour)};22m"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def win32_colour(colour)
|
41
|
-
case colour
|
42
|
-
when :black then 0
|
43
|
-
when :dark_blue then 1
|
44
|
-
when :dark_green then 2
|
45
|
-
when :dark_cyan then 3
|
46
|
-
when :dark_red then 4
|
47
|
-
when :dark_purple then 5
|
48
|
-
when :dark_yellow, :narrative then 6
|
49
|
-
when :default_white, :default, :dark_white then 7
|
50
|
-
when :silver then 8
|
51
|
-
when :blue then 9
|
52
|
-
when :green, :success then 10
|
53
|
-
when :cyan, :output then 11
|
54
|
-
when :red, :failure then 12
|
55
|
-
when :purple then 13
|
56
|
-
when :yellow then 14
|
57
|
-
when :white then 15
|
58
|
-
else
|
59
|
-
0
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def posix_colour(colour)
|
64
|
-
# ANSI Escape Codes - Foreground colors
|
65
|
-
# | Code | Color |
|
66
|
-
# | 39 | Default foreground color |
|
67
|
-
# | 30 | Black |
|
68
|
-
# | 31 | Red |
|
69
|
-
# | 32 | Green |
|
70
|
-
# | 33 | Yellow |
|
71
|
-
# | 34 | Blue |
|
72
|
-
# | 35 | Magenta |
|
73
|
-
# | 36 | Cyan |
|
74
|
-
# | 37 | Light gray |
|
75
|
-
# | 90 | Dark gray |
|
76
|
-
# | 91 | Light red |
|
77
|
-
# | 92 | Light green |
|
78
|
-
# | 93 | Light yellow |
|
79
|
-
# | 94 | Light blue |
|
80
|
-
# | 95 | Light magenta |
|
81
|
-
# | 96 | Light cyan |
|
82
|
-
# | 97 | White |
|
83
|
-
|
84
|
-
case colour
|
85
|
-
when :black then 30
|
86
|
-
when :red, :failure then 31
|
87
|
-
when :green, :success then 32
|
88
|
-
when :yellow then 33
|
89
|
-
when :blue, :narrative then 34
|
90
|
-
when :purple, :magenta then 35
|
91
|
-
when :cyan, :output then 36
|
92
|
-
when :white, :default_white then 37
|
93
|
-
when :default then 39
|
94
|
-
when :dark_gray then 90 # Dark gray
|
95
|
-
when :light_red then 91 # Light red
|
96
|
-
when :light_green then 92 # Light green
|
97
|
-
when :light_yellow then 93 # Light yellow
|
98
|
-
when :light_blue then 94 # Light blue
|
99
|
-
when :light_magenta then 95 # Light magenta
|
100
|
-
when :light_cyan then 96 # Light cyan
|
101
|
-
when :White then 97 # White
|
102
|
-
|
103
|
-
else
|
104
|
-
39
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def out_c(mode, colour, str, out = :stdout)
|
109
|
-
buf = case out
|
110
|
-
when :stdout
|
111
|
-
$stdout
|
112
|
-
else
|
113
|
-
out = out
|
114
|
-
end
|
115
|
-
case RUBY_PLATFORM
|
116
|
-
when /(win|w)32$/
|
117
|
-
change_to(colour)
|
118
|
-
buf.puts str if mode == :puts
|
119
|
-
buf.print str if mode == :print
|
120
|
-
change_to(:default_white)
|
121
|
-
else
|
122
|
-
buf.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts
|
123
|
-
$stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end # ColourCommandLine
|
127
|
-
|
128
|
-
def colour_puts(role,str, out = :stdout) ColourCommandLine.new.out_c(:puts, role, str, out) end
|
129
|
-
def colour_print(role,str, out = :stdout) ColourCommandLine.new.out_c(:print, role, str, out) end
|