hiiro 0.1.24 → 0.1.25

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.
data/bin/h-video CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- load '/Users/unixsuperhero/bin/h'
2
+
3
+ require 'hiiro'
3
4
 
4
5
  o = Hiiro.init(*ARGV)
5
6
 
data/bin/h-vim ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hiiro'
4
+
5
+ BASE_DIR = CONFIG_DIR = File.join(Dir.home, '.config/nvim')
6
+ TMUX_SESSION_NAME = 'vim'
7
+
8
+ o = Hiiro.init(*ARGV, plugins: [Tmux, Pins, Project])
9
+
10
+ o.add_subcmd(:edit) { |*args|
11
+ nvim = ENV['EDITOR']
12
+ system(nvim, __FILE__)
13
+ }
14
+
15
+ o.add_subcmd(:path) { |*args|
16
+ print BASE_DIR
17
+ }
18
+
19
+ o.add_subcmd(:init, :config) { |*args|
20
+ nvim = ENV['EDITOR']
21
+
22
+ Dir.chdir(BASE_DIR)
23
+ system(nvim, 'init.lua')
24
+ }
25
+
26
+ o.add_subcmd(:skf) { |*args|
27
+ Dir.chdir(BASE_DIR)
28
+ system('skf', *args)
29
+ }
30
+
31
+ o.add_subcmd(:rg) { |*args|
32
+ Dir.chdir(BASE_DIR)
33
+ system('rg', '-S', *args)
34
+ }
35
+
36
+ o.add_subcmd(:rgall) { |*args|
37
+ Dir.chdir(BASE_DIR)
38
+ system('rg', '-S', '--no-ignore-vcs', *args)
39
+ }
40
+
41
+ o.add_subcmd(:session) { |*args|
42
+ Dir.chdir(BASE_DIR)
43
+
44
+ o.switch_to_tmux_session(TMUX_SESSION_NAME)
45
+ }
46
+
47
+ # basically call :session
48
+ o.add_subcmd(:tmux) { |*args|
49
+ Dir.chdir(BASE_DIR)
50
+
51
+ o.switch_to_tmux_session(TMUX_SESSION_NAME)
52
+ }
53
+
54
+ if o.runnable?
55
+ o.run
56
+ else
57
+ puts format('ERROR: %s', :no_runnable_found)
58
+
59
+ puts
60
+
61
+ o.help
62
+ end
63
+
data/lib/hiiro/history.rb CHANGED
@@ -7,7 +7,7 @@ class Hiiro
7
7
  HISTORY_FILE = File.join(Dir.home, '.config/hiiro/history.yml')
8
8
 
9
9
  class Entry
10
- attr_reader :id, :timestamp, :source, :cmd, :description, :pwd
10
+ attr_reader :id, :timestamp, :source, :cmd, :description
11
11
  attr_reader :tmux_session, :tmux_window, :tmux_pane
12
12
  attr_reader :git_branch, :git_worktree
13
13
  attr_reader :task, :subtask
@@ -18,7 +18,6 @@ class Hiiro
18
18
  @timestamp = data['timestamp']
19
19
  @source = data['source']
20
20
  @cmd = data['cmd']
21
- @pwd = data['pwd'] || Dir.pwd
22
21
  @description = data['description']
23
22
  @tmux_session = data['tmux_session']
24
23
  @tmux_window = data['tmux_window']
@@ -35,7 +34,6 @@ class Hiiro
35
34
  'timestamp' => timestamp,
36
35
  'source' => source,
37
36
  'cmd' => cmd,
38
- 'pwd' => pwd,
39
37
  'description' => description,
40
38
  'tmux_session' => tmux_session,
41
39
  'tmux_window' => tmux_window,
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.24"
2
+ VERSION = "0.1.25"
3
3
  end
