File: prompt-user-for-variables.md

package info (click to toggle)
dotdrop 1.15.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,812 kB
  • sloc: sh: 13,401; python: 8,186; makefile: 3
file content (26 lines) | stat: -rw-r--r-- 926 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Prompt user for variables

With the use of [uservariables](../config/config-uservars.md),
one can define specific variables that need to be initially filled in manually
by the user on first run.

The provided values are then automatically saved by dotdrop to `uservariables.yaml`,
which can be included in the main config as a file from which variables are imported
using [import_variables](../config/config-config.md).

Let's say, for example, that you want to manually provide the email value
on new hosts you deploy your dotfiles to.

You'd add the following elements to your config:
```yaml
uservariables:
  emailvar: "email"
config:
  import_variables:
    - uservariables.yaml:optional
```

On first run, the `emailvar` is prompted to the user and then saved
to `uservariables.yaml`. Since this file is imported, the value for
`emailvar` will automatically be filled in without prompting the
user on subsequent calls.