tmuxinator 3.3.2 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tmuxinator/cli.rb +6 -2
- data/lib/tmuxinator/config.rb +24 -4
- data/lib/tmuxinator/version.rb +1 -1
- data/spec/lib/tmuxinator/cli_spec.rb +8 -0
- data/spec/lib/tmuxinator/config_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5ef87c54d6e438767477e9e41cbe4d0b0d802c6aa980d07d1921819a7dc2b81
|
4
|
+
data.tar.gz: dc974393d493a3ebfd556c87615472acc34f4dc328bb2a31b277ad40a865c8d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dec7830c2331a3fb50a36afd880168ab3ec616900b41ba87c33e610235ee5cb935f794c1738ab5054bc78e3303b3fc078a1a380aed45fd7c9a08870b6a360ca0
|
7
|
+
data.tar.gz: 182bc06919fe54d090fc455c5f69c5a653115887d495acba204cc2112ffd7379e759d3ed8d40067b8c00be1b20d95468f15a72562728400bfbb806f4a7020ede
|
data/lib/tmuxinator/cli.rb
CHANGED
@@ -391,13 +391,17 @@ module Tmuxinator
|
|
391
391
|
method_option :newline, type: :boolean,
|
392
392
|
aliases: ["-n"],
|
393
393
|
desc: "Force output to be one entry per line."
|
394
|
+
method_option :active, type: :boolean,
|
395
|
+
aliases: ["-a"],
|
396
|
+
desc: "Filter output by active project sessions."
|
394
397
|
|
395
398
|
def list
|
396
399
|
say "tmuxinator projects:"
|
400
|
+
configs = Tmuxinator::Config.configs(active: options[:active])
|
397
401
|
if options[:newline]
|
398
|
-
say
|
402
|
+
say configs.join("\n")
|
399
403
|
else
|
400
|
-
print_in_columns
|
404
|
+
print_in_columns configs
|
401
405
|
end
|
402
406
|
end
|
403
407
|
|
data/lib/tmuxinator/config.rb
CHANGED
@@ -126,13 +126,33 @@ module Tmuxinator
|
|
126
126
|
asset_path "wemux_template.erb"
|
127
127
|
end
|
128
128
|
|
129
|
-
#
|
130
|
-
def
|
131
|
-
|
129
|
+
# List of all active tmux sessions
|
130
|
+
def active_sessions
|
131
|
+
`tmux list-sessions -F "#S"`.split("\n")
|
132
|
+
end
|
133
|
+
|
134
|
+
# Sorted list of all project .yml file basenames, including duplicates
|
135
|
+
#
|
136
|
+
# @param active filter configs by active project sessions
|
137
|
+
# @return [Array<String>] list of project names
|
138
|
+
def configs(active: nil)
|
139
|
+
configs = config_file_basenames
|
140
|
+
|
141
|
+
if active == true
|
142
|
+
configs &= active_sessions
|
143
|
+
elsif active == false
|
144
|
+
configs -= active_sessions
|
145
|
+
end
|
146
|
+
|
147
|
+
configs
|
148
|
+
end
|
149
|
+
|
150
|
+
def config_file_basenames
|
151
|
+
directories.flat_map do |directory|
|
132
152
|
Dir["#{directory}/**/*.yml"].map do |path|
|
133
153
|
path.gsub("#{directory}/", "").gsub(".yml", "")
|
134
154
|
end
|
135
|
-
end.
|
155
|
+
end.sort
|
136
156
|
end
|
137
157
|
|
138
158
|
# Existent directories which may contain project files
|
data/lib/tmuxinator/version.rb
CHANGED
@@ -845,6 +845,14 @@ describe Tmuxinator::Cli do
|
|
845
845
|
end
|
846
846
|
end
|
847
847
|
|
848
|
+
context "set --active flag " do
|
849
|
+
ARGV.replace(["list", "--active"])
|
850
|
+
|
851
|
+
it "is a valid option" do
|
852
|
+
expect { capture_io { cli.start } }.to_not raise_error
|
853
|
+
end
|
854
|
+
end
|
855
|
+
|
848
856
|
context "no arguments are given" do
|
849
857
|
ARGV.replace(["list"])
|
850
858
|
|
@@ -281,6 +281,26 @@ describe Tmuxinator::Config do
|
|
281
281
|
to eq ["both", "both", "dup/local-dup", "home", "local-dup", "xdg"]
|
282
282
|
end
|
283
283
|
|
284
|
+
it "gets a sorted list of all active projects" do
|
285
|
+
allow(described_class).to receive(:environment?).and_return false
|
286
|
+
allow(described_class).
|
287
|
+
to receive(:active_sessions).
|
288
|
+
and_return ["both", "home"]
|
289
|
+
|
290
|
+
expect(described_class.configs(active: true)).
|
291
|
+
to eq ["both", "home"]
|
292
|
+
end
|
293
|
+
|
294
|
+
it "gets a sorted list excluding active projects" do
|
295
|
+
allow(described_class).to receive(:environment?).and_return false
|
296
|
+
allow(described_class).
|
297
|
+
to receive(:active_sessions).
|
298
|
+
and_return ["both", "home"]
|
299
|
+
|
300
|
+
expect(described_class.configs(active: false)).
|
301
|
+
to eq ["dup/local-dup", "local-dup", "xdg"]
|
302
|
+
end
|
303
|
+
|
284
304
|
it "lists only projects in $TMUXINATOR_CONFIG when set" do
|
285
305
|
allow(ENV).to receive(:[]).with("TMUXINATOR_CONFIG").
|
286
306
|
and_return "#{fixtures_dir}/TMUXINATOR_CONFIG"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tmuxinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Bargi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: erubi
|