libtmux-workspace 0.1.0.alpha.3 → 0.1.1
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 +20 -9
- data/lib/libtmux/workspace/cli.rb +21 -3
- data/lib/libtmux/workspace/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 67f1d8ae912d503b3f05aa72b9740ab8610899bf110ff6c9def7a491e2ab1467
|
|
4
|
+
data.tar.gz: b508046883150482276d3647766aa3beedd7d63e658662eb8643a8667262a355
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d2a319893795e19c71a96ef8060f5468fbbd9218bd566ded215872e057064da62c53cd6c0883f98191ead6f7b7d7ff8cf2c3682eca7d6c8d2a5af56d46fdede5
|
|
7
|
+
data.tar.gz: e725e40e92e6515ea0cb8d49c5b7051e0e7a89499a97c7cd9c4254d19d0a865a9b8621a0381cca32d008e164f062974437ab78dc1abea8849800fd317cc652bd
|
data/README.md
CHANGED
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
[Guides](https://libtmux.org/en/ruby/latest/workspace/guides/) ·
|
|
21
21
|
[RubyGems](https://rubygems.org/gems/libtmux-workspace)
|
|
22
22
|
|
|
23
|
+
[](https://libtmux.org/en/ruby/latest/workspace/)
|
|
24
|
+
[](https://rubygems.org/gems/libtmux-workspace)
|
|
25
|
+
|
|
23
26
|
</div>
|
|
24
27
|
|
|
25
28
|
Part of [libtmux for Ruby](https://github.com/libtmux/libtmux-ruby#readme).
|
|
@@ -42,11 +45,11 @@ tmux process.
|
|
|
42
45
|
|
|
43
46
|
## Quick start
|
|
44
47
|
|
|
45
|
-
Install the
|
|
48
|
+
Install the gem and its `libtmux-workspace` executable. It needs Ruby 3.3 or
|
|
46
49
|
newer, and tmux 3.3a or newer to load a plan:
|
|
47
50
|
|
|
48
51
|
```console
|
|
49
|
-
$ gem install libtmux-workspace
|
|
52
|
+
$ gem install libtmux-workspace
|
|
50
53
|
```
|
|
51
54
|
|
|
52
55
|
Save this declared subset of tmuxp-style data as `workspace.yaml`. Relative
|
|
@@ -314,9 +317,13 @@ $ libtmux-workspace plan \
|
|
|
314
317
|
workspace.yaml
|
|
315
318
|
```
|
|
316
319
|
|
|
317
|
-
[`load`][cli-load] and `plan --live`
|
|
318
|
-
|
|
319
|
-
`
|
|
320
|
+
[`load`][cli-load] and `plan --live` act on an existing server. Without
|
|
321
|
+
`--socket`, they use the socket in `LIBTMUX_SOCKET_PATH`, else the name in
|
|
322
|
+
`LIBTMUX_SOCKET`, else the server `TMUX` names when run inside tmux, else
|
|
323
|
+
tmux's default socket. When both variables are set, the path wins, an empty
|
|
324
|
+
variable counts as unset, and `--socket` ignores both. A command run from a tmux
|
|
325
|
+
pane with none of these set acts on that pane's server. This detached creation
|
|
326
|
+
example names its socket with a `TMUX_SOCKET` value:
|
|
320
327
|
|
|
321
328
|
```console
|
|
322
329
|
$ libtmux-workspace load \
|
|
@@ -331,7 +338,7 @@ $ libtmux-workspace load \
|
|
|
331
338
|
| Option | Effect |
|
|
332
339
|
| --- | --- |
|
|
333
340
|
| `--json` | Write one structured result or error object to stdout |
|
|
334
|
-
| `--socket PATH` | Select the existing server's socket for `load` or `plan --live` |
|
|
341
|
+
| `--socket PATH` | Select the existing server's socket for `load` or `plan --live`; the default follows the socket variables, then `TMUX`, then tmux's default socket |
|
|
335
342
|
| `--live` | Capture a snapshot before planning |
|
|
336
343
|
| `--timeout SECONDS` | Bound each apply, live capture or switch operation; the default is 5 |
|
|
337
344
|
| `--compensate` | Run guarded cleanup after an apply failure |
|
|
@@ -370,7 +377,9 @@ values by design.
|
|
|
370
377
|
|
|
371
378
|
## Support and status
|
|
372
379
|
|
|
373
|
-
|
|
380
|
+
Releases are numbered `0.1.N`, and each release increments `N`. The API is not
|
|
381
|
+
settled: any release may change or remove exported identifiers, and the
|
|
382
|
+
changelog marks each break. Pin an exact version to avoid one.
|
|
374
383
|
|
|
375
384
|
- **Ruby 3.3 or newer.** The gem depends on the same version of `libtmux`,
|
|
376
385
|
JSON 3.0 and Psych 5.5.
|
|
@@ -380,8 +389,10 @@ values by design.
|
|
|
380
389
|
`error.kind` is `tmux_unsupported`.
|
|
381
390
|
- **Linux, including WSL, and macOS.** The library and the command share the
|
|
382
391
|
core [compatibility workflow][compat]: Ruby 3.3, 3.4 and 4.0 with tmux 3.3a
|
|
383
|
-
through 3.8 on Ubuntu 24.04, with per-revision results.
|
|
384
|
-
|
|
392
|
+
through 3.8 on Ubuntu 24.04, with per-revision results. A push and a pull
|
|
393
|
+
request run the oldest and newest of those releases, 3.3a and 3.8, and a
|
|
394
|
+
release runs all of them. macOS is supported on a best-effort basis, and CI
|
|
395
|
+
coverage for it is highly limited.
|
|
385
396
|
- **History limit.** On tmux 3.3a to 3.6 the reused initial pane keeps the
|
|
386
397
|
global `history-limit`. Set the server's global value before you apply to
|
|
387
398
|
get one history size.
|
|
@@ -85,7 +85,9 @@ module LibTmux
|
|
|
85
85
|
@parser ||= OptionParser.new do |options|
|
|
86
86
|
options.banner = "Usage: libtmux-workspace validate|plan|load [options] [FILE]"
|
|
87
87
|
options.on("--json", "Write structured JSON to stdout") { @json = true }
|
|
88
|
-
options.on("--socket PATH", "
|
|
88
|
+
options.on("--socket PATH", "Socket of the existing tmux server for load or plan --live",
|
|
89
|
+
"Default: LIBTMUX_SOCKET_PATH, then LIBTMUX_SOCKET, then the",
|
|
90
|
+
"server TMUX names, then tmux's default socket") { |value| @options[:socket] = value }
|
|
89
91
|
options.on("--live", "Acquire a snapshot before planning") { @options[:live] = true }
|
|
90
92
|
options.on("--timeout SECONDS", Float, "Per-operation apply/capture/switch deadline (default: 5)") { |value| @options[:timeout] = value }
|
|
91
93
|
options.on("--compensate", "Attempt guarded cleanup of positively created resources on failure") { @options[:compensate] = true }
|
|
@@ -125,7 +127,7 @@ module LibTmux
|
|
|
125
127
|
raise ArgumentError if command != "load" && (@options[:attach] || @options[:switch] || @options[:compensate])
|
|
126
128
|
raise ArgumentError if @options[:live] && command != "plan"
|
|
127
129
|
live = command == "load" || @options[:live]
|
|
128
|
-
raise ArgumentError if
|
|
130
|
+
raise ArgumentError if @options.key?(:socket) && @options[:socket].empty?
|
|
129
131
|
raise ArgumentError if !live && @options[:socket]
|
|
130
132
|
if @options[:attach]
|
|
131
133
|
term = @environment["TERM"]
|
|
@@ -145,7 +147,23 @@ module LibTmux
|
|
|
145
147
|
end
|
|
146
148
|
|
|
147
149
|
def with_server(&block)
|
|
148
|
-
LibTmux::Server.open(
|
|
150
|
+
LibTmux::Server.open(endpoint: endpoint, &block)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# --socket wins; otherwise the core reads the variables, TMUX and tmux's default.
|
|
154
|
+
def endpoint
|
|
155
|
+
socket = @options[:socket]
|
|
156
|
+
LibTmux::Endpoint.new(socket_path: (expand_socket(socket) if socket), environment: @environment)
|
|
157
|
+
rescue ArgumentError => error
|
|
158
|
+
@argument_message = "Invalid arguments: #{error.message}."
|
|
159
|
+
raise
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# File.expand_path puts the user it cannot find in its message.
|
|
163
|
+
def expand_socket(socket)
|
|
164
|
+
File.expand_path(socket, @directory)
|
|
165
|
+
rescue ArgumentError
|
|
166
|
+
raise ArgumentError, "--socket cannot be expanded to a path; its leading ~ names no home directory"
|
|
149
167
|
end
|
|
150
168
|
|
|
151
169
|
def human_plan(plan)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: libtmux-workspace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- libtmux contributors
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.1.
|
|
18
|
+
version: 0.1.1
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.1.
|
|
25
|
+
version: 0.1.1
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: json
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,7 +76,7 @@ licenses:
|
|
|
76
76
|
- MIT
|
|
77
77
|
metadata:
|
|
78
78
|
source_code_uri: https://github.com/libtmux/libtmux-ruby
|
|
79
|
-
documentation_uri: https://libtmux.org/en/ruby/v0.1.
|
|
79
|
+
documentation_uri: https://libtmux.org/en/ruby/v0.1.1/workspace/
|
|
80
80
|
rdoc_options: []
|
|
81
81
|
require_paths:
|
|
82
82
|
- lib
|