You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: htmlSanityCheck-cli/README.adoc
+92-4Lines changed: 92 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,23 +17,48 @@ The Command Line Interface (CLI) module of HTML Sanity Check (xref:{xrefToManual
17
17
18
18
== Installation (Command Line Interface)
19
19
20
-
=== Prerequisites
20
+
You can run HSC on your machine
21
+
22
+
* As a <<sec:java-usage,Java application>>{nbsp}->{nbsp}<<sec:java-installation>>, or
23
+
* As a <<sec:container-usage,Container>>{nbsp}->{nbsp}<<sec:container-installation>>, or
24
+
25
+
26
+
[[sec:java-installation]]
27
+
=== Java Installation
28
+
29
+
==== Prerequisites
21
30
22
31
The HSC CLI needs Java 8 (`java` executable) or higher on the respective OS search path (`+${PATH}+` on Linux/macOS, `%path%` on Windows).
23
32
24
-
=== SDKMAN
33
+
==== SDKMAN
25
34
26
35
If you use https://sdkman.io[SDKMAN], you can install HSC as SDKMAN candidate: `sdk install hsc`.
27
36
28
-
=== Download
37
+
==== Download
29
38
30
-
Alternatively,
39
+
Alternatively, you can download and unpack the CLI release:
31
40
32
41
* Download the HSC CLI from the https://github.com/aim42/htmlSanityCheck/releases[release{nbsp}page].
33
42
* Unpack the file in a convenient place, e.g., `/usr/local/hsc`.
43
+
* Add the unpacked bin directory to your path, e.g. (for Unix), `+PATH=${PATH}:/usr/local/hsc/bin+`.
44
+
45
+
[[sec:container-installation]]
46
+
=== Container (Docker) Installation
47
+
48
+
Alternatively, you can use a local Container runtime (such as https://www.docker.com/[Docker] or https://podman.io/[Podman]) and execute HSC as a container.
49
+
In this case, no preliminary installation is necessary (except for the container runtime) you can directly <<sec:container-usage,run HSC>>.
50
+
51
+
[NOTE]
52
+
====
53
+
While HSC supports both Docker and Podman as container runtimes, our examples and automated tests currently only use Docker.
54
+
The commands should work similarly with Podman by replacing `docker` with `podman` in the examples.
55
+
====
34
56
35
57
== Usage
36
58
59
+
[[sec:java-usage]]
60
+
=== Java usage
61
+
37
62
Execute the CLI tool with the following command.
38
63
If the `sourceDirectory` is omitted, HSC uses the current directory as base-directory to search for HTML files.
39
64
@@ -51,6 +76,69 @@ Windows::
51
76
hsc.bat [ options ] [ sourceDirectory ]
52
77
----
53
78
79
+
[[sec:container-usage]]
80
+
=== Using the Container image
81
+
82
+
You can run HSC without installing Java or the CLI by using the Container image published at the GitHub Container Registry:
83
+
`ghcr.io/aim42/hsc`.
84
+
85
+
Unix (shell) example (Linux/macOS)::
86
+
+
87
+
[source,sh]
88
+
----
89
+
# Assume your HTML files are under ./docs and you want the report under ./build/reports
90
+
docs_dir="${PWD}/docs"
91
+
reports_dir="${PWD}/build/reports"
92
+
mkdir -p "$reports_dir"
93
+
94
+
# Run the Docker image, mount the docs and a host reports directory, and set the working directory
95
+
docker run --rm \
96
+
-v "${docs_dir}:${docs_dir}" \
97
+
-v "${reports_dir}:/reports" \
98
+
-w "${docs_dir}" \
99
+
ghcr.io/aim42/hsc:latest \
100
+
-r /reports
101
+
----
102
+
103
+
Add options as necessary (example)::
104
+
+
105
+
[source,sh]
106
+
----
107
+
# Exclude some external links via regex and restrict checked suffixes
* The container entrypoint simply invokes the CLI (`java -jar /hsc.jar`) and forwards all arguments, so you can pass the same options as described below.
137
+
* Reports will be written to the directory you mount at `/reports` when using `-r /reports`.
138
+
* Tags: use `:latest` for the latest released image.
139
+
Development builds may also be available using branch-name tags (used in integration tests).
140
+
* The integration test `integration-test/build.gradle` contains a full working example of the Docker invocation used in CI.
141
+
54
142
=== Options
55
143
56
144
The CLI tool exposes a few options as part of its configuration:
0 commit comments