hiiro 0.1.319 → 0.1.320

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a85db7d6d14d76d893352967e47f40fcf6b6c47a2b21ad9ec640bbeafda0da6d
4
- data.tar.gz: 62410ab480fc9638df31aaf0a49c48068c81d322dde3fd498b9351e464581a92
3
+ metadata.gz: ac5dd6b23a9eb04c9cb6594be7dd68811fd4852b59939505e14e74d8b1f50baf
4
+ data.tar.gz: fa1d62dee0b0dcaaa845c2f1814de85f0bd5ddd69506267e2b8407384a045ec0
5
5
  SHA512:
6
- metadata.gz: e858ca0c1b70057dce4a6738e21d73512eb42ad6d12adc155a9bbc061b78e7e1d6a78b63dd651c8fcbe79a7d7e6196d79d5efd8c65b61f805e3e5c410e9aa26d
7
- data.tar.gz: 75c7733377ca2db3a5f91470c720fa1e7b391cbc007aa66da8a3b5df2f3f17403f63d2f8e9a2359898e3b507ec514399489583173a6d20ce24d869dcdc7e8da6
6
+ metadata.gz: 38db0092aeed1d9fe80b6ef6d5750bbe88a1c1ea9296b2c4ad6d3434b43a4770b6e9708dba9177d9defeed239a4b524425aceb6636ba186c3aea80761ad042ee
7
+ data.tar.gz: 86ba0fd4e1e23f04adaa0dfce69400baac5adc05f1121c7910e9b872c67190bd8eea68e95da0470d5dd4a04d7695171660cb3ea24a20bfdd04e20cbad472f5d6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.320] - 2026-04-01
4
+
5
+ ### Changed
6
+ - Extract `open_config` helper to Hiiro instance method for reuse across config subcommands
7
+ - Refactor `h version --all` to use `Hiiro::Rbenv.capture` with clearer output formatting
8
+ - Add `to_s` method to `Hiiro::Tmux::Session` for string representation; rename existing `display` method for consistency
9
+ - Extract `project_dirs` and `projects_from_config` to singleton methods in Project plugin for testability
10
+
3
11
  ## [0.1.319] - 2026-04-01
4
12
 
5
13
  ### Added
@@ -257,4 +265,4 @@
257
265
  ## [0.1.295]
258
266
 
259
267
  ### Changed
260
- - Filter logic changes for PR management
268
+ - Filter logic changes for PR management
data/bin/h-config CHANGED
@@ -3,51 +3,46 @@
3
3
  require 'hiiro'
4
4
 
5
5
  Hiiro.run(*ARGV) {
6
- open_config = ->(dir:, file:) {
7
- full_path = File.expand_path(File.join(dir, file))
8
- Dir.chdir(File.expand_path(dir))
9
- edit_files(full_path)
10
- }
11
6
  add_subcmd(:vim) {
12
7
  dir = '~/.config/nvim'
13
8
  file = File.exist?(File.expand_path('~/.config/nvim/init.lua')) ? 'init.lua' : 'init.vim'
14
- open_config.(dir: dir, file: file)
9
+ open_config(dir: dir, file: file)
15
10
  }
16
11
 
17
12
  add_subcmd(:git) {
18
13
  make_child(subcmd, *args) {
19
14
  add_subcmd(:global) {
20
- open_config.(dir: '~', file: '.gitconfig')
15
+ open_config(dir: '~', file: '.gitconfig')
21
16
  }
22
17
 
23
18
  add_subcmd(:ignore) {
24
- open_config.(dir: '~/.config/git', file: 'ignore')
19
+ open_config(dir: '~/.config/git', file: 'ignore')
25
20
  }
26
21
 
27
22
  add_subcmd(:local) {
28
- root = `git rev-parse --show-toplevel`.chomp
29
- open_config.(dir: root, file: '.git/config')
23
+ root = `git rev-parse --show-toplevel`.chomp
24
+ open_config(dir: root, file: '.git/config')
30
25
  }
31
26
  }.run
32
27
  }
33
28
 
34
29
  add_subcmd(:tmux) {
35
- open_config.(dir: '~', file: '.tmux.conf')
30
+ open_config(dir: '~', file: '.tmux.conf')
36
31
  }
37
32
 
38
33
  add_subcmd(:zsh) {
39
- open_config.(dir: '~', file: '.zshrc')
34
+ open_config(dir: '~', file: '.zshrc')
40
35
  }
41
36
 
42
37
  add_subcmd(:profile) {
43
- open_config.(dir: '~', file: '.zprofile')
38
+ open_config(dir: '~', file: '.zprofile')
44
39
  }
45
40
 
46
41
  add_subcmd(:starship) {
47
- open_config.(dir: '~/.config/starship', file: 'starship.toml')
42
+ open_config(dir: '~/.config/starship', file: 'starship.toml')
48
43
  }
49
44
 
50
45
  add_subcmd(:claude) {
51
- open_config.(dir: '~/.claude', file: 'settings.json')
46
+ open_config(dir: '~/.claude', file: 'settings.json')
52
47
  }
53
48
  }
