term-slides 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -4
- data/examples/basic.rb +1 -1
- data/lib/term-slides.rb +16 -4
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 291c6428c775da93ef7e019f155643b9906e2a73a68717dcac589a9b0232fdda
|
4
|
+
data.tar.gz: 1bfc84cf10873d70ceb2c3c501962748a0fe8514c57a9460a7f76a843bf257a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f48a8d1873ad8397086c3e4db96a950b221303a2547e7b7c0504dacdffc61b6029584997d99ce7390993cc5a1f0b416e1e815bf3347c16bb857291559eb3a6c
|
7
|
+
data.tar.gz: 3f5ea544c0c73c1b7a783d31d8a8e37d613ed53f7bbaa737780c3ebfc4128449bdaf8f0729bfb50728b050fabe30f0b6c5e9c01e92d43997e6448b9c542fea95
|
data/README.md
CHANGED
@@ -6,6 +6,23 @@ Here is an example:
|
|
6
6
|
|
7
7
|
![Example](examples/basic_capture.gif)
|
8
8
|
|
9
|
+
Currently, image/diagram rendering is only available in [kitty](https://github.com/kovidgoyal/kitty).
|
10
|
+
|
11
|
+
## Writing your presentation
|
12
|
+
|
13
|
+
see examples/basic.rb
|
14
|
+
|
15
|
+
## Running it
|
16
|
+
|
17
|
+
just run your ruby script.
|
18
|
+
|
19
|
+
Controls:
|
20
|
+
|
21
|
+
- `n`: next slide
|
22
|
+
- `p`: previous slide
|
23
|
+
- `r`: refresh slide
|
24
|
+
- `q`: quit
|
25
|
+
|
9
26
|
## Installation
|
10
27
|
|
11
28
|
Add this line to your application's Gemfile:
|
@@ -22,10 +39,6 @@ Or install it yourself as:
|
|
22
39
|
|
23
40
|
$ gem install term-slides
|
24
41
|
|
25
|
-
## Usage
|
26
|
-
|
27
|
-
see examples/basic.rb
|
28
|
-
|
29
42
|
## Development
|
30
43
|
|
31
44
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/examples/basic.rb
CHANGED
data/lib/term-slides.rb
CHANGED
@@ -36,10 +36,22 @@ module TermSlides
|
|
36
36
|
def render_text text
|
37
37
|
puts center(text.text)
|
38
38
|
end
|
39
|
-
def render_image_file
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
def render_image_file path
|
40
|
+
commands = {
|
41
|
+
"kitty" => %w(kitty +kitten icat),
|
42
|
+
"terminology" => %w(tycat)
|
43
|
+
}
|
44
|
+
ptree = `pstree -As $$`.chomp.split("---")
|
45
|
+
terminals = commands.keys.map { |terminal| ptree.include?(terminal) ? terminal : nil }.select { |x| !x.nil? }
|
46
|
+
if terminals.size > 0
|
47
|
+
command = commands[terminals.first]
|
48
|
+
else
|
49
|
+
command = ["icat"]
|
50
|
+
end
|
51
|
+
if find_executable(command.first)
|
52
|
+
co = (command << path)
|
53
|
+
system(*co)
|
54
|
+
end
|
43
55
|
end
|
44
56
|
def render_image image
|
45
57
|
render_image_file image.src
|
data/lib/version.rb
CHANGED