Skip to content

Commit 67fbe3d

Browse files
author
Alexander Weber
committed
default config
1 parent f42ffc9 commit 67fbe3d

6 files changed

Lines changed: 59 additions & 60 deletions

File tree

.complate/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,3 @@ templates:
4646
display: bravo
4747
value:
4848
shell: printf bravo
49-

docs/wiki/content/docs/command reference/_index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ weight: 4
99

1010
== Disclaimer
1111

12-
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 [semver v2](https://semver.org)). Use these features on your own risk!
12+
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!
1313

1414
== Features
1515

docs/wiki/content/docs/configuration/_index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ You can resolve the value for each variable individual. Following options are av
8080

8181
|static|Simply replaces the variable with a static value |None|
8282
|prompt|Asks the user for text input (can be empty)|The prompt|
83-
|shell|Invokes a shell command to resolve the variable (read from STDOUT)|None|See `shell security`
83+
|shell|Invokes a shell command to resolve the variable (read from `STDOUT`)|None|See `shell security`
8484
|select|Asks the user to select one item from a list|`text`: string (context), `options`: list (available options to select from)|
85-
|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)|
85+
|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)|
8686
|===
8787

8888
#### Shell security

src/args/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl ClapArgumentLoader {
128128
.short("v")
129129
.long("value")
130130
.value_name("VALUE")
131-
.help("Overrides a certain value definition with a string")
131+
.help("Overrides a certain value definition with a string.")
132132
.multiple(true)
133133
.required(false)
134134
.takes_value(true)))

src/config/mod.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,57 @@ impl Template {
6868
}
6969
}
7070
}
71+
72+
pub async fn default_config() -> String {
73+
r###"version: 0.10
74+
templates:
75+
one:
76+
content:
77+
file: ./.complate/templates/arbitraty-template-file.tpl
78+
values:
79+
a.summary:
80+
static: "random summary"
81+
two:
82+
content:
83+
inline: |-
84+
{{ a.alpha }}
85+
{{ b.bravo }}
86+
{{ c.charlie }}
87+
{{ d.delta }}
88+
{{ e.echo }}
89+
values:
90+
a.alpha:
91+
prompt: "alpha"
92+
b.bravo:
93+
shell: "printf bravo"
94+
c.charlie:
95+
static: "charlie"
96+
d.delta:
97+
select:
98+
text: Select the version level that shall be incremented
99+
options:
100+
alpha:
101+
display: alpha
102+
value:
103+
static: alpha
104+
bravo:
105+
display: bravo
106+
value:
107+
shell: printf bravo
108+
e.echo:
109+
check:
110+
text: Select the components that are affected
111+
separator: ", "
112+
options:
113+
alpha:
114+
display: alpha
115+
value:
116+
static: alpha
117+
bravo:
118+
display: bravo
119+
value:
120+
shell: printf bravo
121+
122+
"###
123+
.to_owned()
124+
}

src/main.rs

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,68 +10,14 @@ pub mod config;
1010
pub mod render;
1111
pub mod error;
1212

13-
async fn default_config() -> String {
14-
r###"version: 0.10
15-
templates:
16-
one:
17-
content:
18-
file: ./.complate/templates/arbitraty-template-file.tpl
19-
values:
20-
a.summary:
21-
static: "random summary"
22-
two:
23-
content:
24-
inline: |-
25-
{{ a.alpha }}
26-
{{ b.bravo }}
27-
{{ c.charlie }}
28-
{{ d.delta }}
29-
{{ e.echo }}
30-
values:
31-
a.alpha:
32-
prompt: "alpha"
33-
b.bravo:
34-
shell: "printf bravo"
35-
c.charlie:
36-
static: "charlie"
37-
d.delta:
38-
select:
39-
text: Select the version level that shall be incremented
40-
options:
41-
alpha:
42-
display: alpha
43-
value:
44-
static: alpha
45-
bravo:
46-
display: bravo
47-
value:
48-
shell: printf bravo
49-
e.echo:
50-
check:
51-
text: Select the components that are affected
52-
separator: ", "
53-
options:
54-
alpha:
55-
display: alpha
56-
value:
57-
static: alpha
58-
bravo:
59-
display: bravo
60-
value:
61-
shell: printf bravo
62-
63-
"###
64-
.to_owned()
65-
}
66-
6713
async fn async_main() -> Result<(), Box<dyn std::error::Error>> {
6814
let cmd = crate::args::ClapArgumentLoader::load_from_cli().await?;
6915
cmd.validate().await?;
7016

7117
match cmd.command {
7218
crate::args::Command::Init => {
7319
std::fs::create_dir_all("./.complate")?;
74-
std::fs::write("./.complate/config.yaml", default_config().await)?;
20+
std::fs::write("./.complate/config.yaml", crate::config::default_config().await)?;
7521
Ok(())
7622
}
7723
crate::args::Command::Render(x) => {

0 commit comments

Comments
 (0)