data/exe/h CHANGED
@@ -17,8 +17,9 @@ Hiiro.run(*ARGV, cwd: Dir.pwd, tasks: true) do
17
17
 
18
18
  add_cmd(:version, opts: %i[all]) { |*args|
19
19
  if @opts.all
20
- Hiiro::Rbenv.run_in_all('h', 'version') do |ver, _|
21
- # version output printed by the subprocess
20
+ Hiiro::Rbenv.versions.each do |ver|
21
+ output = Hiiro::Rbenv.capture('h', 'version', version: ver).strip
22
+ puts "ruby v#{ver} => #{output}"
22
23
  end
23
24
  else
24
25
  puts Hiiro::VERSION
@@ -101,6 +101,10 @@ class Hiiro
101
101
  end
102
102
 
103
103
  def to_s
104
+ name
105
+ end
106
+
107
+ def display
104
108
  "#{name} (#{windows} windows#{attached? ? ', attached' : ''})"
105
109
  end
106
110
  end
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.319"
2
+ VERSION = "0.1.320"
3
3
  end
data/lib/hiiro.rb CHANGED
@@ -221,6 +221,12 @@ class Hiiro
221
221
  end
222
222
  end
223
223
 
224
+ def open_config(dir:, file:)
225
+ full_path = File.expand_path(File.join(dir, file))
226
+ Dir.chdir(File.expand_path(dir))
227
+ edit_files(full_path)
228
+ end
229
+
224
230
  def tmux_client
225
231
  @tmux_client ||= Tmux.client!(self)
226
232
  end
data/plugins/project.rb CHANGED
@@ -2,9 +2,27 @@
2
2
 
3
3
  module Project
4
4
  def self.load(hiiro)
5
+ attach_methods(hiiro)
5
6
  add_subcommands(hiiro)
6
7
  end
7
8
 
9
+ def self.attach_methods(hiiro)
10
+ hiiro.define_singleton_method(:project_dirs) do
11
+ proj = File.join(Dir.home, 'proj')
12
+ return {} unless Dir.exist?(proj)
13
+ Dir.children(proj)
14
+ .select { |name| File.directory?(File.join(proj, name)) }
15
+ .each_with_object({}) { |name, h| h[name] = File.join(proj, name) }
16
+ end
17
+
18
+ hiiro.define_singleton_method(:projects_from_config) do
19
+ path = File.join(Dir.home, '.config', 'hiiro', 'projects.yml')
20
+ return {} unless File.exist?(path)
21
+ require 'yaml'
22
+ YAML.safe_load_file(path) || {}
23
+ end
24
+ end
25
+
8
26
  def self.add_subcommands(hiiro)
9
27
  hiiro.add_subcmd(:project) do |project_name|
10
28
  projects = Hiiro::Projects.new
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.319
4
+ version: 0.1.320
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota