create path when parent of file to be written does not exist

+ usage for frappy command
This commit is contained in:
2025-06-26 08:41:22 +02:00
parent 8406a127e6
commit d9ac7c9e71
2 changed files with 6 additions and 1 deletions

View File

@@ -312,6 +312,7 @@ def write_when_new(filename, content, as_root=False, ignore_reduction=False):
return False
if doit:
if lines:
Path(filename).parent.mkdir(parents=True, exist_ok=True)
with tempfile.NamedTemporaryFile('w') as fil:
fil.write(content)
fil.flush()

View File

@@ -10,7 +10,11 @@ pathadd ~/.local/bin
pathadd ~/frappy/bin
frappy() {
systemctl --user $1 frappy
if [[ -z "$1" ]]; then
echo "Usage: frappy status|start|stop|restart"
else
systemctl --user $1 frappy
fi
}
boxweb() {