Skip to content

Commit 670ce85

Browse files
committed
Document CLI commands
1 parent 4ec33bd commit 670ce85

File tree

3 files changed

+184
-8
lines changed

3 files changed

+184
-8
lines changed

README.md

Lines changed: 122 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
- [Scala Native integration](#scala-native-integration)
1212
- [SBT](#sbt)
1313
- [Mill](#mill)
14+
- [CLI](#cli)
15+
- [`bootstrap`](#bootstrap)
16+
- [`install`](#install)
17+
- [`install-manifest`](#install-manifest)
1418
- [Core](#core)
1519
- [VcpkgRootInit](#vcpkgrootinit)
1620
- [VcpkgNativeConfig](#vcpkgnativeconfig)
@@ -215,6 +219,118 @@ object example extends VcpkgNativeModule {
215219
}
216220
```
217221

222+
### CLI
223+
224+
This is a very thin interface to the [Core](#core) module, designed
225+
mostly for demonstration purposes or to install dependencies in CI/containers,
226+
without launching the SBT/Mill project.
227+
228+
Installation with Coursier:
229+
230+
```bash
231+
$ cs install sn-vcpkg --channel https://cs.indoorvivants.com/i.json
232+
```
233+
234+
Usage example:
235+
236+
```bash
237+
$ sn-vcpkg install libgit2 -l -c
238+
```
239+
240+
This will install `libgit2` package, and output linking flags (`-l`) and compilation flags (`-c`), one per line.
241+
242+
243+
#### `bootstrap`
244+
245+
Only bootstrap vcpkg if necessary, without installing anything
246+
247+
```
248+
Usage: sn-vcpkg bootstrap [--vcpkg-root-manual <location> [--no-bootstrap] | --vcpkg-root-env <env-var> [--no-bootstrap] | --no-bootstrap] [--vcpkg-install <dir>] [--no-bootstrap] [--verbose] [--quiet]
249+
250+
Bootstrap vcpkg
251+
252+
Options and flags:
253+
--help
254+
Display this help text.
255+
--vcpkg-root-manual <location>
256+
Initialise vcpkg in this location
257+
--no-bootstrap
258+
Allow bootstrapping vcpkg from scratch
259+
--vcpkg-root-env <env-var>
260+
Pick up vcpkg root from the environment variable
261+
--vcpkg-install <dir>
262+
folder where packages will be installed
263+
--verbose, -v
264+
Verbose logging
265+
--quiet, -q
266+
Only error logging
267+
```
268+
269+
#### `install`
270+
271+
Install one or several dependencies, and optionally output linking/compilation flags for all of them.
272+
273+
Example: `sn-vcpkg install libgit2 cjson -l -c`
274+
275+
```
276+
Usage: sn-vcpkg install [--output-compilation] [--output-linking] [--vcpkg-root-manual <location> [--no-bootstrap] | --vcpkg-root-env <env-var> [--no-bootstrap] | --no-bootstrap] [--vcpkg-install <dir>] [--no-bootstrap] [--verbose] [--quiet] <dep>...
277+
278+
Install a list of vcpkg dependencies
279+
280+
Options and flags:
281+
--help
282+
Display this help text.
283+
--output-compilation, -c
284+
Output (to STDOUT) compilation flags for installed libraries, one per line
285+
--output-linking, -l
286+
Output (to STDOUT) linking flags for installed libraries, one per line
287+
--vcpkg-root-manual <location>
288+
Initialise vcpkg in this location
289+
--no-bootstrap
290+
Allow bootstrapping vcpkg from scratch
291+
--vcpkg-root-env <env-var>
292+
Pick up vcpkg root from the environment variable
293+
--vcpkg-install <dir>
294+
folder where packages will be installed
295+
--verbose, -v
296+
Verbose logging
297+
--quiet, -q
298+
Only error logging
299+
```
300+
301+
#### `install-manifest`
302+
303+
Install dependencies from a manifest file, and optionally output linking/compilation flags for all of them.
304+
305+
Example: `sn-vcpkg install-manifest vcpkg.json -l -c`
306+
307+
```
308+
Usage: sn-vcpkg install-manifest [--output-compilation] [--output-linking] [--vcpkg-root-manual <location> [--no-bootstrap] | --vcpkg-root-env <env-var> [--no-bootstrap] | --no-bootstrap] [--vcpkg-install <dir>] [--no-bootstrap] [--verbose] [--quiet] <vcpkg manifest file>
309+
310+
Install vcpkg dependencies from a manifest file (like vcpkg.json)
311+
312+
Options and flags:
313+
--help
314+
Display this help text.
315+
--output-compilation, -c
316+
Output (to STDOUT) compilation flags for installed libraries, one per line
317+
--output-linking, -l
318+
Output (to STDOUT) linking flags for installed libraries, one per line
319+
--vcpkg-root-manual <location>
320+
Initialise vcpkg in this location
321+
--no-bootstrap
322+
Allow bootstrapping vcpkg from scratch
323+
--vcpkg-root-env <env-var>
324+
Pick up vcpkg root from the environment variable
325+
--vcpkg-install <dir>
326+
folder where packages will be installed
327+
--verbose, -v
328+
Verbose logging
329+
--quiet, -q
330+
Only error logging
331+
```
332+
333+
218334

219335
### Core
220336

@@ -243,7 +359,7 @@ compilation arguments from installed vcpkg dependencies.
243359
**Defaults**
244360
```scala
245361
VcpkgNativeConfig()
246-
// res0: VcpkgNativeConfig = Vcpkg NativeConfig:
362+
// res3: VcpkgNativeConfig = Vcpkg NativeConfig:
247363
// | approximate = true
248364
// | autoConfigure = true
249365
// | prependCompileOptions = true
@@ -288,7 +404,7 @@ VcpkgNativeConfig().withPrependLinkingOptions(true)
288404
```scala
289405
// Completely overwrite
290406
VcpkgNativeConfig().withRenamedLibraries(Map("cjson" -> "libcjson", "cmark" -> "libcmark"))
291-
// res5: VcpkgNativeConfig = Vcpkg NativeConfig:
407+
// res8: VcpkgNativeConfig = Vcpkg NativeConfig:
292408
// | approximate = true
293409
// | autoConfigure = true
294410
// | prependCompileOptions = true
@@ -298,7 +414,7 @@ VcpkgNativeConfig().withRenamedLibraries(Map("cjson" -> "libcjson", "cmark" -> "
298414

299415
// Append only
300416
VcpkgNativeConfig().addRenamedLibrary("cjson", "libcjson")
301-
// res6: VcpkgNativeConfig = Vcpkg NativeConfig:
417+
// res9: VcpkgNativeConfig = Vcpkg NativeConfig:
302418
// | approximate = true
303419
// | autoConfigure = true
304420
// | prependCompileOptions = true
@@ -315,7 +431,7 @@ Specification for vcpkg dependencies. Can be either:
315431

316432
```scala
317433
VcpkgDependencies("cmark", "cjson")
318-
// res7: VcpkgDependencies = Names(
434+
// res10: VcpkgDependencies = Names(
319435
// deps = List(
320436
// Dependency(name = "cmark", features = Set()),
321437
// Dependency(name = "cjson", features = Set())
@@ -327,14 +443,14 @@ VcpkgDependencies("cmark", "cjson")
327443

328444
```scala
329445
VcpkgDependencies(new java.io.File("./vcpkg.json"))
330-
// res8: VcpkgDependencies = ManifestFile(path = ./vcpkg.json)
446+
// res11: VcpkgDependencies = ManifestFile(path = ./vcpkg.json)
331447
```
332448

333449
- a list of detailed dependency specs:
334450

335451
```scala
336452
VcpkgDependencies.Names(List(Dependency("libpq", Set("arm-build")), Dependency.parse("cpprestsdk[boost]")))
337-
// res9: VcpkgDependencies.Names = Names(
453+
// res12: Names = Names(
338454
// deps = List(
339455
// Dependency(name = "libpq", features = Set("arm-build")),
340456
// Dependency(name = "cpprestsdk", features = Set("boost"))

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ lazy val docs =
7373
project
7474
.in(file("_docs"))
7575
.enablePlugins(MdocPlugin)
76-
.dependsOn(core.jvm(V.scala213))
77-
.settings(scalaVersion := V.scala213)
76+
.dependsOn(core.jvm(V.scala3), cli.jvm(V.scala3))
77+
.settings(scalaVersion := V.scala3)
7878
.settings(
7979
mdocVariables := Map("VERSION" -> "0.0.11", "SCALA3_VERSION" -> V.scala3)
8080
)

docs/README.in.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
- [Scala Native integration](#scala-native-integration)
1212
- [SBT](#sbt)
1313
- [Mill](#mill)
14+
- [CLI](#cli)
15+
- [`bootstrap`](#bootstrap)
16+
- [`install`](#install)
17+
- [`install-manifest`](#install-manifest)
1418
- [Core](#core)
1519
- [VcpkgRootInit](#vcpkgrootinit)
1620
- [VcpkgNativeConfig](#vcpkgnativeconfig)
@@ -215,6 +219,62 @@ object example extends VcpkgNativeModule {
215219
}
216220
```
217221

222+
### CLI
223+
224+
This is a very thin interface to the [Core](#core) module, designed
225+
mostly for demonstration purposes or to install dependencies in CI/containers,
226+
without launching the SBT/Mill project.
227+
228+
Installation with Coursier:
229+
230+
```bash
231+
$ cs install sn-vcpkg --channel https://cs.indoorvivants.com/i.json
232+
```
233+
234+
Usage example:
235+
236+
```bash
237+
$ sn-vcpkg install libgit2 -l -c
238+
```
239+
240+
This will install `libgit2` package, and output linking flags (`-l`) and compilation flags (`-c`), one per line.
241+
242+
243+
#### `bootstrap`
244+
245+
Only bootstrap vcpkg if necessary, without installing anything
246+
247+
```scala mdoc:passthrough
248+
val help = com.indoorvivants.vcpkg.cli.Options.opts.parse(Array("bootstrap", "--help")).fold(identity, _ => ???)
249+
250+
println(s"```\n$help\n```")
251+
```
252+
253+
#### `install`
254+
255+
Install one or several dependencies, and optionally output linking/compilation flags for all of them.
256+
257+
Example: `sn-vcpkg install libgit2 cjson -l -c`
258+
259+
```scala mdoc:passthrough
260+
val helpInstall = com.indoorvivants.vcpkg.cli.Options.opts.parse(Array("install", "--help")).fold(identity, _ => ???)
261+
262+
println(s"```\n$helpInstall\n```")
263+
```
264+
265+
#### `install-manifest`
266+
267+
Install dependencies from a manifest file, and optionally output linking/compilation flags for all of them.
268+
269+
Example: `sn-vcpkg install-manifest vcpkg.json -l -c`
270+
271+
```scala mdoc:passthrough
272+
val helpManifest = com.indoorvivants.vcpkg.cli.Options.opts.parse(Array("install-manifest", "--help")).fold(identity, _ => ???)
273+
274+
println(s"```\n$helpManifest\n```")
275+
```
276+
277+
218278

219279
### Core
220280

0 commit comments

Comments
 (0)