shellfie 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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE +21 -0
- data/README.md +334 -0
- data/Rakefile +8 -0
- data/assets/logo-header.svg +28 -0
- data/examples/animation.yml +33 -0
- data/examples/colored.yml +20 -0
- data/examples/demo.gif +0 -0
- data/examples/demo.png +0 -0
- data/examples/demo_animation.yml +31 -0
- data/examples/headless.png +0 -0
- data/examples/headless.yml +16 -0
- data/examples/scrolling.yml +48 -0
- data/examples/simple.yml +21 -0
- data/examples/theme_macos.png +0 -0
- data/examples/theme_ubuntu.png +0 -0
- data/examples/theme_windows.png +0 -0
- data/exe/shellfie +6 -0
- data/exe/shf +5 -0
- data/lib/shellfie/ansi_parser.rb +174 -0
- data/lib/shellfie/cli.rb +228 -0
- data/lib/shellfie/config.rb +65 -0
- data/lib/shellfie/errors.rb +15 -0
- data/lib/shellfie/gif_generator.rb +151 -0
- data/lib/shellfie/parser.rb +90 -0
- data/lib/shellfie/renderer.rb +193 -0
- data/lib/shellfie/themes/base.rb +72 -0
- data/lib/shellfie/themes/macos.rb +51 -0
- data/lib/shellfie/themes/ubuntu.rb +57 -0
- data/lib/shellfie/themes/windows_terminal.rb +64 -0
- data/lib/shellfie/version.rb +5 -0
- data/lib/shellfie.rb +13 -0
- data/shellfie.gemspec +32 -0
- metadata +94 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 46760e7b2e717d05b20f4b49ecfe30103d095f1c126ebb109559ec8e236daf1a
|
|
4
|
+
data.tar.gz: 47fca65e39eccbc0dddbccade78ff6e8b27b24cd8bda0853f2017ee472056e68
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 01605eb1dd8f3646c6ab11d98f08ffd2d2d8e5d4e5df3cfabdcbe0e95e5df741917d620ddb7614a191a8e797fd278a3d5087d3f950b4946538d19db1736b2a80
|
|
7
|
+
data.tar.gz: bc14ce8030892f052097967507563b26e229e804f82f59daeead282c1a9a7c60557773fcf4f8e69584d738c78aad4d0095cda5f9636dc518f5eba49f81d67af6
|
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yudai Takada
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo-header.svg" alt="shellfie header logo">
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Generate beautiful terminal screenshots from YAML</strong>
|
|
5
|
+
</p>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://rubygems.org/gems/shellfie"><img src="https://img.shields.io/gem/v/shellfie.svg?colorB=319e8c" alt="Gem Version"></a>
|
|
8
|
+
<a href="https://rubygems.org/gems/shellfie"><img src="https://img.shields.io/gem/dt/shellfie.svg" alt="Downloads"></a>
|
|
9
|
+
<img src="https://img.shields.io/badge/ruby-%3E%3D%203.0-ruby.svg" alt="Ruby Version">
|
|
10
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
|
|
11
|
+
</p>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="#features">Features</a> •
|
|
16
|
+
<a href="#installation">Installation</a> •
|
|
17
|
+
<a href="#usage">Usage</a> •
|
|
18
|
+
<a href="#configuration">Configuration</a> •
|
|
19
|
+
<a href="#themes">Themes</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
**Shellfie** (Shell + Selfie) creates stunning terminal screenshot-style images from simple YAML configuration files. Perfect for documentation, README files, tutorials, and presentations — without actually taking screenshots.
|
|
25
|
+
|
|
26
|
+
<p align="center">
|
|
27
|
+
<img src="examples/demo.gif" alt="Shellfie Demo" width="550">
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
|
|
32
|
+
### Multiple Themes
|
|
33
|
+
|
|
34
|
+
Generate images with different terminal styles:
|
|
35
|
+
|
|
36
|
+
<table>
|
|
37
|
+
<tr>
|
|
38
|
+
<th>macOS</th>
|
|
39
|
+
<th>Ubuntu</th>
|
|
40
|
+
<th>Windows</th>
|
|
41
|
+
</tr>
|
|
42
|
+
<tr>
|
|
43
|
+
<td><img src="examples/theme_macos.png" width="280" alt="macOS theme"></td>
|
|
44
|
+
<td><img src="examples/theme_ubuntu.png" width="280" alt="Ubuntu theme"></td>
|
|
45
|
+
<td><img src="examples/theme_windows.png" width="280" alt="Windows theme"></td>
|
|
46
|
+
</tr>
|
|
47
|
+
</table>
|
|
48
|
+
|
|
49
|
+
### Animated GIFs
|
|
50
|
+
|
|
51
|
+
Create typing animations with realistic effects:
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
animation:
|
|
55
|
+
typing_speed: 50 # Milliseconds per character
|
|
56
|
+
command_delay: 500 # Pause after command
|
|
57
|
+
loop: true # Loop animation
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Full ANSI Color Support
|
|
61
|
+
|
|
62
|
+
- Standard 8 colors + bright variants
|
|
63
|
+
- 256-color palette
|
|
64
|
+
- True color (24-bit RGB)
|
|
65
|
+
- Bold, italic, underline styles
|
|
66
|
+
|
|
67
|
+
### Flexible Output Options
|
|
68
|
+
|
|
69
|
+
- **High DPI support** — Generate 2x or 3x scaled images for Retina displays
|
|
70
|
+
- **Headless mode** — Output without window decorations
|
|
71
|
+
- **Shadow effects** — Beautiful drop shadows
|
|
72
|
+
- **Transparent backgrounds** — Perfect for overlays
|
|
73
|
+
- **Fixed height with scrolling** — Consistent GIF dimensions
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
### Requirements
|
|
78
|
+
|
|
79
|
+
- Ruby 3.0+
|
|
80
|
+
- ImageMagick 7.0+
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Install ImageMagick first
|
|
84
|
+
brew install imagemagick # macOS
|
|
85
|
+
sudo apt install imagemagick # Ubuntu/Debian
|
|
86
|
+
choco install imagemagick # Windows
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Install the gem
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
gem install shellfie
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Or add to your Gemfile:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
gem 'shellfie'
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
### Quick Start
|
|
104
|
+
|
|
105
|
+
1. Create a configuration file:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
# terminal.yml
|
|
109
|
+
theme: macos
|
|
110
|
+
title: "Terminal — zsh"
|
|
111
|
+
|
|
112
|
+
window:
|
|
113
|
+
width: 600
|
|
114
|
+
padding: 20
|
|
115
|
+
|
|
116
|
+
lines:
|
|
117
|
+
- prompt: "$ "
|
|
118
|
+
command: "echo 'Hello, World!'"
|
|
119
|
+
- output: "Hello, World!"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
2. Generate an image:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
shellfie generate terminal.yml -o output.png
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Commands
|
|
129
|
+
|
|
130
|
+
| Command | Description |
|
|
131
|
+
|---------|-------------|
|
|
132
|
+
| `shellfie generate <file> -o <output>` | Generate image from config |
|
|
133
|
+
| `shellfie init` | Output sample configuration |
|
|
134
|
+
| `shellfie themes` | List available themes |
|
|
135
|
+
| `shellfie validate <file>` | Validate configuration |
|
|
136
|
+
| `shellfie version` | Show version |
|
|
137
|
+
| `shellfie help` | Show help |
|
|
138
|
+
|
|
139
|
+
> [!TIP]
|
|
140
|
+
> Use `shf` as a shorter alias for `shellfie`
|
|
141
|
+
|
|
142
|
+
### Generate Options
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
shellfie generate config.yml -o output.png [options]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
| Option | Description |
|
|
149
|
+
|--------|-------------|
|
|
150
|
+
| `-o, --output PATH` | Output file path (required) |
|
|
151
|
+
| `-t, --theme NAME` | Override theme (`macos`, `ubuntu`, `windows`) |
|
|
152
|
+
| `-a, --animate` | Generate animated GIF |
|
|
153
|
+
| `-s, --scale FACTOR` | Output scale (1, 2, 3) for HiDPI |
|
|
154
|
+
| `-w, --width PIXELS` | Override width |
|
|
155
|
+
| `--no-shadow` | Disable shadow effect |
|
|
156
|
+
| `--no-header` | Disable window header (headless mode) |
|
|
157
|
+
| `--transparent` | Transparent background |
|
|
158
|
+
|
|
159
|
+
### Examples
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Basic PNG
|
|
163
|
+
shellfie generate config.yml -o terminal.png
|
|
164
|
+
|
|
165
|
+
# Animated GIF
|
|
166
|
+
shellfie generate config.yml -o demo.gif --animate
|
|
167
|
+
|
|
168
|
+
# Retina-ready (2x scale)
|
|
169
|
+
shellfie generate config.yml -o terminal@2x.png --scale 2
|
|
170
|
+
|
|
171
|
+
# Headless (no window decorations)
|
|
172
|
+
shellfie generate config.yml -o code.png --no-header
|
|
173
|
+
|
|
174
|
+
# Ubuntu theme with custom width
|
|
175
|
+
shellfie generate config.yml -o ubuntu.png -t ubuntu -w 800
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Configuration
|
|
179
|
+
|
|
180
|
+
### Basic Structure
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
theme: macos # Theme: macos, ubuntu, windows
|
|
184
|
+
title: "Terminal — zsh" # Window title
|
|
185
|
+
headless: false # Hide window decorations
|
|
186
|
+
|
|
187
|
+
window:
|
|
188
|
+
width: 600 # Window width in pixels
|
|
189
|
+
padding: 20 # Content padding
|
|
190
|
+
visible_lines: 10 # Fixed line count (for scrolling GIFs)
|
|
191
|
+
|
|
192
|
+
font:
|
|
193
|
+
family: "Monaco" # Font family
|
|
194
|
+
size: 14 # Font size
|
|
195
|
+
line_height: 1.4 # Line height multiplier
|
|
196
|
+
|
|
197
|
+
lines: # Static content
|
|
198
|
+
- prompt: "$ "
|
|
199
|
+
command: "echo hello"
|
|
200
|
+
- output: "hello"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Static Images
|
|
204
|
+
|
|
205
|
+
```yaml
|
|
206
|
+
theme: macos
|
|
207
|
+
title: "Terminal"
|
|
208
|
+
|
|
209
|
+
lines:
|
|
210
|
+
- prompt: "$ "
|
|
211
|
+
command: "gem install shellfie"
|
|
212
|
+
|
|
213
|
+
- output: |
|
|
214
|
+
Fetching shellfie-0.1.0.gem
|
|
215
|
+
Successfully installed shellfie-0.1.0
|
|
216
|
+
1 gem installed
|
|
217
|
+
|
|
218
|
+
- prompt: "$ "
|
|
219
|
+
command: ""
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Animated GIFs
|
|
223
|
+
|
|
224
|
+
```yaml
|
|
225
|
+
theme: macos
|
|
226
|
+
title: "Demo"
|
|
227
|
+
|
|
228
|
+
animation:
|
|
229
|
+
typing_speed: 50 # ms per character
|
|
230
|
+
command_delay: 500 # ms after command execution
|
|
231
|
+
cursor_blink: true # Show blinking cursor
|
|
232
|
+
loop: true # Loop the animation
|
|
233
|
+
|
|
234
|
+
frames:
|
|
235
|
+
- prompt: "$ "
|
|
236
|
+
type: "echo 'Hello!'" # Text to type (animated)
|
|
237
|
+
delay: 500 # Pause after this frame
|
|
238
|
+
|
|
239
|
+
- output: "Hello!"
|
|
240
|
+
delay: 1000
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### ANSI Colors
|
|
244
|
+
|
|
245
|
+
```yaml
|
|
246
|
+
lines:
|
|
247
|
+
- prompt: "\e[32muser@host\e[0m:\e[34m~/project\e[0m$ "
|
|
248
|
+
command: "ls"
|
|
249
|
+
|
|
250
|
+
- output: "\e[34mdir1\e[0m \e[32mfile.txt\e[0m \e[31merror.log\e[0m"
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Supported escape codes:**
|
|
254
|
+
|
|
255
|
+
| Code | Effect |
|
|
256
|
+
|------|--------|
|
|
257
|
+
| `\e[0m` | Reset |
|
|
258
|
+
| `\e[1m` | Bold |
|
|
259
|
+
| `\e[3m` | Italic |
|
|
260
|
+
| `\e[4m` | Underline |
|
|
261
|
+
| `\e[30-37m` | Foreground colors |
|
|
262
|
+
| `\e[40-47m` | Background colors |
|
|
263
|
+
| `\e[90-97m` | Bright foreground |
|
|
264
|
+
| `\e[38;5;Nm` | 256-color foreground |
|
|
265
|
+
| `\e[38;2;R;G;Bm` | RGB foreground |
|
|
266
|
+
|
|
267
|
+
### Fixed Height with Scrolling
|
|
268
|
+
|
|
269
|
+
For GIFs with many lines, use `visible_lines` to maintain consistent dimensions:
|
|
270
|
+
|
|
271
|
+
```yaml
|
|
272
|
+
window:
|
|
273
|
+
width: 600
|
|
274
|
+
visible_lines: 8 # Show only last 8 lines
|
|
275
|
+
|
|
276
|
+
frames:
|
|
277
|
+
- prompt: "$ "
|
|
278
|
+
type: "for i in {1..20}; do echo $i; done"
|
|
279
|
+
# Lines will scroll as content exceeds visible_lines
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Themes
|
|
283
|
+
|
|
284
|
+
### macOS (default)
|
|
285
|
+
|
|
286
|
+
Classic macOS Terminal appearance with traffic light buttons (red, yellow, green) on the left side.
|
|
287
|
+
|
|
288
|
+
### Ubuntu
|
|
289
|
+
|
|
290
|
+
GNOME Terminal style with window controls on the right side and Ubuntu's signature purple background.
|
|
291
|
+
|
|
292
|
+
### Windows Terminal
|
|
293
|
+
|
|
294
|
+
Modern Windows Terminal design with flat styling and square corners.
|
|
295
|
+
|
|
296
|
+
### Headless Mode
|
|
297
|
+
|
|
298
|
+
No window decorations — just the terminal content. Perfect for embedding in documentation.
|
|
299
|
+
|
|
300
|
+
<p align="center">
|
|
301
|
+
<img src="examples/headless.png" alt="Headless mode" width="500">
|
|
302
|
+
</p>
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
shellfie generate config.yml -o output.png --no-header
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Or in YAML:
|
|
309
|
+
|
|
310
|
+
```yaml
|
|
311
|
+
headless: true
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Development
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
git clone https://github.com/yourusername/shellfie.git
|
|
318
|
+
cd shellfie
|
|
319
|
+
|
|
320
|
+
bundle install
|
|
321
|
+
bundle exec rspec # Run tests
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Contributing
|
|
325
|
+
|
|
326
|
+
1. Fork it
|
|
327
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
328
|
+
3. Commit your changes (`git commit -am 'Add amazing feature'`)
|
|
329
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
330
|
+
5. Open a Pull Request
|
|
331
|
+
|
|
332
|
+
## License
|
|
333
|
+
|
|
334
|
+
Released under the [MIT License](LICENSE).
|