feat: document plain values (#12)

* feat: document plain values

Adds `d.val` to attach type and help information to plain Jsonnet
values, apart from specially treated `fn` and `obj`.

* feat: defaults
This commit is contained in:
sh0rez 2020-07-27 16:59:04 +02:00 committed by GitHub
parent 4c6f532e05
commit 2f9dcb2d21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 99 additions and 11 deletions

View file

@ -18,6 +18,7 @@ local d = import "github.com/sh0rez/docsonnet/doc-util"
* [`fn fn(help, args)`](#fn-fn)
* [`fn obj(help, fields)`](#fn-obj)
* [`fn pkg(name, url, help)`](#fn-pkg)
* [`fn val(type, help, default)`](#fn-val)
* [`obj argument`](#obj-argument)
* [`fn new(name, type, default)`](#fn-argumentnew)
* [`obj func`](#obj-func)
@ -29,6 +30,8 @@ local d = import "github.com/sh0rez/docsonnet/doc-util"
* [`fn withFields(fields)`](#fn-objectwithfields)
* [`obj package`](#obj-package)
* [`fn new(name, url, help)`](#fn-packagenew)
* [`obj value`](#obj-value)
* [`fn new(type, help, default)`](#fn-valuenew)
## Fields
@ -64,6 +67,14 @@ pkg(name, url, help)
`new` is a shorthand for `package.new`
### fn val
```ts
val(type, help, default)
```
`val` is a shorthand for `value.new`
## obj argument
Utilities for creating function arguments
@ -134,4 +145,16 @@ The `withFields` modifier overrides the fields property of an already created ob
new(name, url, help)
```
new creates a new package with given `name`, `import` URL and `help` text
new creates a new package with given `name`, `import` URL and `help` text
## obj value
Utilities for documenting plain Jsonnet values (primitives)
### fn value.new
```ts
new(type, help, default)
```
new creates a new object of given type, optionally with description and default value