ukiryu 0.1.1 → 0.1.3
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 +4 -4
- data/.github/workflows/release.yml +58 -14
- data/.gitignore +3 -0
- data/.rubocop_todo.yml +170 -79
- data/Gemfile +1 -1
- data/README.adoc +1603 -576
- data/docs/.gitignore +1 -0
- data/docs/Gemfile +10 -0
- data/docs/INDEX.adoc +261 -0
- data/docs/_config.yml +180 -0
- data/docs/advanced/custom-tool-classes.adoc +581 -0
- data/docs/advanced/index.adoc +20 -0
- data/docs/features/configuration.adoc +657 -0
- data/docs/features/index.adoc +31 -0
- data/docs/features/platform-support.adoc +488 -0
- data/docs/getting-started/core-concepts.adoc +666 -0
- data/docs/getting-started/index.adoc +36 -0
- data/docs/getting-started/installation.adoc +216 -0
- data/docs/getting-started/quick-start.adoc +258 -0
- data/docs/guides/env-var-sets.adoc +388 -0
- data/docs/guides/index.adoc +20 -0
- data/docs/interfaces/cli.adoc +609 -0
- data/docs/interfaces/index.adoc +153 -0
- data/docs/interfaces/ruby-api.adoc +538 -0
- data/docs/lychee.toml +49 -0
- data/docs/reference/configuration-options.adoc +720 -0
- data/docs/reference/error-codes.adoc +634 -0
- data/docs/reference/index.adoc +20 -0
- data/docs/reference/ruby-api.adoc +1217 -0
- data/docs/understanding/index.adoc +20 -0
- data/lib/ukiryu/cli.rb +43 -58
- data/lib/ukiryu/cli_commands/base_command.rb +16 -27
- data/lib/ukiryu/cli_commands/cache_command.rb +100 -0
- data/lib/ukiryu/cli_commands/commands_command.rb +8 -8
- data/lib/ukiryu/cli_commands/commands_command.rb.fixed +1 -1
- data/lib/ukiryu/cli_commands/config_command.rb +49 -7
- data/lib/ukiryu/cli_commands/definitions_command.rb +254 -0
- data/lib/ukiryu/cli_commands/describe_command.rb +13 -7
- data/lib/ukiryu/cli_commands/describe_command.rb.fixed +1 -1
- data/lib/ukiryu/cli_commands/docs_command.rb +148 -0
- data/lib/ukiryu/cli_commands/exec_inline_command.rb.fixed +1 -1
- data/lib/ukiryu/cli_commands/extract_command.rb +2 -2
- data/lib/ukiryu/cli_commands/info_command.rb +7 -7
- data/lib/ukiryu/cli_commands/lint_command.rb +167 -0
- data/lib/ukiryu/cli_commands/list_command.rb +6 -6
- data/lib/ukiryu/cli_commands/opts_command.rb +2 -2
- data/lib/ukiryu/cli_commands/opts_command.rb.fixed +1 -1
- data/lib/ukiryu/cli_commands/register_command.rb +144 -0
- data/lib/ukiryu/cli_commands/resolve_command.rb +124 -0
- data/lib/ukiryu/cli_commands/run_command.rb +38 -14
- data/lib/ukiryu/cli_commands/run_file_command.rb +2 -2
- data/lib/ukiryu/cli_commands/system_command.rb +50 -32
- data/lib/ukiryu/cli_commands/validate_command.rb +452 -51
- data/lib/ukiryu/cli_commands/which_command.rb +5 -5
- data/lib/ukiryu/command_builder.rb +81 -23
- data/lib/ukiryu/config/env_provider.rb +3 -3
- data/lib/ukiryu/config/env_schema.rb +6 -6
- data/lib/ukiryu/config.rb +11 -11
- data/lib/ukiryu/definition/definition_cache.rb +238 -0
- data/lib/ukiryu/definition/definition_composer.rb +257 -0
- data/lib/ukiryu/definition/definition_linter.rb +460 -0
- data/lib/ukiryu/definition/definition_validator.rb +320 -0
- data/lib/ukiryu/definition/discovery.rb +239 -0
- data/lib/ukiryu/definition/documentation_generator.rb +429 -0
- data/lib/ukiryu/definition/lint_issue.rb +168 -0
- data/lib/ukiryu/definition/loader.rb +139 -0
- data/lib/ukiryu/definition/metadata.rb +159 -0
- data/lib/ukiryu/definition/source.rb +87 -0
- data/lib/ukiryu/definition/sources/file.rb +138 -0
- data/lib/ukiryu/definition/sources/string.rb +88 -0
- data/lib/ukiryu/definition/validation_result.rb +158 -0
- data/lib/ukiryu/definition/version_resolver.rb +194 -0
- data/lib/ukiryu/definition.rb +40 -0
- data/lib/ukiryu/errors.rb +6 -0
- data/lib/ukiryu/execution_context.rb +11 -11
- data/lib/ukiryu/executor.rb +6 -0
- data/lib/ukiryu/extractors/extractor.rb +6 -5
- data/lib/ukiryu/extractors/help_parser.rb +13 -19
- data/lib/ukiryu/logger.rb +3 -1
- data/lib/ukiryu/models/command_definition.rb +3 -3
- data/lib/ukiryu/models/command_info.rb +1 -1
- data/lib/ukiryu/models/components.rb +1 -3
- data/lib/ukiryu/models/env_var_definition.rb +11 -3
- data/lib/ukiryu/models/flag_definition.rb +15 -0
- data/lib/ukiryu/models/option_definition.rb +7 -7
- data/lib/ukiryu/models/platform_profile.rb +6 -3
- data/lib/ukiryu/models/routing.rb +1 -1
- data/lib/ukiryu/models/tool_definition.rb +2 -4
- data/lib/ukiryu/models/tool_metadata.rb +6 -6
- data/lib/ukiryu/models/validation_result.rb +1 -1
- data/lib/ukiryu/models/version_compatibility.rb +6 -3
- data/lib/ukiryu/models/version_detection.rb +10 -1
- data/lib/ukiryu/{registry.rb → register.rb} +54 -38
- data/lib/ukiryu/register_auto_manager.rb +268 -0
- data/lib/ukiryu/schema_validator.rb +31 -10
- data/lib/ukiryu/shell/base.rb +18 -0
- data/lib/ukiryu/shell/bash.rb +19 -1
- data/lib/ukiryu/shell/cmd.rb +11 -1
- data/lib/ukiryu/shell/powershell.rb +11 -1
- data/lib/ukiryu/shell.rb +1 -1
- data/lib/ukiryu/tool.rb +107 -95
- data/lib/ukiryu/tool_index.rb +22 -22
- data/lib/ukiryu/tools/base.rb +12 -25
- data/lib/ukiryu/tools/generator.rb +7 -7
- data/lib/ukiryu/tools.rb +3 -3
- data/lib/ukiryu/type.rb +20 -5
- data/lib/ukiryu/version.rb +1 -1
- data/lib/ukiryu/version_detector.rb +21 -2
- data/lib/ukiryu.rb +6 -3
- data/ukiryu-proposal.md +41 -41
- data/ukiryu.gemspec +1 -0
- metadata +64 -8
- data/.gitmodules +0 -3
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: default
|
|
3
|
+
title: Command Line Interface
|
|
4
|
+
parent: Interfaces
|
|
5
|
+
nav_order: 2
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
== Command Line Interface
|
|
9
|
+
|
|
10
|
+
The CLI provides a simple, powerful way to execute tools from the shell with type-safe parameters.
|
|
11
|
+
|
|
12
|
+
// Purpose
|
|
13
|
+
== Purpose
|
|
14
|
+
|
|
15
|
+
This page documents the Ukiryu CLI for executing commands, inspecting tools, and managing configuration.
|
|
16
|
+
|
|
17
|
+
// References
|
|
18
|
+
== References
|
|
19
|
+
|
|
20
|
+
* link:/interfaces/ruby-api[Ruby API] - Programmatic interface
|
|
21
|
+
* link:/features/configuration[Configuration Options] - All configuration methods
|
|
22
|
+
|
|
23
|
+
// Concepts
|
|
24
|
+
== Concepts
|
|
25
|
+
|
|
26
|
+
* **Command execution**: `ukiryu exec` runs tool commands
|
|
27
|
+
* **Tool discovery**: `ukiryu list` and `ukiryu info` for tool inspection
|
|
28
|
+
* **Configuration**: Environment variables and command-line parameters
|
|
29
|
+
* **Output formats**: JSON, YAML, and human-readable text
|
|
30
|
+
|
|
31
|
+
// Installation
|
|
32
|
+
== Installation
|
|
33
|
+
|
|
34
|
+
The CLI is installed automatically with the Ukiryu gem:
|
|
35
|
+
|
|
36
|
+
[source,bash]
|
|
37
|
+
----
|
|
38
|
+
gem install ukiryu
|
|
39
|
+
----
|
|
40
|
+
|
|
41
|
+
Verify installation:
|
|
42
|
+
|
|
43
|
+
[source,bash]
|
|
44
|
+
----
|
|
45
|
+
ukiryu version
|
|
46
|
+
----
|
|
47
|
+
|
|
48
|
+
// Basic Commands
|
|
49
|
+
== Basic Commands
|
|
50
|
+
|
|
51
|
+
=== List Tools
|
|
52
|
+
|
|
53
|
+
[source,bash]
|
|
54
|
+
----
|
|
55
|
+
ukiryu list
|
|
56
|
+
----
|
|
57
|
+
|
|
58
|
+
Shows all available tools with their installation status:
|
|
59
|
+
|
|
60
|
+
[source]
|
|
61
|
+
----
|
|
62
|
+
============================================================
|
|
63
|
+
Available Tools
|
|
64
|
+
============================================================
|
|
65
|
+
|
|
66
|
+
[✓] ghostscript Ghostscript - PDF/PostScript Interpreter
|
|
67
|
+
[✓] imagemagick ImageMagick - Image Manipulation
|
|
68
|
+
[✓] inkscape Inkscape - Vector Graphics Editor
|
|
69
|
+
[x] pandoc Pandoc - Document Converter (not installed)
|
|
70
|
+
...
|
|
71
|
+
----
|
|
72
|
+
|
|
73
|
+
=== Get Tool Information
|
|
74
|
+
|
|
75
|
+
[source,bash]
|
|
76
|
+
----
|
|
77
|
+
ukiryu info inkscape
|
|
78
|
+
----
|
|
79
|
+
|
|
80
|
+
Displays detailed tool information:
|
|
81
|
+
|
|
82
|
+
[source]
|
|
83
|
+
----
|
|
84
|
+
============================================================
|
|
85
|
+
Tool: inkscape
|
|
86
|
+
============================================================
|
|
87
|
+
|
|
88
|
+
Display Name: Inkscape Vector Graphics Editor
|
|
89
|
+
Version: 1.0
|
|
90
|
+
Homepage: https://inkscape.org/
|
|
91
|
+
Aliases: inkscapecom, ink
|
|
92
|
+
|
|
93
|
+
Version Detection:
|
|
94
|
+
Command: --version
|
|
95
|
+
Pattern: Inkscape (\d+\.\d+)
|
|
96
|
+
Modern Threshold: 1.0
|
|
97
|
+
|
|
98
|
+
Search Paths:
|
|
99
|
+
macos:
|
|
100
|
+
- /Applications/Inkscape.app/Contents/MacOS/inkscape
|
|
101
|
+
- /opt/homebrew/bin/inkscape
|
|
102
|
+
...
|
|
103
|
+
|
|
104
|
+
Profiles (1):
|
|
105
|
+
modern_unix:
|
|
106
|
+
Platforms: macos, linux
|
|
107
|
+
Shells: bash, zsh, fish, sh
|
|
108
|
+
Option Style: double_dash_equals
|
|
109
|
+
Execution Mode: headless
|
|
110
|
+
|
|
111
|
+
Status: INSTALLED
|
|
112
|
+
Executable: /Applications/Inkscape.app/Contents/MacOS/inkscape
|
|
113
|
+
Detected Version: 1.4
|
|
114
|
+
----
|
|
115
|
+
|
|
116
|
+
=== Describe Commands
|
|
117
|
+
|
|
118
|
+
[source,bash]
|
|
119
|
+
----
|
|
120
|
+
ukiryu describe inkscape export
|
|
121
|
+
----
|
|
122
|
+
|
|
123
|
+
Shows command documentation:
|
|
124
|
+
|
|
125
|
+
[source]
|
|
126
|
+
----
|
|
127
|
+
============================================================
|
|
128
|
+
inkscape export
|
|
129
|
+
============================================================
|
|
130
|
+
|
|
131
|
+
Export document to different format
|
|
132
|
+
|
|
133
|
+
Usage:
|
|
134
|
+
inkscape [OPTIONS] input1.svg [input2.svg ...]
|
|
135
|
+
|
|
136
|
+
Execution Mode: headless
|
|
137
|
+
|
|
138
|
+
Arguments:
|
|
139
|
+
inputs (file, variadic)
|
|
140
|
+
Position: last
|
|
141
|
+
Description: Input file(s)
|
|
142
|
+
Min: 1
|
|
143
|
+
|
|
144
|
+
Options:
|
|
145
|
+
output (file)
|
|
146
|
+
CLI: --export-filename
|
|
147
|
+
Description: Output filename
|
|
148
|
+
Required: true
|
|
149
|
+
|
|
150
|
+
Flags:
|
|
151
|
+
batch_process (boolean)
|
|
152
|
+
CLI: --batch-process
|
|
153
|
+
Default: true
|
|
154
|
+
Description: Close GUI after processing
|
|
155
|
+
----
|
|
156
|
+
|
|
157
|
+
// Executing Commands
|
|
158
|
+
== Executing Commands
|
|
159
|
+
|
|
160
|
+
=== Basic Syntax
|
|
161
|
+
|
|
162
|
+
[source,bash]
|
|
163
|
+
----
|
|
164
|
+
ukiryu exec <tool> <command> [KEY=VALUE ...]
|
|
165
|
+
----
|
|
166
|
+
|
|
167
|
+
=== Simple Example
|
|
168
|
+
|
|
169
|
+
[source,bash]
|
|
170
|
+
----
|
|
171
|
+
ukiryu exec inkscape export \
|
|
172
|
+
inputs=drawing.svg \
|
|
173
|
+
output=drawing.png \
|
|
174
|
+
format=png
|
|
175
|
+
----
|
|
176
|
+
|
|
177
|
+
=== Multiple Options
|
|
178
|
+
|
|
179
|
+
[source,bash]
|
|
180
|
+
----
|
|
181
|
+
ukiryu exec imagemagick convert \
|
|
182
|
+
inputs=photo.jpg \
|
|
183
|
+
output=photo.png \
|
|
184
|
+
resize=50% \
|
|
185
|
+
quality=85 \
|
|
186
|
+
strip=true
|
|
187
|
+
----
|
|
188
|
+
|
|
189
|
+
=== Array Parameters
|
|
190
|
+
|
|
191
|
+
[source,bash]
|
|
192
|
+
----
|
|
193
|
+
# Multiple input files
|
|
194
|
+
ukiryu exec inkscape export \
|
|
195
|
+
inputs=file1.svg,file2.svg,file3.svg \
|
|
196
|
+
output=combined.pdf
|
|
197
|
+
|
|
198
|
+
# Multiple export IDs
|
|
199
|
+
ukiryu exec inkscape export \
|
|
200
|
+
inputs=drawing.svg \
|
|
201
|
+
output=export.png \
|
|
202
|
+
export_ids=id1,id2,id3
|
|
203
|
+
----
|
|
204
|
+
|
|
205
|
+
// Configuration Methods
|
|
206
|
+
== Configuration Methods
|
|
207
|
+
|
|
208
|
+
=== Method 1: Command Parameters (Lowest Precedence)
|
|
209
|
+
|
|
210
|
+
Pass parameters directly on the command line:
|
|
211
|
+
|
|
212
|
+
[source,bash]
|
|
213
|
+
----
|
|
214
|
+
ukiryu exec inkscape export \
|
|
215
|
+
inputs=drawing.svg \
|
|
216
|
+
output=drawing.png \
|
|
217
|
+
timeout=60
|
|
218
|
+
----
|
|
219
|
+
|
|
220
|
+
=== Method 2: Environment Variables (Highest Precedence)
|
|
221
|
+
|
|
222
|
+
Set environment variables to override all configuration:
|
|
223
|
+
|
|
224
|
+
[source,bash]
|
|
225
|
+
----
|
|
226
|
+
# Set register location
|
|
227
|
+
export UKIRYU_REGISTER=/path/to/register
|
|
228
|
+
|
|
229
|
+
# Set default timeout for all commands
|
|
230
|
+
export UKIRYU_TIMEOUT=120
|
|
231
|
+
|
|
232
|
+
# Enable debug output
|
|
233
|
+
export UKIRYU_DEBUG=true
|
|
234
|
+
|
|
235
|
+
# Now run command (uses 120s timeout from ENV)
|
|
236
|
+
ukiryu exec inkscape export inputs=drawing.svg output=drawing.png
|
|
237
|
+
----
|
|
238
|
+
|
|
239
|
+
=== Configuration Precedence Example
|
|
240
|
+
|
|
241
|
+
[source,bash]
|
|
242
|
+
----
|
|
243
|
+
# Profile default: 90 seconds
|
|
244
|
+
# CLI parameter: 60 seconds
|
|
245
|
+
# ENV variable: 180 seconds (wins!)
|
|
246
|
+
|
|
247
|
+
export UKIRYU_TIMEOUT=180
|
|
248
|
+
ukiryu exec inkscape export \
|
|
249
|
+
inputs=drawing.svg \
|
|
250
|
+
output=drawing.png \
|
|
251
|
+
timeout=60 # Ignored - ENV takes precedence
|
|
252
|
+
----
|
|
253
|
+
|
|
254
|
+
// Output Formats
|
|
255
|
+
== Output Formats
|
|
256
|
+
|
|
257
|
+
=== Default Output (Human-Readable)
|
|
258
|
+
|
|
259
|
+
[source,bash]
|
|
260
|
+
----
|
|
261
|
+
ukiryu exec inkscape export inputs=drawing.svg output=drawing.png
|
|
262
|
+
----
|
|
263
|
+
|
|
264
|
+
[source]
|
|
265
|
+
----
|
|
266
|
+
---
|
|
267
|
+
status: success
|
|
268
|
+
exit_code: 0
|
|
269
|
+
|
|
270
|
+
command:
|
|
271
|
+
executable: "/Applications/Inkscape.app/Contents/MacOS/inkscape"
|
|
272
|
+
arguments:
|
|
273
|
+
- --batch-process
|
|
274
|
+
- --export-filename=/path/to/drawing.png
|
|
275
|
+
- /path/to/drawing.svg
|
|
276
|
+
full_command: "/Applications/Inkscape.app/Contents/MacOS/inkscape --batch-process --export-filename=/path/to/drawing.png /path/to/drawing.svg"
|
|
277
|
+
|
|
278
|
+
output:
|
|
279
|
+
stdout: |
|
|
280
|
+
(output text)
|
|
281
|
+
stderr: |
|
|
282
|
+
(error messages)
|
|
283
|
+
|
|
284
|
+
metadata:
|
|
285
|
+
started_at: '2025-01-23T10:30:00+00:00'
|
|
286
|
+
finished_at: '2025-01-23T10:30:01+00:00'
|
|
287
|
+
duration_seconds: 1.234
|
|
288
|
+
formatted_duration: 1.234s
|
|
289
|
+
----
|
|
290
|
+
|
|
291
|
+
=== JSON Output
|
|
292
|
+
|
|
293
|
+
[source,bash]
|
|
294
|
+
----
|
|
295
|
+
ukiryu exec inkscape export inputs=drawing.svg output=drawing.png --format json
|
|
296
|
+
----
|
|
297
|
+
|
|
298
|
+
[source]
|
|
299
|
+
----
|
|
300
|
+
{
|
|
301
|
+
"status": "success",
|
|
302
|
+
"exit_code": 0,
|
|
303
|
+
"command": {
|
|
304
|
+
"executable": "/Applications/Inkscape.app/Contents/MacOS/inkscape",
|
|
305
|
+
"arguments": ["--batch-process", "--export-filename=/path/to/drawing.png", "/path/to/drawing.svg"],
|
|
306
|
+
"full_command": "/Applications/Inkscape.app/Contents/MacOS/inkscape --batch-process --export-filename=/path/to/drawing.png /path/to/drawing.svg"
|
|
307
|
+
},
|
|
308
|
+
"output": {
|
|
309
|
+
"stdout": "...",
|
|
310
|
+
"stderr": "..."
|
|
311
|
+
},
|
|
312
|
+
"metadata": {
|
|
313
|
+
"started_at": "2025-01-23T10:30:00+00:00",
|
|
314
|
+
"finished_at": "2025-01-23T10:30:01+00:00",
|
|
315
|
+
"duration_seconds": 1.234,
|
|
316
|
+
"formatted_duration": "1.234s"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
----
|
|
320
|
+
|
|
321
|
+
=== YAML Output
|
|
322
|
+
|
|
323
|
+
[source,bash]
|
|
324
|
+
----
|
|
325
|
+
ukiryu exec inkscape export inputs=drawing.svg output=drawing.png --format yaml
|
|
326
|
+
----
|
|
327
|
+
|
|
328
|
+
=== Raw Output (For Piping)
|
|
329
|
+
|
|
330
|
+
[source,bash]
|
|
331
|
+
----
|
|
332
|
+
# Get only stdout (no metadata wrapping)
|
|
333
|
+
ukiryu exec inkscape export inputs=drawing.svg output=drawing.png --raw
|
|
334
|
+
|
|
335
|
+
# Use in pipeline
|
|
336
|
+
ukiryu exec inkscape query inputs=drawing.svg --raw | wc -l
|
|
337
|
+
----
|
|
338
|
+
|
|
339
|
+
// Exit Codes
|
|
340
|
+
== Exit Codes
|
|
341
|
+
|
|
342
|
+
The CLI returns the following exit codes:
|
|
343
|
+
|
|
344
|
+
[cols="1,1,3"]
|
|
345
|
+
|===
|
|
346
|
+
|Exit Code |Meaning |When
|
|
347
|
+
|
|
348
|
+
|0 |Success |Command executed successfully
|
|
349
|
+
|
|
350
|
+
|1 |Execution Error |Tool returned non-zero exit status
|
|
351
|
+
|
|
352
|
+
|2 |Tool Not Found |Tool not in register
|
|
353
|
+
|
|
354
|
+
|3 |Profile Not Found |No compatible profile for platform/shell
|
|
355
|
+
|
|
356
|
+
|4 |Command Not Found |Command not found for tool
|
|
357
|
+
|
|
358
|
+
|5 |Timeout |Command exceeded timeout limit
|
|
359
|
+
|
|
360
|
+
|Other |Internal Error |Ukiryu internal error
|
|
361
|
+
|===
|
|
362
|
+
|
|
363
|
+
=== Example Error Handling
|
|
364
|
+
|
|
365
|
+
[source,bash]
|
|
366
|
+
----
|
|
367
|
+
#!/bin/bash
|
|
368
|
+
|
|
369
|
+
ukiryu exec inkscape export \
|
|
370
|
+
inputs=drawing.svg \
|
|
371
|
+
output=drawing.png \
|
|
372
|
+
format=png
|
|
373
|
+
|
|
374
|
+
case $? in
|
|
375
|
+
0)
|
|
376
|
+
echo "Success!"
|
|
377
|
+
;;
|
|
378
|
+
1)
|
|
379
|
+
echo "Tool execution failed"
|
|
380
|
+
;;
|
|
381
|
+
2)
|
|
382
|
+
echo "Tool not found"
|
|
383
|
+
;;
|
|
384
|
+
4)
|
|
385
|
+
echo "Command not found"
|
|
386
|
+
;;
|
|
387
|
+
*)
|
|
388
|
+
echo "Unknown error"
|
|
389
|
+
;;
|
|
390
|
+
esac
|
|
391
|
+
----
|
|
392
|
+
|
|
393
|
+
// Advanced Usage
|
|
394
|
+
== Advanced Usage
|
|
395
|
+
|
|
396
|
+
=== Verbose Output
|
|
397
|
+
|
|
398
|
+
[source,bash]
|
|
399
|
+
----
|
|
400
|
+
# Enable debug output
|
|
401
|
+
export UKIRYU_DEBUG=true
|
|
402
|
+
|
|
403
|
+
ukiryu exec inkscape export inputs=drawing.svg output=drawing.png
|
|
404
|
+
|
|
405
|
+
# Or use --verbose flag (if available)
|
|
406
|
+
ukiryu exec inkscape export inputs=drawing.svg output=drawing.png --verbose
|
|
407
|
+
----
|
|
408
|
+
|
|
409
|
+
=== Custom Register
|
|
410
|
+
|
|
411
|
+
[source,bash]
|
|
412
|
+
----
|
|
413
|
+
# Specify custom register location
|
|
414
|
+
export UKIRYU_REGISTER=/path/to/register
|
|
415
|
+
|
|
416
|
+
ukiryu list
|
|
417
|
+
----
|
|
418
|
+
|
|
419
|
+
=== Shell Integration
|
|
420
|
+
|
|
421
|
+
[source,bash]
|
|
422
|
+
----
|
|
423
|
+
# Use in shell scripts
|
|
424
|
+
#!/bin/bash
|
|
425
|
+
|
|
426
|
+
for file in *.svg; do
|
|
427
|
+
basename="${file%.svg}"
|
|
428
|
+
ukiryu exec inkscape export \
|
|
429
|
+
inputs="$file" \
|
|
430
|
+
output="${basename}.png" \
|
|
431
|
+
format=png
|
|
432
|
+
|
|
433
|
+
if [ $? -eq 0 ]; then
|
|
434
|
+
echo "Converted $file"
|
|
435
|
+
else
|
|
436
|
+
echo "Failed to convert $file" >&2
|
|
437
|
+
fi
|
|
438
|
+
done
|
|
439
|
+
----
|
|
440
|
+
|
|
441
|
+
=== Pipeline Integration
|
|
442
|
+
|
|
443
|
+
[source,bash]
|
|
444
|
+
----
|
|
445
|
+
# Query image dimensions
|
|
446
|
+
WIDTH=$(ukiryu exec inkscape query inputs=drawing.svg width=true --raw)
|
|
447
|
+
HEIGHT=$(ukiryu exec inkscape query inputs=drawing.svg height=true --raw)
|
|
448
|
+
|
|
449
|
+
echo "Image size: ${WIDTH}x${HEIGHT}"
|
|
450
|
+
----
|
|
451
|
+
|
|
452
|
+
// Command Reference
|
|
453
|
+
== Command Reference
|
|
454
|
+
|
|
455
|
+
=== `ukiryu list`
|
|
456
|
+
|
|
457
|
+
List all available tools:
|
|
458
|
+
|
|
459
|
+
[source,bash]
|
|
460
|
+
----
|
|
461
|
+
ukiryu list [--verbose]
|
|
462
|
+
----
|
|
463
|
+
|
|
464
|
+
* `--verbose` - Show additional tool information
|
|
465
|
+
|
|
466
|
+
=== `ukiryu info`
|
|
467
|
+
|
|
468
|
+
Show detailed tool information:
|
|
469
|
+
|
|
470
|
+
[source,bash]
|
|
471
|
+
----
|
|
472
|
+
ukiryu info <tool> [--all]
|
|
473
|
+
----
|
|
474
|
+
|
|
475
|
+
* `tool` - Tool name
|
|
476
|
+
* `--all` - Show all tool implementations
|
|
477
|
+
|
|
478
|
+
=== `ukiryu describe`
|
|
479
|
+
|
|
480
|
+
Show command documentation:
|
|
481
|
+
|
|
482
|
+
[source,bash]
|
|
483
|
+
----
|
|
484
|
+
ukiryu describe <tool> [command]
|
|
485
|
+
----
|
|
486
|
+
|
|
487
|
+
* `tool` - Tool name
|
|
488
|
+
* `command` - Command name (optional)
|
|
489
|
+
|
|
490
|
+
=== `ukiryu exec`
|
|
491
|
+
|
|
492
|
+
Execute a tool command:
|
|
493
|
+
|
|
494
|
+
[source,bash]
|
|
495
|
+
----
|
|
496
|
+
ukiryu exec <tool> <command> [KEY=VALUE ...] [OPTIONS]
|
|
497
|
+
----
|
|
498
|
+
|
|
499
|
+
* `tool` - Tool name
|
|
500
|
+
* `command` - Command name
|
|
501
|
+
* `KEY=VALUE` - Command parameters
|
|
502
|
+
* `--format OUTPUT` - Output format (default, json, yaml)
|
|
503
|
+
* `--raw` - Output only stdout (no metadata)
|
|
504
|
+
* `--verbose` - Enable debug output
|
|
505
|
+
* `--timeout SECONDS` - Override default timeout
|
|
506
|
+
* `--register PATH` - Override register location
|
|
507
|
+
* `--shell SHELL` - Shell to use for command execution (bash, zsh, fish, sh, powershell, cmd)
|
|
508
|
+
* `-s SHELL` - Short form of --shell
|
|
509
|
+
|
|
510
|
+
=== `ukiryu version`
|
|
511
|
+
|
|
512
|
+
Show Ukiryu version:
|
|
513
|
+
|
|
514
|
+
[source,bash]
|
|
515
|
+
----
|
|
516
|
+
ukiryu version
|
|
517
|
+
----
|
|
518
|
+
|
|
519
|
+
// Examples
|
|
520
|
+
== Examples
|
|
521
|
+
|
|
522
|
+
=== Batch Image Conversion
|
|
523
|
+
|
|
524
|
+
[source,bash]
|
|
525
|
+
----
|
|
526
|
+
#!/bin/bash
|
|
527
|
+
|
|
528
|
+
# Convert all SVG files to PNG
|
|
529
|
+
for svg_file in *.svg; do
|
|
530
|
+
png_file="${svg_file%.svg}.png"
|
|
531
|
+
|
|
532
|
+
ukiryu exec inkscape export \
|
|
533
|
+
inputs="$svg_file" \
|
|
534
|
+
output="$png_file" \
|
|
535
|
+
format=png \
|
|
536
|
+
dpi=300
|
|
537
|
+
|
|
538
|
+
if [ $? -eq 0 ]; then
|
|
539
|
+
echo "✓ Converted $svg_file -> $png_file"
|
|
540
|
+
else
|
|
541
|
+
echo "✗ Failed to convert $svg_file" >&2
|
|
542
|
+
fi
|
|
543
|
+
done
|
|
544
|
+
----
|
|
545
|
+
|
|
546
|
+
=== PDF Processing Pipeline
|
|
547
|
+
|
|
548
|
+
[source,bash]
|
|
549
|
+
----
|
|
550
|
+
#!/bin/bash
|
|
551
|
+
|
|
552
|
+
# Compress PDF and extract metadata
|
|
553
|
+
INPUT="document.pdf"
|
|
554
|
+
OUTPUT="document-compressed.pdf"
|
|
555
|
+
|
|
556
|
+
# Compress
|
|
557
|
+
ukiryu exec ghostscript convert \
|
|
558
|
+
inputs="$INPUT" \
|
|
559
|
+
device=pdfwrite \
|
|
560
|
+
output="$OUTPUT" \
|
|
561
|
+
safer=true \
|
|
562
|
+
quiet=true
|
|
563
|
+
|
|
564
|
+
# Check success
|
|
565
|
+
if [ $? -eq 0 ]; then
|
|
566
|
+
echo "Compression successful"
|
|
567
|
+
|
|
568
|
+
# Get page count
|
|
569
|
+
PAGES=$(ukiryu exec ghostscript convert \
|
|
570
|
+
inputs="$OUTPUT" \
|
|
571
|
+
device=nullpage \
|
|
572
|
+
quiet=true \
|
|
573
|
+
--raw | wc -l)
|
|
574
|
+
|
|
575
|
+
echo "Page count: $PAGES"
|
|
576
|
+
fi
|
|
577
|
+
----
|
|
578
|
+
|
|
579
|
+
=== Error Handling with JSON Output
|
|
580
|
+
|
|
581
|
+
[source,bash]
|
|
582
|
+
----
|
|
583
|
+
#!/bin/bash
|
|
584
|
+
|
|
585
|
+
# Execute command and capture JSON output
|
|
586
|
+
RESULT=$(ukiryu exec inkscape export \
|
|
587
|
+
inputs=drawing.svg \
|
|
588
|
+
output=drawing.png \
|
|
589
|
+
format=png \
|
|
590
|
+
--format json)
|
|
591
|
+
|
|
592
|
+
# Parse with jq
|
|
593
|
+
STATUS=$(echo "$RESULT" | jq -r '.status')
|
|
594
|
+
EXIT_CODE=$(echo "$RESULT" | jq -r '.exit_code')
|
|
595
|
+
|
|
596
|
+
if [ "$STATUS" = "success" ]; then
|
|
597
|
+
echo "Conversion successful!"
|
|
598
|
+
else
|
|
599
|
+
echo "Conversion failed (exit code: $EXIT_CODE)"
|
|
600
|
+
echo "$RESULT" | jq -r '.output.stderr'
|
|
601
|
+
fi
|
|
602
|
+
----
|
|
603
|
+
|
|
604
|
+
// See Also
|
|
605
|
+
== See Also
|
|
606
|
+
|
|
607
|
+
* link:/interfaces/ruby-api[Ruby API] - Programmatic interface
|
|
608
|
+
* link:/features/configuration[Configuration Options] - All configuration methods
|
|
609
|
+
* link:/guides/[Guides] - Task-specific tutorials
|