1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

Added configurable options to mark tool

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2020-01-01 12:57:10 +01:00
parent 77c7079784
commit 47c123e947

View file

@ -1,5 +1,4 @@
#!/usr/bin/env nuxr-nuxsh
nux.use nuxfs
MARK_DIR_NAME=.by
@ -34,10 +33,7 @@ MARK_PREFIX=""
}
}
## Manages symlinks in closest mark (**.by**) directory, provides functionality to batch create
## them with relative paths.
##
## #Available tasks:
@namespace mark. {
function :dir item {
if [ -n "$MARK_DIR" ]; then
@ -48,13 +44,22 @@ MARK_PREFIX=""
}
function :mark root item mark {
nuxfs.info "$item" Creating symlink in $(nuxfs.path.display "$root/$mark")
nuxfs.symlink "$item" "$root/$mark"
name=""
if [ -e "$root/.path-names" ]; then
rel_path=$(nuxfs.path.relative "$root/.." "$item");
name=${rel_path//\//-}
nuxfs.info "$item" Creating symlink: $(nuxfs.path.display "$root/$mark/$name")
else
nuxfs.info "$item" Creating symlink in $(nuxfs.path.display "$root/$mark")
fi
nuxfs.symlink "$item" "$root/$mark" "$name"
}
}
## Manages symlinks in closest mark (**.by**) directory, provides functionality to batch create
## them with relative paths.
##
## #Available tasks:
@namespace task. {
## tag:: <task> <task arguments...>