feat: add newSub (#44)

This commit is contained in:
Jeroen Op 't Eynde 2023-02-16 19:56:58 +01:00 committed by GitHub
parent b5a6b0e838
commit 5e45c19fbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 2 deletions

View file

@ -7,6 +7,7 @@ release:
goreleaser release --rm-dist
docs:
jsonnet -S -c -m doc-util/ \
-e "(import 'doc-util/main.libsonnet').render(import 'doc-util/main.libsonnet')"
cd doc-util && \
jsonnet -S -c -m . \
-e "(import './main.libsonnet').render(import './main.libsonnet')"

View file

@ -38,6 +38,7 @@ local d = import "github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet"
* [`obj T`](#obj-t)
* [`obj package`](#obj-package)
* [`fn new(name, url, help, filename='', version='master')`](#fn-packagenew)
* [`fn newSub(name, help)`](#fn-packagenewsub)
## Fields
@ -202,3 +203,17 @@ Arguments:
* `filename` for the import, defaults to blank for backward compatibility
* `version` for jsonnet-bundler install, defaults to `master` just like jsonnet-bundler
#### fn package.newSub
```ts
newSub(name, help)
```
`newSub` creates a package without the preconfigured install/usage templates.
Arguments:
* given `name`
* `help` text

View file

@ -49,6 +49,23 @@
'local %(name)s = import "%(import)s"'
),
'#newSub':: d.fn(|||
`newSub` creates a package without the preconfigured install/usage templates.
Arguments:
* given `name`
* `help` text
|||, [
d.arg('name', d.T.string),
d.arg('help', d.T.string),
]),
newSub(name, help)::
{
name: name,
help: help,
},
withUsageTemplate(template):: {
usageTemplate: template,
},