paned_repl 0.0.3 → 0.0.4
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 +39 -0
- data/lib/paned_repl/tmux.rb +1 -0
- data/lib/version.rb +1 -1
- metadata +2 -2
- data/lib/paned_repl/utils/html_printer.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5c42a3722ef794d604ce1964f1c5c8f475e7c34
|
4
|
+
data.tar.gz: 4f4b92401e320a0da4bc6897a50743af292b93e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d1f4fdd860dc0772c5949165d6d9fca577fddd97895e6e714fd86f0c728442b20a944f5b8c4f34fa5e696cecc84026e5b354a67ef86204d3506a41b6b2442e2
|
7
|
+
data.tar.gz: 575f6ea1720630996b43ae7de3f1ff7606fccb97ac3d324c710d790fb285382c4d92ec16d0ea4e4ffba10ff9cd95269f54db24c810d1bc439a6703802e4a7584
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
**Installation**
|
2
|
+
|
3
|
+
To launch a REPL (using Pry), first do this in Bash:
|
4
|
+
|
5
|
+
```sh
|
6
|
+
gem install paned_repl
|
7
|
+
paned_repl init
|
8
|
+
sh paned_repl.sh
|
9
|
+
```
|
10
|
+
**Usage**
|
11
|
+
|
12
|
+
inside the REPL, require whatever programs you need.
|
13
|
+
|
14
|
+
There is a Ruby wrapper over TMux commands. For example:
|
15
|
+
|
16
|
+
```rb
|
17
|
+
# the 'main pane' receives tmux commands
|
18
|
+
# this refers to a root Tmux session that is automatically created.
|
19
|
+
# launching subsequent Tmux sessions is not implemented
|
20
|
+
session = PanelRepl.sessions.values.first
|
21
|
+
|
22
|
+
# create a new pane, but maintain focus on main frame.
|
23
|
+
# swaps positions so the main pane is always last
|
24
|
+
session.split_horizontal
|
25
|
+
|
26
|
+
# make the panes equal size
|
27
|
+
session.even_horizontal
|
28
|
+
|
29
|
+
new_pane_id = 0 # There are 2 total panes, and the main pane is always the last
|
30
|
+
# Therefore (with 0-indexing) the new pane has an id of 0.
|
31
|
+
# If a third pane were added, it would have an id of 1 and the main
|
32
|
+
# pane would have an id of 2.
|
33
|
+
|
34
|
+
session.send_keys "echo hello", new_pane_id
|
35
|
+
```
|
36
|
+
|
37
|
+
There is intended to be one pane that handles direct user input. The other panes just receive commands through `send_keys`.
|
38
|
+
|
39
|
+
See [./lib/paned_repl/tmux.rb](lib/paned_repl/tmux.rb) for more commands that can be used.
|
data/lib/paned_repl/tmux.rb
CHANGED
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paned_repl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maxpleaner
|
@@ -73,6 +73,7 @@ executables:
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- README.md
|
76
77
|
- bin/paned_repl
|
77
78
|
- lib/paned_repl.rb
|
78
79
|
- lib/paned_repl/constants.rb
|
@@ -80,7 +81,6 @@ files:
|
|
80
81
|
- lib/paned_repl/repls/base_repl.rb
|
81
82
|
- lib/paned_repl/tmux.rb
|
82
83
|
- lib/paned_repl/utils.rb
|
83
|
-
- lib/paned_repl/utils/html_printer.rb
|
84
84
|
- lib/version.rb
|
85
85
|
homepage: https://github.com/maxpleaner/paned_repl
|
86
86
|
licenses:
|
@@ -1,40 +0,0 @@
|
|
1
|
-
|
2
|
-
class PanedRepl::Utils::HtmlPrinter
|
3
|
-
|
4
|
-
Delimiter = PanedRepl.const("HTML_PRINTER_DELIMITER")
|
5
|
-
|
6
|
-
using Gemmy.patch("object/i/ergo")
|
7
|
-
|
8
|
-
def self.start &blk
|
9
|
-
Html.io_loop &:ergo
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.io_loop &blk
|
13
|
-
html = ''
|
14
|
-
loop do
|
15
|
-
str = gets.chomp
|
16
|
-
if str.ends_with? Delimiter
|
17
|
-
new(html: html).print
|
18
|
-
html = blk.call html
|
19
|
-
else
|
20
|
-
html = html + str
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
include AutoInitializer
|
26
|
-
|
27
|
-
attr_reader :html
|
28
|
-
|
29
|
-
def create_path
|
30
|
-
Tempfile.new.tap { |f|
|
31
|
-
f.write html
|
32
|
-
f.close
|
33
|
-
}.path
|
34
|
-
end
|
35
|
-
|
36
|
-
def print
|
37
|
-
puts `cat #{create_path} | w3m -dump -T text/html`
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|