aspiers/stow

Allow auto-creating missing parent directories when using `--target`

Open

#124 geöffnet am 20. Jan. 2025

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Perl (51 Forks)batch import
UXeasyenhancementhelp wanted

Repository-Metriken

Stars
 (1.013 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Currently pointing --target to a directory that doesn't yet exist results in the error:

stow: --target value '<path>' is not a valid directory

I understand why this is happening, but it makes using stow to manage certain use-cases (like installing into ~/.config on a fresh system) require an extra mkdir step first.

It would be really nice if running stow with a --target directory would automatically mkdir -p that target if it does not exist. Or if it can't be made the default, then I'd at least like a CLI option to enable this behavior.


As an example, say that we have the following folder structure:

.
└── stow-root
    └── pkg1
        └── some-file

I would like to be able to run just stow pkg1 --dir stow-root --target stow-target and generate the following tree:

.
├── stow-root
│   └── pkg1
│       └── some-file
└── stow-target
    └── some-file -> ../stow-root/pkg1/some-file

Note that the target directory ./stow-target was created when it previously did not exist.

Contributor Guide