Closed ShoHoukyo closed 1 month ago
@ShoHoukyo DOTDROP_WORKDIR
as far as I can tell works as expected, it is used in all tests and I just tested it. Can you please provide me with a use-case where it is not working for you?
The workdir
is not used to determine final install locations
but for the temporary destination of templated symlinked files as described here and here.
Path to the directory where templates are installed before being symlinked when using link:absolute|relative|link_children
It may be a misunderstanding on the workdir
usage. The final destination of any dotfile is defined by its entry in the config file, as for example:
dotfiles:
f_abc:
dst: ~/.abc
src: abc
The destination of the f_abc
dotfile is ~/.abc
.
Thanks! It's a misunderstanding.
I understand this is not intended use of dotdrop, but is there any way to output to 2 different dirs based on profile (like below)? Example based on above config.yaml:
# DOTDROP_PROFILE=profile1 dotdrop install
outputs to
profile1/common/diff.toml
...
# DOTDROP_PROFILE=profile2 dotdrop install
outputs to
profile2/common/diff.toml
...
What you are trying to do is absolutely doable with dotdrop and there are multiple ways to achieve it:
by using two entries pointing to the same file
dotfiles:
f_abc_profile1:
dst: ~/profile1/common/diff.toml
src: abc
f_abc_profile2:
dst: ~/profile2/common/diff.toml
src: abc
profiles:
profile1:
dotfiles:
- f_abc_profile1
profile2:
dotfiles:
- f_abc_profile2
by using variables
variables:
basedst: "profile1"
dotfiles:
f_abc:
dst: "~/{{@@ basedst @@}}/common/diff.toml"
src: abc
profiles:
profile1:
dotfiles:
- f_abc
profile2:
dotfiles:
- f_abc
variables:
basedst: "profile2"
by using the profile name directly (when it somehow matches the expected file destination)
dotfiles:
f_abc:
dst: "~/{{@@ profile @@}}/common/diff.toml"
src: abc
profiles:
profile1:
dotfiles:
- f_abc
profile2:
dotfiles:
- f_abc
you could even use exported env variables defined on the host itself (like export MY_DST_FOR_THIS_PROFILE="..."
)
dotfiles:
f_abc:
dst: "~/{{@@ env['MY_DST_FOR_THIS_PROFILE'] @@}}/common/diff.toml"
src: abc
profiles:
profile1:
dotfiles:
- f_abc
profile2:
dotfiles:
- f_abc
or use something defined through a file on the host for example
dynvariables:
basedst: "cat /tmp/somefile | grep basedst= | sed 's/basedst=//g'"
dotfiles:
f_abc:
dst: "~/{{@@ basedst @@}}/common/diff.toml"
src: abc
profiles:
profile1:
dotfiles:
- f_abc
profile2:
dotfiles:
- f_abc
And of course any combinations of the above. It all depends on your exact needs but that definitely enters dotdrop goals.
Dotdrop version (and git commit if run from source): v1.14.0 Using dotdrop: pipx install dotdrop
Describe the bug
DOTDROP_WORKDIR: overwrite the workdir defined in the config
https://github.com/deadc0de6/dotdrop/blob/7ee84a92ecdce09eec4fcafe47330e6788aa1ace/docs/usage.md#L304but DOTDROP_WORKDIR is not checked in file https://github.com/deadc0de6/dotdrop/blob/7ee84a92ecdce09eec4fcafe47330e6788aa1ace/dotdrop/options.py#L28
as of dotdrop v1.14.0 (installed by
pipx install dotdrop
), env-var.DOTDROP_WORKDIR
does not work for commanddotdrop install
Expected behavior
DOTDROP_WORKDIR
used to determine final install locations (in my case, no link, just generate files)Additional information
The relevant part of the config file
(json is valid yaml)