hiiro 0.1.0

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/docs/h-pane.md ADDED
@@ -0,0 +1,71 @@
1
+ # h-pane
2
+
3
+ Tmux pane management.
4
+
5
+ [← Back to docs](README.md) | [← Back to main README](../README.md)
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ h pane <subcommand> [args...]
11
+ ```
12
+
13
+ ## Subcommands
14
+
15
+ | Command | Description | Tmux equivalent |
16
+ |---------|-------------|-----------------|
17
+ | `ls` | List panes in current window | `tmux list-panes` |
18
+ | `lsa` | List all panes in all sessions | `tmux list-panes -a` |
19
+ | `split` | Split pane (default: vertical) | `tmux split-window` |
20
+ | `splitv` | Split pane vertically | `tmux split-window -v` |
21
+ | `splith` | Split pane horizontally | `tmux split-window -h` |
22
+ | `kill` | Kill current pane | `tmux kill-pane` |
23
+ | `swap` | Swap panes | `tmux swap-pane` |
24
+ | `zoom` | Toggle pane zoom | `tmux resize-pane -Z` |
25
+ | `capture` | Capture pane contents | `tmux capture-pane` |
26
+ | `select` | Select a pane | `tmux select-pane` |
27
+ | `move` | Move pane to another window | `tmux move-pane` |
28
+ | `break` | Break pane into new window | `tmux break-pane` |
29
+ | `join` | Join pane from another window | `tmux join-pane` |
30
+ | `resize` | Resize pane | `tmux resize-pane` |
31
+
32
+ ## Examples
33
+
34
+ ```sh
35
+ # List panes in current window
36
+ h pane ls
37
+
38
+ # Split horizontally (side by side)
39
+ h pane splith
40
+
41
+ # Split vertically (top/bottom)
42
+ h pane splitv
43
+
44
+ # Toggle zoom on current pane
45
+ h pane zoom
46
+
47
+ # Kill current pane
48
+ h pane kill
49
+
50
+ # Swap with the next pane
51
+ h pane swap -D
52
+
53
+ # Select pane by index
54
+ h pane select -t 2
55
+
56
+ # Resize current pane
57
+ h pane resize -D 10 # Grow down by 10 lines
58
+ h pane resize -R 20 # Grow right by 20 columns
59
+
60
+ # Break current pane into a new window
61
+ h pane break
62
+
63
+ # Join pane from window 3 into current window
64
+ h pane join -s :3
65
+ ```
66
+
67
+ ## Notes
68
+
69
+ - Pane indices start at 0
70
+ - Use `-t` to target specific panes (e.g., `-t 0`, `-t :.1`)
71
+ - All subcommands pass additional arguments directly to the underlying tmux command
data/docs/h-plugin.md ADDED
@@ -0,0 +1,58 @@
1
+ # h-plugin
2
+
3
+ Hiiro plugin management and exploration.
4
+
5
+ [← Back to docs](README.md) | [← Back to main README](../README.md)
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ h plugin <subcommand> [args...]
11
+ ```
12
+
13
+ ## Subcommands
14
+
15
+ | Command | Description |
16
+ |---------|-------------|
17
+ | `path` | Print the plugins directory path |
18
+ | `ls` | List all plugin files |
19
+ | `edit` | Edit plugin file(s) in your editor |
20
+ | `rg` | Search plugin code (smart-case) |
21
+ | `rgall` | Search plugin code (include VCS-ignored files) |
22
+
23
+ ## Examples
24
+
25
+ ```sh
26
+ # Get the plugins directory
27
+ h plugin path
28
+ # => ~/.config/hiiro/plugins
29
+
30
+ # List all plugins
31
+ h plugin ls
32
+
33
+ # Edit the h-plugin script itself
34
+ h plugin edit
35
+
36
+ # Edit specific plugin(s) by prefix
37
+ h plugin edit pins # Edit pins.rb
38
+ h plugin edit task project # Edit task.rb and project.rb
39
+
40
+ # Search for a method across all plugins
41
+ h plugin rg "def load"
42
+
43
+ # Search with regex
44
+ h plugin rg "add_subcmd.*:session"
45
+
46
+ # Include normally-ignored files
47
+ h plugin rgall "TODO"
48
+ ```
49
+
50
+ ## Plugin Location
51
+
52
+ Plugins are stored in `~/.config/hiiro/plugins/`. Files in this directory are automatically loaded by Hiiro.
53
+
54
+ ## Notes
55
+
56
+ - The `rg` command uses ripgrep with smart-case matching (`-S`)
57
+ - The `edit` command uses `$EDITOR` or falls back to `safe_nvim`
58
+ - Plugin names are matched by prefix, so `h plugin edit pi` would match `pins.rb`
data/docs/h-session.md ADDED
@@ -0,0 +1,63 @@
1
+ # h-session
2
+
3
+ Tmux session management.
4
+
5
+ [← Back to docs](README.md) | [← Back to main README](../README.md)
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ h session <subcommand> [args...]
11
+ ```
12
+
13
+ ## Subcommands
14
+
15
+ | Command | Description | Tmux equivalent |
16
+ |---------|-------------|-----------------|
17
+ | `ls` | List all sessions | `tmux list-sessions` |
18
+ | `new` | Create a new session | `tmux new-session` |
19
+ | `kill` | Kill a session | `tmux kill-session` |
20
+ | `attach` | Attach to a session | `tmux attach-session` |
21
+ | `rename` | Rename a session | `tmux rename-session` |
22
+ | `switch` | Switch to another session | `tmux switch-client` |
23
+ | `detach` | Detach from current session | `tmux detach-client` |
24
+ | `has` | Check if session exists | `tmux has-session` |
25
+ | `info` | Show current session info | `tmux display-message` |
26
+
27
+ ## Examples
28
+
29
+ ```sh
30
+ # List all sessions
31
+ h session ls
32
+
33
+ # Create a new session named "work"
34
+ h session new -s work
35
+
36
+ # Create detached session
37
+ h session new -d -s background
38
+
39
+ # Attach to a session
40
+ h session attach -t work
41
+
42
+ # Kill a session
43
+ h session kill -t old-session
44
+
45
+ # Rename current session
46
+ h session rename newname
47
+
48
+ # Switch to another session
49
+ h session switch -t other
50
+
51
+ # Check if session exists (useful in scripts)
52
+ h session has -t mysession && echo "exists"
53
+
54
+ # Show current session info
55
+ h session info
56
+ # => mysession: 5 windows, 1 attached
57
+ ```
58
+
59
+ ## Notes
60
+
61
+ - Use `-t` to target specific sessions
62
+ - All subcommands pass additional arguments directly to the underlying tmux command
63
+ - The `info` command shows session name, window count, and attach count
data/docs/h-video.md ADDED
@@ -0,0 +1,172 @@
1
+ # h-video
2
+
3
+ FFmpeg wrapper for common video operations.
4
+
5
+ [← Back to docs](README.md) | [← Back to main README](../README.md)
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ h video <subcommand> <input_file> [args...]
11
+ ```
12
+
13
+ ## Requirements
14
+
15
+ - FFmpeg and FFprobe must be installed
16
+
17
+ ## Subcommands
18
+
19
+ ### Info / Inspection
20
+
21
+ | Command | Description |
22
+ |---------|-------------|
23
+ | `info <file>` | Human-readable video summary |
24
+ | `streams <file>` | List all streams (video, audio, subs) |
25
+ | `duration <file>` | Get video duration |
26
+ | `metadata <file>` | Show metadata as JSON |
27
+ | `list_subs <file>` | List subtitle tracks |
28
+ | `help` | Show full command reference |
29
+
30
+ ### Resizing
31
+
32
+ | Command | Description |
33
+ |---------|-------------|
34
+ | `resize <file> [height] [out]` | Resize to height (default 720) |
35
+ | `resize720 <file> [out]` | Resize to 720p |
36
+ | `resize1080 <file> [out]` | Resize to 1080p |
37
+
38
+ ### Format Conversion
39
+
40
+ | Command | Description |
41
+ |---------|-------------|
42
+ | `convert <file> <format> [out]` | Convert to format (mp4, mkv, webm, etc.) |
43
+ | `to_mp4 <file> [out]` | Convert to MP4 (H.264/AAC) |
44
+ | `to_webm <file> [out]` | Convert to WebM (VP9/Opus) |
45
+ | `to_mkv <file> [out]` | Remux to MKV container |
46
+
47
+ ### Audio Extraction
48
+
49
+ | Command | Description |
50
+ |---------|-------------|
51
+ | `audio <file> [out]` | Extract audio as MP3 |
52
+ | `audio_wav <file> [out]` | Extract audio as WAV |
53
+ | `audio_aac <file> [out]` | Extract audio as AAC |
54
+ | `audio_flac <file> [out]` | Extract audio as FLAC |
55
+ | `mute <file> [out]` | Remove audio track |
56
+ | `replace_audio <video> <audio> [out]` | Replace audio track |
57
+ | `volume <file> <level> [out]` | Adjust volume (2.0 = 2x, 0.5 = half) |
58
+
59
+ ### Clipping
60
+
61
+ | Command | Description |
62
+ |---------|-------------|
63
+ | `clip <file> <start> <duration> [out]` | Extract clip by duration |
64
+ | `clip_to <file> <start> <end> [out]` | Extract clip by end time |
65
+ | `clip_precise <file> <start> <dur> [out]` | Re-encoded clip (more accurate) |
66
+
67
+ ### Subtitles
68
+
69
+ | Command | Description |
70
+ |---------|-------------|
71
+ | `subs <file> [stream_idx] [out]` | Extract subtitle track (default: first) |
72
+ | `subs_all <file>` | Extract all subtitle tracks |
73
+
74
+ ### Images / Thumbnails
75
+
76
+ | Command | Description |
77
+ |---------|-------------|
78
+ | `thumbnail <file> [time] [out]` | Extract single frame |
79
+ | `thumbnails <file> [interval] [pattern]` | Extract frames every N seconds |
80
+
81
+ ### GIF Creation
82
+
83
+ | Command | Description |
84
+ |---------|-------------|
85
+ | `gif <file> [start] [duration] [out]` | Create GIF (standard quality) |
86
+ | `gif_hq <file> [start] [duration] [out]` | Create high-quality GIF |
87
+
88
+ ### Transformation
89
+
90
+ | Command | Description |
91
+ |---------|-------------|
92
+ | `speed <file> <factor> [out]` | Change speed (2.0 = 2x faster) |
93
+ | `rotate <file> [dir] [out]` | Rotate (cw, ccw, 180) |
94
+ | `flip_h <file> [out]` | Flip horizontally |
95
+ | `flip_v <file> [out]` | Flip vertically |
96
+ | `crop <file> <w:h:x:y> [out]` | Crop video |
97
+ | `fps <file> <rate> [out]` | Change frame rate |
98
+
99
+ ### Compression
100
+
101
+ | Command | Description |
102
+ |---------|-------------|
103
+ | `compress <file> [crf] [out]` | Compress (crf: 18-28, higher = smaller) |
104
+ | `compress_small <file> [out]` | Aggressive compression + 480p |
105
+
106
+ ### Other
107
+
108
+ | Command | Description |
109
+ |---------|-------------|
110
+ | `concat <file1> <file2> ... <out>` | Join multiple videos |
111
+ | `strip_metadata <file> [out]` | Remove all metadata |
112
+
113
+ ## Examples
114
+
115
+ ```sh
116
+ # Get video info
117
+ h video info movie.mp4
118
+
119
+ # Resize to 720p
120
+ h video resize720 movie.mp4
121
+
122
+ # Convert MKV to MP4
123
+ h video to_mp4 movie.mkv
124
+
125
+ # Extract 60 seconds starting at 1:30
126
+ h video clip movie.mp4 00:01:30 60
127
+
128
+ # Extract clip from 1:30 to 2:30
129
+ h video clip_to movie.mp4 00:01:30 00:02:30
130
+
131
+ # Create a GIF from the first 10 seconds
132
+ h video gif movie.mp4 00:00:00 10
133
+
134
+ # Extract audio as MP3
135
+ h video audio movie.mp4
136
+
137
+ # Double the playback speed
138
+ h video speed movie.mp4 2.0
139
+
140
+ # Rotate 90 degrees clockwise
141
+ h video rotate movie.mp4 cw
142
+
143
+ # Compress with CRF 28 (more compression)
144
+ h video compress movie.mp4 28
145
+
146
+ # Concatenate videos
147
+ h video concat part1.mp4 part2.mp4 part3.mp4 output.mp4
148
+
149
+ # Extract thumbnail at 30 seconds
150
+ h video thumbnail movie.mp4 00:00:30
151
+ ```
152
+
153
+ ## Time Format
154
+
155
+ Time can be specified as:
156
+ - `HH:MM:SS` (e.g., `01:30:00` for 1 hour 30 minutes)
157
+ - `MM:SS` (e.g., `05:30` for 5 minutes 30 seconds)
158
+ - Seconds (e.g., `90` for 1 minute 30 seconds)
159
+
160
+ ## Output Files
161
+
162
+ If no output file is specified, files are automatically named based on the operation:
163
+ - `movie.720p.mp4` for resize operations
164
+ - `movie.clip_00-01-30.mp4` for clip operations
165
+ - `movie.audio.mp3` for audio extraction
166
+ - etc.
167
+
168
+ ## Notes
169
+
170
+ - All commands pass through to FFmpeg
171
+ - The `clip` commands use stream copy (`-c copy`) for speed; use `clip_precise` for frame-accurate cuts
172
+ - GIF operations use palette generation for better quality
data/docs/h-window.md ADDED
@@ -0,0 +1,77 @@
1
+ # h-window
2
+
3
+ Tmux window management.
4
+
5
+ [← Back to docs](README.md) | [← Back to main README](../README.md)
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ h window <subcommand> [args...]
11
+ ```
12
+
13
+ ## Subcommands
14
+
15
+ | Command | Description | Tmux equivalent |
16
+ |---------|-------------|-----------------|
17
+ | `ls` | List windows in current session | `tmux list-windows` |
18
+ | `lsa` | List all windows in all sessions | `tmux list-windows -a` |
19
+ | `new` | Create a new window | `tmux new-window` |
20
+ | `kill` | Kill current window | `tmux kill-window` |
21
+ | `rename` | Rename current window | `tmux rename-window` |
22
+ | `swap` | Swap windows | `tmux swap-window` |
23
+ | `move` | Move window | `tmux move-window` |
24
+ | `select` | Select a window | `tmux select-window` |
25
+ | `next` | Go to next window | `tmux next-window` |
26
+ | `prev` | Go to previous window | `tmux previous-window` |
27
+ | `last` | Go to last active window | `tmux last-window` |
28
+ | `link` | Link window to another session | `tmux link-window` |
29
+ | `unlink` | Unlink window from session | `tmux unlink-window` |
30
+
31
+ ## Examples
32
+
33
+ ```sh
34
+ # List windows in current session
35
+ h window ls
36
+
37
+ # List all windows across all sessions
38
+ h window lsa
39
+
40
+ # Create a new window
41
+ h window new
42
+
43
+ # Create window with a name
44
+ h window new -n editor
45
+
46
+ # Create window running a command
47
+ h window new -n logs "tail -f /var/log/syslog"
48
+
49
+ # Kill window by index
50
+ h window kill -t 3
51
+
52
+ # Rename current window
53
+ h window rename mywindow
54
+
55
+ # Navigate windows
56
+ h window next
57
+ h window prev
58
+ h window last
59
+
60
+ # Select window by index
61
+ h window select -t 2
62
+
63
+ # Swap current window with window 1
64
+ h window swap -t 1
65
+
66
+ # Move window to index 5
67
+ h window move -t 5
68
+
69
+ # Link window 2 to session "other"
70
+ h window link -s :2 -t other:
71
+ ```
72
+
73
+ ## Notes
74
+
75
+ - Window indices typically start at 0 or 1 depending on `base-index` setting
76
+ - Use `-t` to target specific windows (e.g., `-t 0`, `-t :2`, `-t session:window`)
77
+ - All subcommands pass additional arguments directly to the underlying tmux command
data/exe/hiiro ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "hiiro"
4
+
5
+ Hiiro.load_env
6
+
7
+ hiiro = Hiiro.init(*ARGV, cwd: Dir.pwd)
8
+
9
+ hiiro.add_subcommand(:ping) { |*args|
10
+ puts "pong"
11
+ }
12
+
13
+ hiiro.run
data/hiiro.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ require_relative "lib/hiiro/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "hiiro"
5
+ spec.version = Hiiro::VERSION
6
+ spec.authors = ["Joshua Toyota"]
7
+ spec.email = ["jearsh+rubygems@gmail.com"]
8
+
9
+ spec.summary = "A lightweight CLI framework for Ruby"
10
+ spec.description = "Build multi-command CLI tools with subcommand dispatch, abbreviation matching, and a plugin system. Similar to git or docker command structure."
11
+ spec.homepage = "https://github.com/unixsuperhero/hiiro"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = ">= 2.7.0"
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = spec.homepage
17
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
18
+
19
+ spec.files = Dir.chdir(__dir__) do
20
+ `git ls-files -z`.split("\x0").reject do |f|
21
+ (File.expand_path(f) == __FILE__) ||
22
+ f.start_with?(*%w[test/ spec/ features/ .git .github .circleci appveyor Gemfile])
23
+ end
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "pry", "~> 0.14"
30
+ end
@@ -0,0 +1,3 @@
1
+ class Hiiro
2
+ VERSION = "0.1.0"
3
+ end