data/script/sync ADDED
@@ -0,0 +1,107 @@
1
+ #!/bin/bash
2
+
3
+ # Compare directories interactively
4
+ # This script compares bin/ and .config/hiiro/ with their counterparts in $OTHER_DIR
5
+
6
+ set -e
7
+
8
+ REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
9
+ cd "$REPO_DIR"
10
+
11
+ OTHER_DIR="$REPO_DIR/../home/"
12
+
13
+ echo "Comparing directories with $OTHER_DIR"
14
+ echo "Repository: $REPO_DIR ($0)"
15
+ echo "Other Dir: $OTHER_DIR"
16
+ echo
17
+
18
+ # Function to prompt for y/n
19
+ ask_yn() {
20
+ local prompt="$1"
21
+ local response
22
+ read -p "$prompt (y/N): " response </dev/tty
23
+ [[ "$response" =~ ^[yY]$ ]]
24
+ }
25
+
26
+ # Function to copy file with confirmation
27
+ handle_copy() {
28
+ local src="$1"
29
+ local dst="$2"
30
+ local direction="$3"
31
+
32
+ echo
33
+ echo "File only in $direction: $src"
34
+ if ask_yn "Copy to $dst?"; then
35
+ mkdir -p "$(dirname "$dst")"
36
+ cp -v "$src" "$dst"
37
+ echo "Copied!"
38
+ else
39
+ echo "Skipped."
40
+ fi
41
+ }
42
+
43
+ # Function to diff files with confirmation
44
+ handle_diff() {
45
+ local file1="$1"
46
+ local file2="$2"
47
+
48
+ echo
49
+ echo "DIFFERENT: $file1 <=> $file2"
50
+ if ask_yn "Open in vim diff?"; then
51
+ nvim -d "$file1" "$file2" </dev/tty >/dev/tty
52
+ else
53
+ echo "Skipped."
54
+ fi
55
+ }
56
+
57
+ # Process diff output for a directory pair
58
+ process_diff() {
59
+ local repo_dir="$1"
60
+ local home_dir="$2"
61
+
62
+ echo "========================================="
63
+ echo "Comparing: $repo_dir <=> $home_dir"
64
+ echo "========================================="
65
+
66
+ # Use diff -qrs and process line by line
67
+ while IFS= read -r line; do
68
+ if [[ "$line" =~ ^"Only in "(.*)": "(.*) ]]; then
69
+ local dir="${BASH_REMATCH[1]}"
70
+ local file="${BASH_REMATCH[2]}"
71
+ local full_path="$dir/$file"
72
+
73
+ # Determine if it's only in repo or only in home
74
+ if [[ "$full_path" == "$repo_dir"* ]]; then
75
+ # Only in repo, offer to copy to home
76
+ local rel_path="${full_path#$repo_dir}"
77
+ handle_copy "$full_path" "$home_dir$rel_path" "repository"
78
+ else
79
+ # Only in home, offer to copy to repo
80
+ local rel_path="${full_path#$home_dir}"
81
+ handle_copy "$full_path" "$repo_dir$rel_path" "home directory"
82
+ fi
83
+
84
+ elif [[ "$line" =~ ^"Files "(.+)" and "(.+)" differ"$ ]]; then
85
+ local file1="${BASH_REMATCH[1]}"
86
+ local file2="${BASH_REMATCH[2]}"
87
+ handle_diff "$file1" "$file2"
88
+ fi
89
+ done < <(diff -qrs "$repo_dir" "$home_dir" 2>/dev/null)
90
+
91
+ echo
92
+ }
93
+
94
+ # Compare bin directories
95
+ if [[ -d "bin" && -d "$OTHER_DIR/bin" ]]; then
96
+ process_diff "$REPO_DIR/bin/" "$OTHER_DIR/bin/"
97
+ fi
98
+
99
+ # Compare .config directories
100
+ if [[ -d ".config" && -d "$OTHER_DIR/.config" ]]; then
101
+ process_diff "$REPO_DIR/.config/hiiro/" "$OTHER_DIR/.config/hiiro/"
102
+ fi
103
+
104
+ echo "========================================="
105
+ echo "Sync complete!"
106
+ echo "========================================="
107
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-28 00:00:00.000000000 Z
11
+ date: 2026-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -38,17 +38,31 @@ files:
38
38
  - LICENSE
39
39
  - README.md
40
40
  - Rakefile
41
+ - bin/g-pr
41
42
  - bin/h
42
43
  - bin/h-branch
43
44
  - bin/h-buffer
45
+ - bin/h-dot
46
+ - bin/h-dotfiles
47
+ - bin/h-home
48
+ - bin/h-html
44
49
  - bin/h-link
50
+ - bin/h-mic
51
+ - bin/h-note
45
52
  - bin/h-pane
46
53
  - bin/h-plugin
47
54
  - bin/h-pr
55
+ - bin/h-pr-monitor
56
+ - bin/h-pr-watch
57
+ - bin/h-project
58
+ - bin/h-runtask
59
+ - bin/h-serve
48
60
  - bin/h-session
61
+ - bin/h-sha
49
62
  - bin/h-subtask
50
63
  - bin/h-task
51
64
  - bin/h-video
65
+ - bin/h-vim
52
66
  - bin/h-window
53
67
  - bin/h-wtree
54
68
  - docs/README.md
@@ -72,6 +86,7 @@ files:
72
86
  - script/compare
73
87
  - script/install
74
88
  - script/publish
89
+ - script/sync
75
90
  homepage: https://github.com/unixsuperhero/hiiro
76
91
  licenses:
77
92
  - MIT