hiiro 0.1.243 → 0.1.245

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/h-wtree +33 -0
  3. data/lib/hiiro/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 451f995a33a97fcc96f14d46d9e5db921bd0fd7d3c82e3398f36b38c11acdcbe
4
- data.tar.gz: 297b009bba497838b4c9c2b1958632feb84e4348fcbd5027e7663f146e3c3cf1
3
+ metadata.gz: 07d46822be5511ac65285e5499d50ccd442de23e38c7d4bf99f1e349e214a14f
4
+ data.tar.gz: d5a37c09e78895a1d354ac3ed0bf94afe4543c4b2ede4bafff1e9a3cd144cdda
5
5
  SHA512:
6
- metadata.gz: c7c71c733b7be2b9a12ba342d681bef838a3a79b54eda8e4f0ca05a996f7738104a709079591d36465d9dc52eddcca0a3e681ea54b5433c2c82b38a97b9c1c40
7
- data.tar.gz: '0295aa80f43ab13e2b8f1bae5a0a1fa37f1527d90384bc4167365eb183ab42d5743338f4aab8c4c9d754b8de5625f638434e79358595e44f9316dd0f9ef28514'
6
+ metadata.gz: 0e702bc3617d434c65251a5d96cef34b3d760c69b625ac30094bd6f3567096a11a8ad93ea3e1191b2ee922f8b766fce66df9c792818a5b06ba1c871db3a748d1
7
+ data.tar.gz: 7f5678dde901168d0376dbf93d75972f5968120a3c37caebba0997bd71848325b8742703363055f83d349bd4fc5c3ea28f5c3b4b7811afd8537c778a87300b00
data/bin/h-wtree CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'hiiro'
4
+ require 'shellwords'
4
5
 
5
6
  Hiiro.run(*ARGV) do
6
7
  add_subcmd(:ls) { |*args| system('git', 'worktree', 'list', *args) }
@@ -13,6 +14,23 @@ Hiiro.run(*ARGV) do
13
14
  add_subcmd(:repair) { |*args| system('git', 'worktree', 'repair', *args) }
14
15
  add_subcmd(:unlock) { |*args| system('git', 'worktree', 'unlock', *args) }
15
16
 
17
+ add_subcmd(:switch) do |path|
18
+ if path.nil?
19
+ lines = `git worktree list`.strip.split("\n")
20
+ if lines.empty?
21
+ STDERR.puts "No worktrees found"
22
+ next
23
+ end
24
+ map = lines.each_with_object({}) { |line, h| h[line] = line.split.first }
25
+ path = fuzzyfind_from_map(map)
26
+ next unless path
27
+ end
28
+
29
+ path = File.expand_path(path)
30
+ session_name = File.basename(path)
31
+ Hiiro::Tmux.open_session(session_name, start_directory: path)
32
+ end
33
+
16
34
  add_subcmd(:select) do |*args|
17
35
  # Get worktree list
18
36
  output = `git worktree list`.strip
@@ -35,6 +53,21 @@ Hiiro.run(*ARGV) do
35
53
  end
36
54
  end
37
55
 
56
+ add_subcmd(:size) do |*args|
57
+ output = `git worktree list`.strip
58
+
59
+ if output.empty?
60
+ STDERR.puts "No worktrees found"
61
+ next
62
+ end
63
+
64
+ output.split("\n").each do |line|
65
+ path, *rest = line.split
66
+ size = `du -sh #{Shellwords.escape(path)} 2>/dev/null`.split.first || "?"
67
+ puts "#{size}\t#{path} #{rest.join(' ')}"
68
+ end
69
+ end
70
+
38
71
  add_subcmd(:copy) do |*args|
39
72
  output = `git worktree list`.strip
40
73
 
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.243"
2
+ VERSION = "0.1.245"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.243
4
+ version: 0.1.245
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota