hiiro 0.1.319 → 0.1.321

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: 155f21221068bb182837aa80c7b920edfb592d46003cc697761441fca7e104d4
4
+ data.tar.gz: c911e69d3f63924790edd1103f299450ee19bbf70587f54ab205817a0ed9956b
5
5
  SHA512:
6
- metadata.gz: e858ca0c1b70057dce4a6738e21d73512eb42ad6d12adc155a9bbc061b78e7e1d6a78b63dd651c8fcbe79a7d7e6196d79d5efd8c65b61f805e3e5c410e9aa26d
7
- data.tar.gz: 75c7733377ca2db3a5f91470c720fa1e7b391cbc007aa66da8a3b5df2f3f17403f63d2f8e9a2359898e3b507ec514399489583173a6d20ce24d869dcdc7e8da6
6
+ metadata.gz: e7f3f13b81a41a625160d27c7e90a093f20678cd835f5ef1eadc95999fa00c17b41eaac793135389573746e233120b41f94363f87e59bbffac1357c9a573db47
7
+ data.tar.gz: 195f053e63a71b2975b4fb29addb85893e91012b1482e08547169e762d4651d9397c0a228b9e29735b3e16928d37f2cee906281ed0e674155366806590e7bdaa
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.321] - 2026-04-01
4
+
5
+ ### Changed
6
+ - Extract `open_config` to `Hiiro::Config.open` singleton method; simplify parameter order from `dir:, file:` to positional `file, dir: nil`
7
+ - Update all config subcommands to use new `Hiiro::Config.open` interface
8
+
9
+ ## [0.1.320] - 2026-04-01
10
+
11
+ ### Changed
12
+ - Extract `open_config` helper to Hiiro instance method for reuse across config subcommands
13
+ - Refactor `h version --all` to use `Hiiro::Rbenv.capture` with clearer output formatting
14
+ - Add `to_s` method to `Hiiro::Tmux::Session` for string representation; rename existing `display` method for consistency
15
+ - Extract `project_dirs` and `projects_from_config` to singleton methods in Project plugin for testability
16
+
3
17
  ## [0.1.319] - 2026-04-01
4
18
 
5
19
  ### Added
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(file, dir: dir)
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('.gitconfig', dir: '~')
21
16
  }
22
17
 
23
18
  add_subcmd(:ignore) {
24
- open_config.(dir: '~/.config/git', file: 'ignore')
19
+ open_config('ignore', dir: '~/.config/git')
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('.git/config', dir: root)
30
25
  }
31
26
  }.run
32
27
  }
33
28
 
34
29
  add_subcmd(:tmux) {
35
- open_config.(dir: '~', file: '.tmux.conf')
30
+ open_config('.tmux.conf', dir: '~')
36
31
  }
37
32
 
38
33
  add_subcmd(:zsh) {
39
- open_config.(dir: '~', file: '.zshrc')
34
+ open_config('.zshrc', dir: '~')
40
35
  }
41
36
 
42
37
  add_subcmd(:profile) {
43
- open_config.(dir: '~', file: '.zprofile')
38
+ open_config('.zprofile', dir: '~')
44
39
  }
45
40
 
46
41
  add_subcmd(:starship) {
47
- open_config.(dir: '~/.config/starship', file: 'starship.toml')
42
+ open_config('starship.toml', dir: '~/.config/starship')
48
43
  }
49
44
 
50
45
  add_subcmd(:claude) {
51
- open_config.(dir: '~/.claude', file: 'settings.json')
46
+ open_config('settings.json', dir: '~/.claude')
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
data/lib/hiiro/config.rb CHANGED
@@ -4,6 +4,13 @@ class Hiiro
4
4
  DATA_DIR = File.join(Dir.home, '.local/share/hiiro')
5
5
 
6
6
  class << self
7
+ def open(file, dir: nil)
8
+ dir_path = File.expand_path(dir || '~')
9
+ full_path = File.expand_path(file, dir_path)
10
+ Dir.chdir(dir_path)
11
+ system(ENV['EDITOR'] || 'vim', full_path)
12
+ end
13
+
7
14
  def path(relpath='')
8
15
  File.join(BASE_DIR, relpath)
9
16
  end
@@ -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.321"
3
3
  end
data/lib/hiiro.rb CHANGED
@@ -221,6 +221,10 @@ class Hiiro
221
221
  end
222
222
  end
223
223
 
224
+ def open_config(file, dir: nil)
225
+ Hiiro::Config.open(file, dir: dir)
226
+ end
227
+
224
228
  def tmux_client
225
229
  @tmux_client ||= Tmux.client!(self)
226
230
  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.321
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota