-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmptr
executable file
·49 lines (40 loc) · 893 Bytes
/
tmptr
1
2
3
4
5
6
7
8
9
10
11
12
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
#!/usr/bin/ruby
ENV['LANG'] = "C"
$:.push("./lib")
require 'termpresenter_file_loader.rb'
require 'termpresenter.rb'
require 'optparse'
dir="./presen"
ARGV.options {|opt|
opt.on('-d Presentation Directory'){|v| dir=v }
opt.on('-v'){|v| puts "TermPresenter v1.0"; exit 0}
opt.parse!
}
runtime = Time.now
content = Tmptr_content.new_bydir(dir)
tmptr = Tmptr.new(content)
tmptr.lines = 4
tmptr.infobar_proc = Proc.new{|tmptr, content|
tmptr.infobar("#{tmptr.current_index + 1}/#{content.pages} #{(Time.now - runtime).to_i}Sec")
}
tmptr.start{|term, key|
case key
when 99 # c
tmptr.execute_command
when 110 # n
tmptr.next
when 112 # p
tmptr.prev
when 114 # r
tmptr.reflesh
when 108 # l
tmptr.reload(Tmptr_content.new_bydir(dir))
when 115 # s
tmptr.toggle_strong
tmptr.reflesh
when 113 # q
exit 0
else
p key if $DEBUG
end
}