postsvg 0.1.0 → 0.3.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 +4 -4
- data/CHANGELOG.md +105 -0
- data/CLAUDE.md +173 -0
- data/Gemfile +2 -3
- data/README.adoc +456 -179
- data/Rakefile +100 -0
- data/TODO.roadmap/00-architecture.md +139 -0
- data/TODO.roadmap/01-autoload-migration.md +39 -0
- data/TODO.roadmap/02-isolate-dormant-code.md +51 -0
- data/TODO.roadmap/03-domain-model.md +66 -0
- data/TODO.roadmap/04-lexer.md +40 -0
- data/TODO.roadmap/05-parser.md +43 -0
- data/TODO.roadmap/06-graphics-state.md +45 -0
- data/TODO.roadmap/07-matrix-and-color.md +37 -0
- data/TODO.roadmap/08-svg-builder.md +51 -0
- data/TODO.roadmap/09-renderer.md +52 -0
- data/TODO.roadmap/10-visitor.md +58 -0
- data/TODO.roadmap/11-operator-coverage.md +103 -0
- data/TODO.roadmap/12-svg-domain.md +62 -0
- data/TODO.roadmap/13-translation-handlers.md +69 -0
- data/TODO.roadmap/14-ps-serializer.md +49 -0
- data/TODO.roadmap/15-cli-and-public-api.md +47 -0
- data/TODO.roadmap/16-specs.md +84 -0
- data/TODO.roadmap/17-docs-sync.md +47 -0
- data/TODO.roadmap/18-performance-and-determinism.md +47 -0
- data/TODO.roadmap/19-error-model.md +45 -0
- data/TODO.roadmap/20-font-and-text.md +46 -0
- data/TODO.roadmap/21-images.md +45 -0
- data/TODO.roadmap/22-forms-and-resources.md +25 -0
- data/TODO.roadmap/23-level2-level3.md +52 -0
- data/TODO.roadmap/24-ci-and-release.md +42 -0
- data/TODO.roadmap/README.md +77 -0
- data/docs/.gitignore +29 -0
- data/docs/CHANGELOG.md +114 -0
- data/docs/COMPLETE_DOCUMENTATION_STATUS.md +376 -0
- data/docs/DEPLOYMENT.md +456 -0
- data/docs/DEPLOYMENT_INSTRUCTIONS.md +229 -0
- data/docs/DOCUMENTATION_PLAN.md +425 -0
- data/docs/FINAL_SUMMARY.md +657 -0
- data/docs/Gemfile +15 -0
- data/docs/README.md +327 -0
- data/docs/_config.yml +99 -0
- data/docs/advanced-topics.adoc +370 -0
- data/docs/api-reference/colors.adoc +705 -0
- data/docs/api-reference/converter.adoc +699 -0
- data/docs/api-reference/execution-context.adoc +1210 -0
- data/docs/api-reference/graphics-state.adoc +1070 -0
- data/docs/api-reference/interpreter.adoc +810 -0
- data/docs/api-reference/matrix.adoc +1179 -0
- data/docs/api-reference/path-builder.adoc +1284 -0
- data/docs/api-reference/postsvg-module.adoc +388 -0
- data/docs/api-reference/svg-generator.adoc +891 -0
- data/docs/api-reference/tokenizer.adoc +925 -0
- data/docs/api-reference.adoc +221 -0
- data/docs/architecture/command-registry.adoc +1191 -0
- data/docs/architecture/conversion-pipeline.adoc +746 -0
- data/docs/architecture/design-decisions.adoc +999 -0
- data/docs/architecture/generator-stage.adoc +1115 -0
- data/docs/architecture/graphics-state-model.adoc +1089 -0
- data/docs/architecture/interpreter-stage.adoc +1125 -0
- data/docs/architecture/parser-stage.adoc +1051 -0
- data/docs/architecture.adoc +354 -0
- data/docs/cli-reference/batch-command.adoc +616 -0
- data/docs/cli-reference/check-command.adoc +677 -0
- data/docs/cli-reference/cli-options.adoc +802 -0
- data/docs/cli-reference/convert-command.adoc +462 -0
- data/docs/cli-reference/version-command.adoc +296 -0
- data/docs/cli-reference.adoc +317 -0
- data/docs/concepts/conversion-pipeline.adoc +903 -0
- data/docs/concepts/coordinate-systems.adoc +836 -0
- data/docs/concepts/graphics-state.adoc +861 -0
- data/docs/concepts/path-operations.adoc +1076 -0
- data/docs/concepts/postscript-language.adoc +859 -0
- data/docs/concepts/svg-generation.adoc +937 -0
- data/docs/concepts.adoc +198 -0
- data/docs/contributing.adoc +443 -0
- data/docs/development.adoc +420 -0
- data/docs/faq.adoc +493 -0
- data/docs/getting-started/basic-usage.adoc +538 -0
- data/docs/getting-started/common-workflows.adoc +577 -0
- data/docs/getting-started/first-conversion.adoc +492 -0
- data/docs/getting-started/installation.adoc +534 -0
- data/docs/getting-started.adoc +94 -0
- data/docs/index.adoc +248 -0
- data/docs/optimization.adoc +196 -0
- data/docs/ps2svg_compatibility.adoc +149 -0
- data/docs/quick-reference.adoc +453 -0
- data/docs/sitemap.adoc +337 -0
- data/docs/troubleshooting.adoc +486 -0
- data/docs/validation.adoc +772 -0
- data/exe/postsvg +1 -0
- data/lib/postsvg/cli.rb +104 -57
- data/lib/postsvg/color.rb +132 -0
- data/lib/postsvg/errors.rb +68 -3
- data/lib/postsvg/format_number.rb +22 -0
- data/lib/postsvg/graphics_context.rb +80 -0
- data/lib/postsvg/graphics_stack.rb +43 -0
- data/lib/postsvg/model/literals/array.rb +41 -0
- data/lib/postsvg/model/literals/dictionary.rb +34 -0
- data/lib/postsvg/model/literals/hex.rb +37 -0
- data/lib/postsvg/model/literals/name.rb +40 -0
- data/lib/postsvg/model/literals/number.rb +36 -0
- data/lib/postsvg/model/literals/procedure.rb +41 -0
- data/lib/postsvg/model/literals/string.rb +30 -0
- data/lib/postsvg/model/literals.rb +19 -0
- data/lib/postsvg/model/operator.rb +58 -0
- data/lib/postsvg/model/operators/arithmetic.rb +264 -0
- data/lib/postsvg/model/operators/boolean.rb +182 -0
- data/lib/postsvg/model/operators/color.rb +74 -0
- data/lib/postsvg/model/operators/container.rb +186 -0
- data/lib/postsvg/model/operators/control_flow.rb +119 -0
- data/lib/postsvg/model/operators/device.rb +21 -0
- data/lib/postsvg/model/operators/dictionary.rb +118 -0
- data/lib/postsvg/model/operators/font.rb +121 -0
- data/lib/postsvg/model/operators/graphics_state.rb +84 -0
- data/lib/postsvg/model/operators/painting.rb +29 -0
- data/lib/postsvg/model/operators/path.rb +169 -0
- data/lib/postsvg/model/operators/stack.rb +72 -0
- data/lib/postsvg/model/operators/transformations.rb +103 -0
- data/lib/postsvg/model/operators.rb +89 -0
- data/lib/postsvg/model/program.rb +68 -0
- data/lib/postsvg/model/token.rb +43 -0
- data/lib/postsvg/model.rb +17 -0
- data/lib/postsvg/options.rb +29 -0
- data/lib/postsvg/renderer.rb +85 -0
- data/lib/postsvg/serializer.rb +325 -0
- data/lib/postsvg/source/ast_builder.rb +308 -0
- data/lib/postsvg/source/lexer.rb +322 -0
- data/lib/postsvg/source/operand_stack.rb +55 -0
- data/lib/postsvg/source.rb +21 -0
- data/lib/postsvg/svg/attribute_parser.rb +45 -0
- data/lib/postsvg/svg/clip_path_registry.rb +44 -0
- data/lib/postsvg/svg/document.rb +22 -0
- data/lib/postsvg/svg/element.rb +84 -0
- data/lib/postsvg/svg/elements/circle.rb +36 -0
- data/lib/postsvg/svg/elements/clip_path.rb +26 -0
- data/lib/postsvg/svg/elements/defs.rb +24 -0
- data/lib/postsvg/svg/elements/ellipse.rb +38 -0
- data/lib/postsvg/svg/elements/group.rb +37 -0
- data/lib/postsvg/svg/elements/image.rb +35 -0
- data/lib/postsvg/svg/elements/line.rb +36 -0
- data/lib/postsvg/svg/elements/path.rb +32 -0
- data/lib/postsvg/svg/elements/polygon.rb +12 -0
- data/lib/postsvg/svg/elements/polyline.rb +32 -0
- data/lib/postsvg/svg/elements/rect.rb +44 -0
- data/lib/postsvg/svg/elements/svg.rb +39 -0
- data/lib/postsvg/svg/elements/text.rb +42 -0
- data/lib/postsvg/svg/elements.rb +31 -0
- data/lib/postsvg/svg/paint.rb +34 -0
- data/lib/postsvg/svg/parser.rb +39 -0
- data/lib/postsvg/svg/path_data/command.rb +27 -0
- data/lib/postsvg/svg/path_data/parser.rb +82 -0
- data/lib/postsvg/svg/path_data.rb +17 -0
- data/lib/postsvg/svg/stroke.rb +31 -0
- data/lib/postsvg/svg/transform_list.rb +59 -0
- data/lib/postsvg/svg.rb +22 -0
- data/lib/postsvg/svg_builder.rb +249 -0
- data/lib/postsvg/translation/arc_converter.rb +86 -0
- data/lib/postsvg/translation/bounding_box.rb +59 -0
- data/lib/postsvg/translation/context.rb +34 -0
- data/lib/postsvg/translation/handler_registry.rb +38 -0
- data/lib/postsvg/translation/handlers/circle_handler.rb +28 -0
- data/lib/postsvg/translation/handlers/clip_path_handler.rb +13 -0
- data/lib/postsvg/translation/handlers/defs_handler.rb +15 -0
- data/lib/postsvg/translation/handlers/ellipse_handler.rb +31 -0
- data/lib/postsvg/translation/handlers/group_handler.rb +21 -0
- data/lib/postsvg/translation/handlers/image_handler.rb +20 -0
- data/lib/postsvg/translation/handlers/line_handler.rb +23 -0
- data/lib/postsvg/translation/handlers/open_handler.rb +18 -0
- data/lib/postsvg/translation/handlers/path_handler.rb +356 -0
- data/lib/postsvg/translation/handlers/polygon_handler.rb +33 -0
- data/lib/postsvg/translation/handlers/polyline_handler.rb +31 -0
- data/lib/postsvg/translation/handlers/rect_handler.rb +27 -0
- data/lib/postsvg/translation/handlers/shared.rb +110 -0
- data/lib/postsvg/translation/handlers/svg_handler.rb +25 -0
- data/lib/postsvg/translation/handlers/text_handler.rb +56 -0
- data/lib/postsvg/translation/handlers.rb +25 -0
- data/lib/postsvg/translation/ps_renderer.rb +105 -0
- data/lib/postsvg/translation/record_emitter.rb +35 -0
- data/lib/postsvg/translation.rb +17 -0
- data/lib/postsvg/version.rb +1 -1
- data/lib/postsvg/visitors/ps_visitor/arithmetic.rb +125 -0
- data/lib/postsvg/visitors/ps_visitor/boolean.rb +105 -0
- data/lib/postsvg/visitors/ps_visitor/color.rb +53 -0
- data/lib/postsvg/visitors/ps_visitor/common.rb +66 -0
- data/lib/postsvg/visitors/ps_visitor/container.rb +164 -0
- data/lib/postsvg/visitors/ps_visitor/control_flow.rb +110 -0
- data/lib/postsvg/visitors/ps_visitor/device.rb +20 -0
- data/lib/postsvg/visitors/ps_visitor/dictionary.rb +89 -0
- data/lib/postsvg/visitors/ps_visitor/font.rb +93 -0
- data/lib/postsvg/visitors/ps_visitor/graphics_state.rb +55 -0
- data/lib/postsvg/visitors/ps_visitor/painting.rb +90 -0
- data/lib/postsvg/visitors/ps_visitor/path.rb +112 -0
- data/lib/postsvg/visitors/ps_visitor/stack.rb +47 -0
- data/lib/postsvg/visitors/ps_visitor/transformations.rb +101 -0
- data/lib/postsvg/visitors/ps_visitor.rb +208 -0
- data/lib/postsvg/visitors.rb +9 -0
- data/lib/postsvg.rb +93 -59
- data/lychee.toml +86 -0
- metadata +216 -11
- data/postsvg.gemspec +0 -38
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
= CLI Options Reference
|
|
2
|
+
:page-nav_order: 5
|
|
3
|
+
:page-parent: CLI Reference
|
|
4
|
+
|
|
5
|
+
== Purpose
|
|
6
|
+
|
|
7
|
+
This comprehensive reference documents all command-line options available across Postsvg CLI commands, providing detailed explanations, usage examples, and best practices for each option.
|
|
8
|
+
|
|
9
|
+
== References
|
|
10
|
+
|
|
11
|
+
* link:../index.adoc[Documentation Home]
|
|
12
|
+
* link:../cli-reference.adoc[CLI Reference Overview]
|
|
13
|
+
* link:convert-command.adoc[convert Command]
|
|
14
|
+
* link:batch-command.adoc[batch Command]
|
|
15
|
+
* link:check-command.adoc[check Command]
|
|
16
|
+
* link:version-command.adoc[version Command]
|
|
17
|
+
|
|
18
|
+
== Concepts
|
|
19
|
+
|
|
20
|
+
**Global Options**:: Options that apply to all commands in the CLI.
|
|
21
|
+
|
|
22
|
+
**Command-Specific Options**:: Options that only apply to specific commands.
|
|
23
|
+
|
|
24
|
+
**Boolean Flags**:: Options that don't take values (presence means true).
|
|
25
|
+
|
|
26
|
+
**Value Options**:: Options that require a value parameter.
|
|
27
|
+
|
|
28
|
+
**Exit Codes**:: Numeric values (0 for success, 1 for failure) returned by commands.
|
|
29
|
+
|
|
30
|
+
== Options by Command
|
|
31
|
+
|
|
32
|
+
=== convert Command Options
|
|
33
|
+
|
|
34
|
+
The [`convert`](convert-command.adoc) command supports the following options:
|
|
35
|
+
|
|
36
|
+
==== --strict
|
|
37
|
+
|
|
38
|
+
Enable strict validation mode that fails immediately on unknown or unsupported operators.
|
|
39
|
+
|
|
40
|
+
**Syntax:**
|
|
41
|
+
|
|
42
|
+
[source,sh]
|
|
43
|
+
----
|
|
44
|
+
postsvg convert --strict INPUT [OUTPUT] <1>
|
|
45
|
+
----
|
|
46
|
+
<1> Fail on any unknown PostScript operators
|
|
47
|
+
|
|
48
|
+
**Where:**
|
|
49
|
+
|
|
50
|
+
`INPUT`:: Input PostScript or EPS file path
|
|
51
|
+
|
|
52
|
+
`OUTPUT`:: (Optional) Output SVG file path
|
|
53
|
+
|
|
54
|
+
**Type:** Boolean flag (no value required)
|
|
55
|
+
|
|
56
|
+
**Default:** `false` (lenient mode)
|
|
57
|
+
|
|
58
|
+
**Availability:** `convert`, `batch` commands
|
|
59
|
+
|
|
60
|
+
**Source:** [`lib/postsvg/cli.rb:22-23`](../../lib/postsvg/cli.rb:22)
|
|
61
|
+
|
|
62
|
+
.Using strict mode for validation
|
|
63
|
+
[example]
|
|
64
|
+
====
|
|
65
|
+
[source,sh]
|
|
66
|
+
----
|
|
67
|
+
# Lenient mode (default) - ignores unknown operators
|
|
68
|
+
$ postsvg convert input.ps output.svg
|
|
69
|
+
Successfully converted input.ps to output.svg
|
|
70
|
+
|
|
71
|
+
# Strict mode - fails on unknown operators
|
|
72
|
+
$ postsvg convert --strict input.ps output.svg
|
|
73
|
+
Conversion error: Unknown operator: customop
|
|
74
|
+
----
|
|
75
|
+
|
|
76
|
+
Strict mode is useful for:
|
|
77
|
+
|
|
78
|
+
* Development and testing
|
|
79
|
+
* Ensuring complete operator support
|
|
80
|
+
* Validating PostScript compatibility
|
|
81
|
+
* Identifying unsupported features early
|
|
82
|
+
====
|
|
83
|
+
|
|
84
|
+
**Related Options:**
|
|
85
|
+
* link:check-command.adoc#_level[--level] (for validation without conversion)
|
|
86
|
+
|
|
87
|
+
=== batch Command Options
|
|
88
|
+
|
|
89
|
+
The [`batch`](batch-command.adoc) command supports the following options:
|
|
90
|
+
|
|
91
|
+
==== --strict (batch)
|
|
92
|
+
|
|
93
|
+
Enable strict validation for batch conversions.
|
|
94
|
+
|
|
95
|
+
**Syntax:**
|
|
96
|
+
|
|
97
|
+
[source,sh]
|
|
98
|
+
----
|
|
99
|
+
postsvg batch --strict INPUT_DIR [OUTPUT_DIR] <1>
|
|
100
|
+
----
|
|
101
|
+
<1> Apply strict mode to all files in batch
|
|
102
|
+
|
|
103
|
+
**Type:** Boolean flag
|
|
104
|
+
|
|
105
|
+
**Default:** `false`
|
|
106
|
+
|
|
107
|
+
**Availability:** `batch` command
|
|
108
|
+
|
|
109
|
+
**Source:** [`lib/postsvg/cli.rb:66-67`](../../lib/postsvg/cli.rb:66)
|
|
110
|
+
|
|
111
|
+
.Batch conversion with strict mode
|
|
112
|
+
[example]
|
|
113
|
+
====
|
|
114
|
+
[source,sh]
|
|
115
|
+
----
|
|
116
|
+
$ postsvg batch --strict ps_files/ svg_files/
|
|
117
|
+
Found 3 file(s) to convert
|
|
118
|
+
✓ ps_files/diagram1.ps → svg_files/diagram1.svg
|
|
119
|
+
✗ ps_files/diagram2.ps: Unknown operator: shfill
|
|
120
|
+
✓ ps_files/diagram3.ps → svg_files/diagram3.svg
|
|
121
|
+
----
|
|
122
|
+
|
|
123
|
+
In batch mode, strict validation is applied to each file individually. Errors are reported but don't stop the batch process.
|
|
124
|
+
====
|
|
125
|
+
|
|
126
|
+
=== check Command Options
|
|
127
|
+
|
|
128
|
+
The [`check`](check-command.adoc) command provides the most extensive set of options for validation control.
|
|
129
|
+
|
|
130
|
+
==== -l, --level LEVEL
|
|
131
|
+
|
|
132
|
+
Specify the validation level: `syntax`, `semantic`, or `full`.
|
|
133
|
+
|
|
134
|
+
**Syntax:**
|
|
135
|
+
|
|
136
|
+
[source,sh]
|
|
137
|
+
----
|
|
138
|
+
postsvg check --level=LEVEL FILE... <1>
|
|
139
|
+
postsvg check -l LEVEL FILE... <2>
|
|
140
|
+
----
|
|
141
|
+
<1> Long form with equals
|
|
142
|
+
<2> Short form with space
|
|
143
|
+
|
|
144
|
+
**Where:**
|
|
145
|
+
|
|
146
|
+
`LEVEL`:: Validation level
|
|
147
|
+
* `syntax` - Fast structural validation only
|
|
148
|
+
* `semantic` - Thorough logical validation (default)
|
|
149
|
+
* `full` - Complete conversion attempt
|
|
150
|
+
|
|
151
|
+
**Type:** String value
|
|
152
|
+
|
|
153
|
+
**Default:** `semantic`
|
|
154
|
+
|
|
155
|
+
**Availability:** `check` command only
|
|
156
|
+
|
|
157
|
+
**Source:** [`lib/postsvg/cli.rb:134`](../../lib/postsvg/cli.rb:134)
|
|
158
|
+
|
|
159
|
+
.Validation levels comparison
|
|
160
|
+
[example]
|
|
161
|
+
====
|
|
162
|
+
[source,sh]
|
|
163
|
+
----
|
|
164
|
+
# Syntax level - fastest
|
|
165
|
+
$ postsvg check --level=syntax file.ps
|
|
166
|
+
✓ file.ps - Valid PostScript file
|
|
167
|
+
Validation time: 15ms
|
|
168
|
+
|
|
169
|
+
# Semantic level - default, thorough
|
|
170
|
+
$ postsvg check --level=semantic file.ps
|
|
171
|
+
✓ file.ps - Valid PostScript file
|
|
172
|
+
Validation time: 87ms
|
|
173
|
+
|
|
174
|
+
# Full level - strictest
|
|
175
|
+
$ postsvg check --level=full file.ps
|
|
176
|
+
✓ file.ps - Valid PostScript file
|
|
177
|
+
Validation time: 243ms
|
|
178
|
+
SVG generated successfully
|
|
179
|
+
----
|
|
180
|
+
|
|
181
|
+
**Performance characteristics:**
|
|
182
|
+
|
|
183
|
+
* `syntax`: ~10-50ms per file
|
|
184
|
+
* `semantic`: ~50-200ms per file
|
|
185
|
+
* `full`: ~100-500ms per file
|
|
186
|
+
====
|
|
187
|
+
|
|
188
|
+
**Validation Level Details:**
|
|
189
|
+
|
|
190
|
+
[cols="1,2,2"]
|
|
191
|
+
|===
|
|
192
|
+
| Level | Checks Performed | Use Case
|
|
193
|
+
|
|
194
|
+
| `syntax`
|
|
195
|
+
| Headers, delimiters, tokenization
|
|
196
|
+
| Quick structural check
|
|
197
|
+
|
|
198
|
+
| `semantic`
|
|
199
|
+
| Stack balance, state tracking, operators
|
|
200
|
+
| Regular validation (recommended)
|
|
201
|
+
|
|
202
|
+
| `full`
|
|
203
|
+
| Complete conversion with SVG generation
|
|
204
|
+
| Production readiness
|
|
205
|
+
|===
|
|
206
|
+
|
|
207
|
+
==== -f, --format FORMAT
|
|
208
|
+
|
|
209
|
+
Specify the output report format.
|
|
210
|
+
|
|
211
|
+
**Syntax:**
|
|
212
|
+
|
|
213
|
+
[source,sh]
|
|
214
|
+
----
|
|
215
|
+
postsvg check --format=FORMAT FILE... <1>
|
|
216
|
+
postsvg check -f FORMAT FILE... <2>
|
|
217
|
+
----
|
|
218
|
+
<1> Long form with equals
|
|
219
|
+
<2> Short form with space
|
|
220
|
+
|
|
221
|
+
**Where:**
|
|
222
|
+
|
|
223
|
+
`FORMAT`:: Output format
|
|
224
|
+
* `text` - Human-readable colored output (default)
|
|
225
|
+
* `yaml` - Structured YAML for processing
|
|
226
|
+
* `json` - JSON for programmatic use
|
|
227
|
+
|
|
228
|
+
**Type:** String value
|
|
229
|
+
|
|
230
|
+
**Default:** `text`
|
|
231
|
+
|
|
232
|
+
**Availability:** `check` command only
|
|
233
|
+
|
|
234
|
+
**Source:** [`lib/postsvg/cli.rb:135`](../../lib/postsvg/cli.rb:135)
|
|
235
|
+
|
|
236
|
+
.Output format examples
|
|
237
|
+
[example]
|
|
238
|
+
====
|
|
239
|
+
**Text format (default):**
|
|
240
|
+
[source,sh]
|
|
241
|
+
----
|
|
242
|
+
$ postsvg check file.ps
|
|
243
|
+
✓ file.ps - Valid PostScript file
|
|
244
|
+
File type: EPS
|
|
245
|
+
No errors found
|
|
246
|
+
----
|
|
247
|
+
|
|
248
|
+
**YAML format:**
|
|
249
|
+
[source,sh]
|
|
250
|
+
----
|
|
251
|
+
$ postsvg check --format=yaml file.ps
|
|
252
|
+
---
|
|
253
|
+
filename: file.ps
|
|
254
|
+
valid: true
|
|
255
|
+
file_type: EPS
|
|
256
|
+
errors: []
|
|
257
|
+
warnings: []
|
|
258
|
+
----
|
|
259
|
+
|
|
260
|
+
**JSON format:**
|
|
261
|
+
[source,sh]
|
|
262
|
+
----
|
|
263
|
+
$ postsvg check --format=json file.ps
|
|
264
|
+
{
|
|
265
|
+
"filename": "file.ps",
|
|
266
|
+
"valid": true,
|
|
267
|
+
"file_type": "EPS",
|
|
268
|
+
"errors": [],
|
|
269
|
+
"warnings": []
|
|
270
|
+
}
|
|
271
|
+
----
|
|
272
|
+
====
|
|
273
|
+
|
|
274
|
+
**Format Use Cases:**
|
|
275
|
+
|
|
276
|
+
* `text` - Interactive use, terminal output
|
|
277
|
+
* `yaml` - Configuration files, human-readable data
|
|
278
|
+
* `json` - CI/CD integration, automated processing
|
|
279
|
+
|
|
280
|
+
==== -v, --verbose
|
|
281
|
+
|
|
282
|
+
Enable detailed output including warnings and informational messages.
|
|
283
|
+
|
|
284
|
+
**Syntax:**
|
|
285
|
+
|
|
286
|
+
[source,sh]
|
|
287
|
+
----
|
|
288
|
+
postsvg check --verbose FILE... <1>
|
|
289
|
+
postsvg check -v FILE... <2>
|
|
290
|
+
----
|
|
291
|
+
<1> Long form
|
|
292
|
+
<2> Short form
|
|
293
|
+
|
|
294
|
+
**Type:** Boolean flag
|
|
295
|
+
|
|
296
|
+
**Default:** `false`
|
|
297
|
+
|
|
298
|
+
**Availability:** `check` command only
|
|
299
|
+
|
|
300
|
+
**Source:** [`lib/postsvg/cli.rb:136`](../../lib/postsvg/cli.rb:136)
|
|
301
|
+
|
|
302
|
+
.Verbose output example
|
|
303
|
+
[example]
|
|
304
|
+
====
|
|
305
|
+
[source,sh]
|
|
306
|
+
----
|
|
307
|
+
# Normal output
|
|
308
|
+
$ postsvg check file.ps
|
|
309
|
+
✓ file.ps - Valid PostScript file
|
|
310
|
+
|
|
311
|
+
# Verbose output
|
|
312
|
+
$ postsvg check --verbose file.ps
|
|
313
|
+
✓ file.ps - Valid PostScript file
|
|
314
|
+
File type: EPS
|
|
315
|
+
PostScript version: 3.0
|
|
316
|
+
BoundingBox: 0 0 612 792
|
|
317
|
+
Total operators: 127
|
|
318
|
+
Path commands: 45
|
|
319
|
+
Graphics state operations: 12
|
|
320
|
+
Info:
|
|
321
|
+
- Using default font
|
|
322
|
+
Warnings:
|
|
323
|
+
- Consider explicit line cap settings
|
|
324
|
+
No errors found
|
|
325
|
+
----
|
|
326
|
+
|
|
327
|
+
Verbose mode provides:
|
|
328
|
+
|
|
329
|
+
* Detailed file information
|
|
330
|
+
* Operator statistics
|
|
331
|
+
* Informational messages
|
|
332
|
+
* Warning messages
|
|
333
|
+
* Performance metrics
|
|
334
|
+
====
|
|
335
|
+
|
|
336
|
+
==== -q, --quiet
|
|
337
|
+
|
|
338
|
+
Suppress success messages, only output errors.
|
|
339
|
+
|
|
340
|
+
**Syntax:**
|
|
341
|
+
|
|
342
|
+
[source,sh]
|
|
343
|
+
----
|
|
344
|
+
postsvg check --quiet FILE... <1>
|
|
345
|
+
postsvg check -q FILE... <2>
|
|
346
|
+
----
|
|
347
|
+
<1> Long form
|
|
348
|
+
<2> Short form
|
|
349
|
+
|
|
350
|
+
**Type:** Boolean flag
|
|
351
|
+
|
|
352
|
+
**Default:** `false`
|
|
353
|
+
|
|
354
|
+
**Availability:** `check` command only
|
|
355
|
+
|
|
356
|
+
**Source:** [`lib/postsvg/cli.rb:137`](../../lib/postsvg/cli.rb:137)
|
|
357
|
+
|
|
358
|
+
.Quiet mode example
|
|
359
|
+
[example]
|
|
360
|
+
====
|
|
361
|
+
[source,sh]
|
|
362
|
+
----
|
|
363
|
+
# Normal mode
|
|
364
|
+
$ postsvg check good1.ps good2.ps broken.ps
|
|
365
|
+
✓ good1.ps - Valid PostScript file
|
|
366
|
+
✓ good2.ps - Valid PostScript file
|
|
367
|
+
✗ broken.ps - Syntax error: Unmatched delimiter
|
|
368
|
+
|
|
369
|
+
# Quiet mode (only errors)
|
|
370
|
+
$ postsvg check --quiet good1.ps good2.ps broken.ps
|
|
371
|
+
✗ broken.ps - Syntax error: Unmatched delimiter
|
|
372
|
+
----
|
|
373
|
+
|
|
374
|
+
Quiet mode is useful for:
|
|
375
|
+
|
|
376
|
+
* CI/CD pipelines (only failures matter)
|
|
377
|
+
* Scripting (reduce noise)
|
|
378
|
+
* Log files (focus on problems)
|
|
379
|
+
* Large batch validation
|
|
380
|
+
====
|
|
381
|
+
|
|
382
|
+
**Interaction with --verbose:**
|
|
383
|
+
|
|
384
|
+
`--quiet` and `--verbose` are mutually exclusive. If both are specified, `--verbose` takes precedence.
|
|
385
|
+
|
|
386
|
+
==== --no-color
|
|
387
|
+
|
|
388
|
+
Disable colored terminal output.
|
|
389
|
+
|
|
390
|
+
**Syntax:**
|
|
391
|
+
|
|
392
|
+
[source,sh]
|
|
393
|
+
----
|
|
394
|
+
postsvg check --no-color FILE... <1>
|
|
395
|
+
----
|
|
396
|
+
<1> Plain text output without ANSI colors
|
|
397
|
+
|
|
398
|
+
**Type:** Boolean flag
|
|
399
|
+
|
|
400
|
+
**Default:** `false` (colors enabled)
|
|
401
|
+
|
|
402
|
+
**Availability:** `check` command only
|
|
403
|
+
|
|
404
|
+
**Source:** [`lib/postsvg/cli.rb:138`](../../lib/postsvg/cli.rb:138)
|
|
405
|
+
|
|
406
|
+
.No-color output
|
|
407
|
+
[example]
|
|
408
|
+
====
|
|
409
|
+
[source,sh]
|
|
410
|
+
----
|
|
411
|
+
# With colors (default)
|
|
412
|
+
$ postsvg check file.ps
|
|
413
|
+
✓ file.ps - Valid PostScript file # Green text
|
|
414
|
+
|
|
415
|
+
# Without colors
|
|
416
|
+
$ postsvg check --no-color file.ps
|
|
417
|
+
✓ file.ps - Valid PostScript file # Plain text
|
|
418
|
+
----
|
|
419
|
+
|
|
420
|
+
Use `--no-color` when:
|
|
421
|
+
|
|
422
|
+
* Output is redirected to file
|
|
423
|
+
* CI/CD systems don't support ANSI
|
|
424
|
+
* Terminal doesn't support colors
|
|
425
|
+
* Generating reports for parsing
|
|
426
|
+
====
|
|
427
|
+
|
|
428
|
+
**Environment Variables:**
|
|
429
|
+
|
|
430
|
+
The `NO_COLOR` environment variable is also respected:
|
|
431
|
+
|
|
432
|
+
[source,sh]
|
|
433
|
+
----
|
|
434
|
+
export NO_COLOR=1
|
|
435
|
+
postsvg check file.ps # Colors automatically disabled
|
|
436
|
+
----
|
|
437
|
+
|
|
438
|
+
==== --fail-fast
|
|
439
|
+
|
|
440
|
+
Stop validation at first error instead of checking all files.
|
|
441
|
+
|
|
442
|
+
**Syntax:**
|
|
443
|
+
|
|
444
|
+
[source,sh]
|
|
445
|
+
----
|
|
446
|
+
postsvg check --fail-fast FILE... <1>
|
|
447
|
+
----
|
|
448
|
+
<1> Exit on first validation failure
|
|
449
|
+
|
|
450
|
+
**Type:** Boolean flag
|
|
451
|
+
|
|
452
|
+
**Default:** `false` (check all files)
|
|
453
|
+
|
|
454
|
+
**Availability:** `check` command only
|
|
455
|
+
|
|
456
|
+
**Source:** [`lib/postsvg/cli.rb:139`](../../lib/postsvg/cli.rb:139)
|
|
457
|
+
|
|
458
|
+
.Fail-fast behavior
|
|
459
|
+
[example]
|
|
460
|
+
====
|
|
461
|
+
[source,sh]
|
|
462
|
+
----
|
|
463
|
+
# Without fail-fast (checks all)
|
|
464
|
+
$ postsvg check file1.ps file2.ps file3.ps file4.ps
|
|
465
|
+
✓ file1.ps - Valid
|
|
466
|
+
✗ file2.ps - Error: Stack underflow
|
|
467
|
+
✓ file3.ps - Valid
|
|
468
|
+
✗ file4.ps - Error: Missing delimiter
|
|
469
|
+
|
|
470
|
+
# With fail-fast (stops at first error)
|
|
471
|
+
$ postsvg check --fail-fast file1.ps file2.ps file3.ps file4.ps
|
|
472
|
+
✓ file1.ps - Valid
|
|
473
|
+
✗ file2.ps - Error: Stack underflow
|
|
474
|
+
# Validation stopped, file3.ps and file4.ps not checked
|
|
475
|
+
----
|
|
476
|
+
|
|
477
|
+
Fail-fast is useful for:
|
|
478
|
+
|
|
479
|
+
* Rapid feedback during development
|
|
480
|
+
* Pre-commit hooks
|
|
481
|
+
* Continuous integration checks
|
|
482
|
+
* Quick problem identification
|
|
483
|
+
====
|
|
484
|
+
|
|
485
|
+
==== --eps-version VERSION
|
|
486
|
+
|
|
487
|
+
Validate against specific EPS version requirements.
|
|
488
|
+
|
|
489
|
+
**Syntax:**
|
|
490
|
+
|
|
491
|
+
[source,sh]
|
|
492
|
+
----
|
|
493
|
+
postsvg check --eps-version=VERSION FILE... <1>
|
|
494
|
+
----
|
|
495
|
+
<1> Validate EPS version compliance
|
|
496
|
+
|
|
497
|
+
**Where:**
|
|
498
|
+
|
|
499
|
+
`VERSION`:: EPS version specification
|
|
500
|
+
* `1.0` - EPS version 1.0
|
|
501
|
+
* `2.0` - EPS version 2.0
|
|
502
|
+
* `3.0` - EPS version 3.0
|
|
503
|
+
|
|
504
|
+
**Type:** String value
|
|
505
|
+
|
|
506
|
+
**Default:** Not set (any version accepted)
|
|
507
|
+
|
|
508
|
+
**Availability:** `check` command only
|
|
509
|
+
|
|
510
|
+
**Source:** [`lib/postsvg/cli.rb:140`](../../lib/postsvg/cli.rb:140)
|
|
511
|
+
|
|
512
|
+
.EPS version validation
|
|
513
|
+
[example]
|
|
514
|
+
====
|
|
515
|
+
[source,sh]
|
|
516
|
+
----
|
|
517
|
+
# Check for EPS 3.0 compliance
|
|
518
|
+
$ postsvg check --eps-version=3.0 diagram.eps
|
|
519
|
+
✓ diagram.eps - Valid EPS 3.0 file
|
|
520
|
+
EPS version: 3.0 EPSF
|
|
521
|
+
Compliant with specification
|
|
522
|
+
|
|
523
|
+
# Version mismatch
|
|
524
|
+
$ postsvg check --eps-version=3.0 old.eps
|
|
525
|
+
✗ old.eps - EPS version mismatch
|
|
526
|
+
Expected: 3.0
|
|
527
|
+
Found: 1.0
|
|
528
|
+
Recommendation: Upgrade file or use --eps-version=1.0
|
|
529
|
+
----
|
|
530
|
+
|
|
531
|
+
EPS version checking validates:
|
|
532
|
+
|
|
533
|
+
* Header format (`%!PS-Adobe-X.X EPSF-X.X`)
|
|
534
|
+
* Required DSC comments
|
|
535
|
+
* Version-specific operators
|
|
536
|
+
* Feature compatibility
|
|
537
|
+
====
|
|
538
|
+
|
|
539
|
+
== Option Combinations
|
|
540
|
+
|
|
541
|
+
=== Validation Workflows
|
|
542
|
+
|
|
543
|
+
==== Quick Syntax Check
|
|
544
|
+
|
|
545
|
+
[source,sh]
|
|
546
|
+
----
|
|
547
|
+
postsvg check --level=syntax --quiet *.ps <1>
|
|
548
|
+
----
|
|
549
|
+
<1> Fast, silent syntax check on all files
|
|
550
|
+
|
|
551
|
+
==== Thorough Validation
|
|
552
|
+
|
|
553
|
+
[source,sh]
|
|
554
|
+
----
|
|
555
|
+
postsvg check --level=full --verbose file.ps <1>
|
|
556
|
+
----
|
|
557
|
+
<1> Complete validation with detailed output
|
|
558
|
+
|
|
559
|
+
==== CI/CD Validation
|
|
560
|
+
|
|
561
|
+
[source,sh]
|
|
562
|
+
----
|
|
563
|
+
postsvg check --format=json --no-color --fail-fast *.ps <1>
|
|
564
|
+
----
|
|
565
|
+
<1> Machine-readable, fail-fast validation for automation
|
|
566
|
+
|
|
567
|
+
==== Production Quality Gate
|
|
568
|
+
|
|
569
|
+
[source,sh]
|
|
570
|
+
----
|
|
571
|
+
postsvg check --level=full --eps-version=3.0 --verbose *.eps <1>
|
|
572
|
+
----
|
|
573
|
+
<1> Strictest validation for production files
|
|
574
|
+
|
|
575
|
+
=== Conversion Workflows
|
|
576
|
+
|
|
577
|
+
==== Safe Conversion
|
|
578
|
+
|
|
579
|
+
[source,sh]
|
|
580
|
+
----
|
|
581
|
+
postsvg check --level=full file.ps && \
|
|
582
|
+
postsvg convert file.ps file.svg <1>
|
|
583
|
+
----
|
|
584
|
+
<1> Validate fully before converting
|
|
585
|
+
|
|
586
|
+
==== Strict Batch Conversion
|
|
587
|
+
|
|
588
|
+
[source,sh]
|
|
589
|
+
----
|
|
590
|
+
postsvg batch --strict input/ output/ <1>
|
|
591
|
+
----
|
|
592
|
+
<1> Convert directory with strict validation
|
|
593
|
+
|
|
594
|
+
== Exit Codes
|
|
595
|
+
|
|
596
|
+
All Postsvg commands return standard exit codes:
|
|
597
|
+
|
|
598
|
+
[cols="1,3"]
|
|
599
|
+
|===
|
|
600
|
+
| Code | Meaning
|
|
601
|
+
|
|
602
|
+
| `0`
|
|
603
|
+
| Success - all operations completed without errors
|
|
604
|
+
|
|
605
|
+
| `1`
|
|
606
|
+
| Failure - error occurred (file not found, validation failed, conversion error)
|
|
607
|
+
|===
|
|
608
|
+
|
|
609
|
+
.Using exit codes in scripts
|
|
610
|
+
[example]
|
|
611
|
+
====
|
|
612
|
+
[source,sh]
|
|
613
|
+
----
|
|
614
|
+
#!/bin/bash
|
|
615
|
+
|
|
616
|
+
# Check exit code
|
|
617
|
+
if postsvg convert input.ps output.svg; then
|
|
618
|
+
echo "Conversion successful"
|
|
619
|
+
exit 0
|
|
620
|
+
else
|
|
621
|
+
echo "Conversion failed"
|
|
622
|
+
exit 1
|
|
623
|
+
fi
|
|
624
|
+
|
|
625
|
+
# Or use exit code directly
|
|
626
|
+
postsvg check file.ps || echo "Validation failed"
|
|
627
|
+
----
|
|
628
|
+
====
|
|
629
|
+
|
|
630
|
+
== Environment Variables
|
|
631
|
+
|
|
632
|
+
=== NO_COLOR
|
|
633
|
+
|
|
634
|
+
Disable colored output globally.
|
|
635
|
+
|
|
636
|
+
[source,sh]
|
|
637
|
+
----
|
|
638
|
+
export NO_COLOR=1 <1>
|
|
639
|
+
postsvg check file.ps # Colors disabled automatically
|
|
640
|
+
----
|
|
641
|
+
<1> Set environment variable to disable colors
|
|
642
|
+
|
|
643
|
+
**Equivalent to:** `--no-color` flag
|
|
644
|
+
|
|
645
|
+
**Scope:** Affects all commands
|
|
646
|
+
|
|
647
|
+
=== POSTSVG_STRICT
|
|
648
|
+
|
|
649
|
+
Enable strict mode by default (proposed).
|
|
650
|
+
|
|
651
|
+
[source,sh]
|
|
652
|
+
----
|
|
653
|
+
export POSTSVG_STRICT=1 <1>
|
|
654
|
+
postsvg convert file.ps file.svg # Strict mode enabled
|
|
655
|
+
----
|
|
656
|
+
<1> Enable strict mode globally
|
|
657
|
+
|
|
658
|
+
**Note:** This is a proposed feature not yet implemented.
|
|
659
|
+
|
|
660
|
+
== Common Usage Patterns
|
|
661
|
+
|
|
662
|
+
=== Development Workflow
|
|
663
|
+
|
|
664
|
+
[source,sh]
|
|
665
|
+
----
|
|
666
|
+
# Quick iteration during development
|
|
667
|
+
postsvg check --level=syntax file.ps # Fast check
|
|
668
|
+
postsvg convert file.ps file.svg # Convert
|
|
669
|
+
postsvg check --level=full file.ps # Final validation
|
|
670
|
+
----
|
|
671
|
+
|
|
672
|
+
=== CI/CD Integration
|
|
673
|
+
|
|
674
|
+
[source,sh]
|
|
675
|
+
----
|
|
676
|
+
# Automated validation pipeline
|
|
677
|
+
postsvg check \
|
|
678
|
+
--format=json \
|
|
679
|
+
--no-color \
|
|
680
|
+
--level=full \
|
|
681
|
+
--fail-fast \
|
|
682
|
+
$(find . -name "*.ps" -o -name "*.eps")
|
|
683
|
+
----
|
|
684
|
+
|
|
685
|
+
=== Production Deployment
|
|
686
|
+
|
|
687
|
+
[source,sh]
|
|
688
|
+
----
|
|
689
|
+
# Strict validation before deployment
|
|
690
|
+
postsvg check --level=full --eps-version=3.0 --verbose *.eps
|
|
691
|
+
postsvg batch --strict production/ output/
|
|
692
|
+
----
|
|
693
|
+
|
|
694
|
+
=== Debugging
|
|
695
|
+
|
|
696
|
+
[source,sh]
|
|
697
|
+
----
|
|
698
|
+
# Detailed debugging output
|
|
699
|
+
postsvg check --verbose --level=full --no-color file.ps > debug.log 2>&1
|
|
700
|
+
----
|
|
701
|
+
|
|
702
|
+
== Best Practices
|
|
703
|
+
|
|
704
|
+
=== Option Selection
|
|
705
|
+
|
|
706
|
+
**For development:**
|
|
707
|
+
- Use `--level=syntax` for quick checks
|
|
708
|
+
- Enable `--verbose` to see warnings
|
|
709
|
+
- Use `--strict` to catch unsupported operators early
|
|
710
|
+
|
|
711
|
+
**For CI/CD:**
|
|
712
|
+
- Use `--format=json` for machine parsing
|
|
713
|
+
- Enable `--no-color` for clean logs
|
|
714
|
+
- Use `--fail-fast` for quick feedback
|
|
715
|
+
- Consider `--level=full` for critical files
|
|
716
|
+
|
|
717
|
+
**For production:**
|
|
718
|
+
- Use `--level=full` for thorough validation
|
|
719
|
+
- Add `--eps-version` for compliance
|
|
720
|
+
- Keep `--verbose` for audit trails
|
|
721
|
+
- Use `--strict` in batch conversions
|
|
722
|
+
|
|
723
|
+
=== Performance Optimization
|
|
724
|
+
|
|
725
|
+
**For large file sets:**
|
|
726
|
+
|
|
727
|
+
[source,sh]
|
|
728
|
+
----
|
|
729
|
+
# Use syntax level for initial screening
|
|
730
|
+
postsvg check --level=syntax --quiet *.ps
|
|
731
|
+
|
|
732
|
+
# Full validation only on modified files
|
|
733
|
+
postsvg check --level=full $(git diff --name-only | grep '\.ps$')
|
|
734
|
+
----
|
|
735
|
+
|
|
736
|
+
**For quick feedback:**
|
|
737
|
+
|
|
738
|
+
[source,sh]
|
|
739
|
+
----
|
|
740
|
+
# Fail-fast with syntax level
|
|
741
|
+
postsvg check --level=syntax --fail-fast *.ps
|
|
742
|
+
----
|
|
743
|
+
|
|
744
|
+
=== Error Handling
|
|
745
|
+
|
|
746
|
+
**Capture and log errors:**
|
|
747
|
+
|
|
748
|
+
[source,sh]
|
|
749
|
+
----
|
|
750
|
+
# Log validation results
|
|
751
|
+
postsvg check --format=yaml --verbose *.ps > validation.yaml 2>&1
|
|
752
|
+
|
|
753
|
+
# Parse JSON results
|
|
754
|
+
postsvg check --format=json *.ps | jq '.[] | select(.valid == false)'
|
|
755
|
+
----
|
|
756
|
+
|
|
757
|
+
== Troubleshooting
|
|
758
|
+
|
|
759
|
+
=== Option Not Recognized
|
|
760
|
+
|
|
761
|
+
**Problem:**
|
|
762
|
+
[source]
|
|
763
|
+
----
|
|
764
|
+
Unknown switches '--unknown'
|
|
765
|
+
----
|
|
766
|
+
|
|
767
|
+
**Solution:**
|
|
768
|
+
Check available options for the specific command using `postsvg help COMMAND`.
|
|
769
|
+
|
|
770
|
+
=== Conflicting Options
|
|
771
|
+
|
|
772
|
+
**Problem:**
|
|
773
|
+
Both `--verbose` and `--quiet` specified.
|
|
774
|
+
|
|
775
|
+
**Solution:**
|
|
776
|
+
Use only one. `--verbose` takes precedence if both are present.
|
|
777
|
+
|
|
778
|
+
=== Invalid Option Value
|
|
779
|
+
|
|
780
|
+
**Problem:**
|
|
781
|
+
[source]
|
|
782
|
+
----
|
|
783
|
+
Invalid validation level: 'invalid'
|
|
784
|
+
----
|
|
785
|
+
|
|
786
|
+
**Solution:**
|
|
787
|
+
Use valid values: `syntax`, `semantic`, or `full`.
|
|
788
|
+
|
|
789
|
+
== Next Steps
|
|
790
|
+
|
|
791
|
+
* Review link:convert-command.adoc[convert Command] for conversion details
|
|
792
|
+
* See link:batch-command.adoc[batch Command] for bulk processing
|
|
793
|
+
* Check link:check-command.adoc[check Command] for validation workflows
|
|
794
|
+
* Explore link:../getting-started/common-workflows.adoc[Common Workflows] for real-world examples
|
|
795
|
+
|
|
796
|
+
== Bibliography
|
|
797
|
+
|
|
798
|
+
* link:convert-command.adoc[convert Command Reference]
|
|
799
|
+
* link:batch-command.adoc[batch Command Reference]
|
|
800
|
+
* link:check-command.adoc[check Command Reference]
|
|
801
|
+
* link:version-command.adoc[version Command Reference]
|
|
802
|
+
* link:../getting-started/common-workflows.adoc[Common Workflows Guide]
|