Skip to content

Commit af3138f

Browse files
author
Alexander Weber
committed
docs
1 parent 8b679bc commit af3138f

20 files changed

Lines changed: 150 additions & 428 deletions

File tree

.github/workflows/pipeline.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/website.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

docs/README.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# complate
2+
3+
`complate` is a general purpose text templating CLI program that supports interactive mode, prompting the user for values via TUI behaviour and headless mode for use in automation such as CI pipelines.
4+
5+
## Installation
6+
7+
* The rusty way:\
8+
`cargo install complate --force`
9+
* The manual way:\
10+
Download and install from the GitHub releases
11+
12+
13+
## Usage
14+
15+
* `complate render`
16+
* `complate render -c .complate/alternative.yml`
17+
* `complate -e render -c <(cat .complate/alternative.yaml) -bui -t0.default`
18+
* `complate -e render -t three --helpers`
19+
20+
## Configuration
21+
22+
An example:
23+
24+
```
25+
version: 0.11
26+
templates:
27+
zero:
28+
content:
29+
inline: |-
30+
{{ a.alpha }}
31+
values:
32+
a.alpha:
33+
static: ALPHA
34+
one:
35+
content:
36+
file: ./.complate/templates/arbitraty-template-file.tpl
37+
values:
38+
a.pwd:
39+
env: "PWD"
40+
two:
41+
content:
42+
inline: |-
43+
{{ a.alpha }}
44+
{{ b.bravo }}
45+
{{ c.charlie }}
46+
{{ d.delta }}
47+
{{ e.echo }}
48+
values:
49+
a.alpha:
50+
prompt: "alpha"
51+
b.bravo:
52+
shell: "printf bravo"
53+
c.charlie:
54+
static: "charlie"
55+
d.delta:
56+
select:
57+
text: Select the version level that shall be incremented
58+
options:
59+
alpha:
60+
display: alpha
61+
value:
62+
static: alpha
63+
bravo:
64+
display: bravo
65+
value:
66+
shell: printf bravo
67+
e.echo:
68+
check:
69+
text: Select the components that are affected
70+
separator: ", "
71+
options:
72+
alpha:
73+
display: alpha
74+
value:
75+
static: alpha
76+
bravo:
77+
display: bravo
78+
value:
79+
shell: printf bravo
80+
f.foxtrot:
81+
env: "FOXTROT"
82+
three:
83+
content:
84+
inline: |-
85+
{{ _decode "dGVzdA==" }}
86+
helpers:
87+
"_decode":
88+
shell: |-
89+
printf "$(printf $VALUE | base64 -D)"
90+
values: {}
91+
92+
```
93+
94+
| Key | Behaviour | Input |
95+
| ------ | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
96+
| env | Retrieves value from the specified env var | None |
97+
| static | Simply replaces the variable with a static value | None |
98+
| prompt | Asks the user for text input (can be empty) | The prompt |
99+
| shell | Invokes a shell command to resolve the variable (read from `STDOUT`) | None |
100+
| select | Asks the user to select one item from a list | `text`: string (context), `options`: list (available options to select from) |
101+
| check | Asks the user to select `0..n` item(s) from a list (multiselect) | `text`: string (context), `options`: list of options {display: str, value: str} (the available options to select from) |
102+
103+
Since the `shell` value provider is able to run arbitrary shell commands, it is only allowed if and only if the `SHELL_TRUST` argument is explicitly set. See the `render` command reference for possible values for this setting. If *not* set, the provider will throw an unrecoverable error and the program will abort.
104+
105+
## Command reference
106+
107+
### Disclaimer
108+
109+
All features that are marked as `experimental` are _not_ considered a public API and therefore eplicitly not covered by the backwards-compatibility policy inside a major version (see https://semver.org[semver v2]). Use these features on your own risk!
110+
111+
### Application level arguments
112+
113+
| Name | Short | Long | Description |
114+
| ------------ | ----- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
115+
| Experimental | -e | --experimental | Activates experimental features that are not stable yet. All features that are marked as experimental are ignored when keeping backwards compatibility inside one major version. |
116+
117+
### Commands
118+
119+
| Command | Description | Status |
120+
| ------- | -------------------------------------------------------------------------------------- | ------ |
121+
| help | Prints the help to `STDOUT`. | stable |
122+
| init | Initializes the default configuration in `./.complate/config.yaml` | stable |
123+
| render | Prompts for the template, prompts for variable values and renders the data to `STDOUT` | stable |
124+
125+
#### `render` command flags
126+
127+
| Name | Short | Long | Description | Remark | Status |
128+
| ----------- | ----- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
129+
| Config | -c | --config | The path to the configuration file that shall be used. This path can be relative or absolute. The default path is `./complate/config.yaml`. | When setting this argument to pipe (`-`), the config is parsed from the STDIN descriptor to the render command. | stable for file path, experimental for STDIN descriptor. Pipe is only supported for `UI` backend |
130+
| Shell trust | | --shell-trust | Enables the shell value provider for replacing template placeholders. Due to the potential security risk with this option, it is disabled by default. Possible values for this option are `none` (default) and `ultimate` | | stable |
131+
| Template | -t | --template | Skip the template selection by defining the used template from the configuration via this argument | | stable |
132+
| Backend | -b | --backend | Defines the backend for the user interaction. | | `CLI` is stable. `UI` is experimental (feature = "backend+ui"). |
133+
| Value | -v | --value | Overrides a certain variable with a given string value. Specify the variable and value with an equals sign as separator | Multiple allowed. Example: <br/> `-v"variable=some arbitrary value"` | experimental |
134+
| Helpers | | --helpers | Enables helper functions. | | experimental |
135+
136+
## Features
137+
138+
| Name | Description | Default |
139+
| ----------- | -------------------------------------------------------------------- | ------- |
140+
| backend+cli | The CLI backend which maps to the original dialoguer implementation. | Yes |
141+
| backend+ui | The UI backend which maps to the new cursive/fui implementation. | No |
142+
143+
### `backend+`
144+
145+
Either one of the `backend+` features (or both) MUST be enabled for `complate` to work (it won't compile otherwise).
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
---
2-
doctype: article
3-
title: "1: Usage of ADRs"
4-
date: 2021-10-10
5-
draft: false
6-
weight: 1
7-
---
8-
:toc:
9-
10-
== 1: Usage of ADRs
1+
# 1: Usage of ADRs
112

123
This project uses ADRs. ADRs are documented in this repository and format. In doubt, the documents in this repository and documentation are to be considered as the single source of truth.
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
---
2-
doctype: article
3-
title: "2: Usage of keywords"
4-
date: 2021-10-10
5-
draft: false
6-
weight: 2
7-
---
8-
:toc:
9-
10-
== 2: Usage of keywords
1+
# 2: Usage of keywords
112

123
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document and in all documents in it's subtree as well as all documents that are directly related to this document are to be interpreted as described in https://tools.ietf.org/html/bcp14[BCP 14], https://tools.ietf.org/html/rfc2119[RFC2119] and https://tools.ietf.org/html/rfc8174[RFC8174] when, and only when, they appear in all capitals, as shown here.
134

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
---
2-
doctype: article
3-
title: "3: Versioning"
4-
date: 2021-10-10
5-
draft: false
6-
weight: 3
7-
---
8-
:toc:
9-
10-
== 3: Versioning
1+
# 3: Versioning
112

123
This project makes use of https://semver.org[the semver v2 versioning scheme] for all parts of the official public API. The public stable API is a subset of all available features (see link:/complate/docs/adrs/4-experimental-flag[this page]).
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
---
2-
doctype: article
3-
title: "4: Experimental flag"
4-
date: 2021-10-10
5-
draft: false
6-
weight: 4
7-
---
8-
:toc:
9-
10-
== 4: Experimental flag
1+
# 4: Experimental flag
112

123
There is a application level argument (flag) `experimental` (`-e` | `--experimental`) that indicates that experimental features can now be accessed. This flag explicitly marks features that are NOT part of the official public API and therefore NOT considered when applying the versioning scheme (see link:/complate/docs/adrs/3-versioning[ADR 3]). +
134
This flag is designed to be used with and therefore CAN be used with link:/complate/docs/adrs/5-feature-flags[feature Flags as specified in ADR 5].
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
---
2-
doctype: article
3-
title: "5: Feature flags"
4-
date: 2021-10-10
5-
draft: false
6-
weight: 5
7-
---
8-
:toc:
9-
10-
== 5: Feature flags
1+
# 5: Feature flags
112

123
This project makes use of cargo feature flags. Feature flags count as part of the public API and are therefore to be considered when applying the version rules IF NOT marked as experimental (see link:/complate/docs/adrs/4-experimental-flag[ADR 4]). +
134
All feature flags MUST be documented in an appropriate manner in the documentation.
File renamed without changes.

docs/wiki/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)