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

76 lines
1.7 KiB
Text
Executable file

#!/usr/bin/env nuxsh
## Portable *nix environment by tonydamage
##
## status::
## Show status of nux-env installation
@namespace task. {
function :status {
echo nux-env folder: $NUX_ENV_DIR
pushd $NUX_ENV_DIR > /dev/null
git status
popd > /dev/null
}
##
## update::
## pulls latest nux-env from repository.
function :update {
pushd $NUX_ENV_DIR > /dev/null
git stash
git pull -r
git stash pop
popd > /dev/null
}
##
## install::
## Install nux-env recommended binaries if not present
function :install {
echo $NUX_ENV_DIR
:symlink bashrc .bashrc
}
function :symlink source target {
local env=~
target=${env}/${target}
source=${NUX_ENV_DIR}/${source}
real_source=$(realpath $source)
nux.log debug "$target" is symlink to "$real_source"
if [ -e "$target" ] {
nux.log debug "$target" exists
if [ -h "$target" ] {
link_target=$(realpath $target)
if [ "$real_source" = "$link_target" ] {
nux.log debug "$target" is already symlink to $source
return;
}
nux.log debug "$target" is symlink to "$link_target"
}
}
}
##
## fixmes::
## List all fixmes for nux-env
function :fixmes {
fgrep -n FIXME "$NUX_INC_DIR/..bin/"*
find "$NUX_INC_DIR" -iname "*.sh" | xargs fgrep -n FIXME
}
##
## help library:: <inc>
## Displays help for specified nuxs-env library.
function :help.library name {
nux.log debug "Library"
if [ -e "$NUX_INC_DIR/$name.inc.sh" ] {
nux.help.comment $NUX_INC_DIR/$name.inc.sh
elif [ -e "$NUX_INC_DIR/$name.nuxsh.sh" ]; then
nux.help.comment $NUX_INC_DIR/$name.nuxsh.sh
else
nux.fatal "Library not found"
}
}
}