File tree 8 files changed +44
-20
lines changed
8 files changed +44
-20
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,9 @@ Dotdrop is available on:
98
98
# Getting started
99
99
100
100
[ Create a new repository] ( https://dotdrop.readthedocs.io/en/latest/getting-started/#repository-setup )
101
- to store your dotfiles with dotdrop. * Init* or * clone* that new repository and
102
- [ install dotdrop] ( https://dotdrop.readthedocs.io/en/latest/installation/ ) .
101
+ to store your dotfiles with dotdrop. * Init* or * clone* that new repository,
102
+ [ install dotdrop] ( https://dotdrop.readthedocs.io/en/latest/installation/ ) and
103
+ generate a default config file [ generate config file] ( https://dotdrop.readthedocs.io/en/latest/usage/#generate-a-default-config )
103
104
104
105
Then import any dotfiles (files or directories) you want to manage with dotdrop.
105
106
You can either use the default profile (which resolves to the * hostname* of the host
Original file line number Diff line number Diff line change 2
2
# author: deadc0de6 (https://github.com/deadc0de6)
3
3
# Copyright (c) 2017, deadc0de6
4
4
5
- fold=" dotfiles"
6
5
conf=" config.yaml"
7
6
8
7
# copy dotdrop entry point
9
8
cp dotdrop/dotdrop.sh dotdrop.sh
10
9
chmod +x dotdrop.sh
11
- mkdir -p $fold
10
+ mkdir -p dotfiles
12
11
13
- if [ ! -e ${conf} ]; then
12
+ if [ ! -e " ${conf} " ]; then
14
13
# init config file
15
- cat << EOF > ${conf}
16
- config:
17
- backup: true
18
- create: true
19
- dotpath: $fold
20
- dotfiles:
21
- profiles:
22
- EOF
14
+ ./dotdrop.sh gencfg > " ${conf} "
23
15
fi
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ Entry | Description | Default
38
38
` workdir ` | Path to the directory where templates are installed before being symlinked when using ` link:absolute|relative|link_children ` (absolute path or relative to the config file location) | ` ~/.config/dotdrop `
39
39
<s >link_by_default</s > | When importing a dotfile, set ` link ` to this value by default | false
40
40
41
-
42
41
## import_variables entry
43
42
44
43
It is possible to load variables/dynvariables from external files by providing their
Original file line number Diff line number Diff line change 2
2
3
3
## Location
4
4
5
- The default config file used by dotdrop is
6
- [ config.yaml ] ( https://github.com/deadc0de6/ dotdrop/blob/master/config.yaml ) .
5
+ The default config file used by dotdrop is ` config.yaml ` .
6
+ A clean base config can be generated using ` dotdrop gencfg ` .
7
7
8
8
Unless specified otherwise, dotdrop will look in the following places for its config file
9
9
and use the first one found:
Original file line number Diff line number Diff line change @@ -15,12 +15,11 @@ $ cd my-dotfiles
15
15
$ mkdir dotfiles
16
16
```
17
17
18
- Then add a config file. You can get a
19
- [ minimal config file] ( https://github.com/deadc0de6/dotdrop/blob/master/config.yaml )
20
- from dotdrop's repository with:
18
+ Then generate a base config file:
21
19
``` bash
22
- $ wget https://raw.githubusercontent.com/deadc0de6/ dotdrop/master/ config.yaml
20
+ $ dotdrop gencfg > config.yaml
23
21
```
22
+
24
23
It is recommended to store your config file directly within your repository
25
24
(* my-dotfiles* in the example above), but you could save it in different places if you wish;
26
25
see [ config location] ( config/config-file.md#location ) for more.
Original file line number Diff line number Diff line change @@ -250,6 +250,13 @@ the file will be restored.
250
250
251
251
For more options, see the usage with ` dotdrop --help ` .
252
252
253
+ ## Generate a default config
254
+
255
+ The ` gencfg ` command will generate a default config in yaml
256
+ ``` bash
257
+ $ dotdrop gencfg > config.yaml
258
+ ```
259
+
253
260
## Concurrency
254
261
255
262
The command line switch ` -w ` /` --workers ` , if set to a value greater than one, enables the use
Original file line number Diff line number Diff line change
1
+ """
2
+ author: deadc0de6 (https://github.com/deadc0de6)
3
+ Copyright (c) 2024, deadc0de6
4
+
5
+ default config
6
+ """
7
+
8
+ default_config = """config:
9
+ backup: true
10
+ banner: true
11
+ create: true
12
+ dotpath: dotfiles
13
+ keepdot: false
14
+ link_dotfile_default: nolink
15
+ link_on_import: nolink
16
+ longkey: false
17
+ dotfiles:
18
+ profiles:"""
Original file line number Diff line number Diff line change 21
21
from dotdrop .action import Action
22
22
from dotdrop .utils import uniq_list , debug_list , debug_dict
23
23
from dotdrop .exceptions import YamlException , OptionsException
24
+ from dotdrop .config import default_config
24
25
25
26
ENV_PROFILE = 'DOTDROP_PROFILE'
26
27
ENV_CONFIG = 'DOTDROP_CONFIG'
72
73
dotdrop files [-VbTG] [-c <path>] [-p <profile>]
73
74
dotdrop detail [-Vb] [-c <path>] [-p <profile>] [<key>...]
74
75
dotdrop profiles [-VbG] [-c <path>]
76
+ dotdrop gencfg
75
77
dotdrop --help
76
78
dotdrop --version
77
79
@@ -148,6 +150,12 @@ def __init__(self, args=None):
148
150
self .args = {}
149
151
if not args :
150
152
self .args = docopt (USAGE , version = VERSION )
153
+
154
+ if self .args ['gencfg' ]:
155
+ # print config and exit
156
+ print (default_config )
157
+ sys .exit (0 )
158
+
151
159
if args :
152
160
self .args = args .copy ()
153
161
self .debug = self .args ['--verbose' ] or ENV_DEBUG in os .environ
You can’t perform that action at this time.
0 commit comments