PortValhalla/scripts/Common/Config/logo-ls/install.sh

48 lines
1,000 B
Bash
Executable file

#!/bin/bash
pushd "${BASH_SOURCE%/*}" > /dev/null;
. "../bash/profile.sh";
. "../fish/profile.sh";
functionName="_PortValhalla_ls_";
function dump_header() {
echo "# logo-ls";
}
function dump_aliases() {
echo "alias ls='$functionName'";
echo "alias ll='ls -al'";
echo "alias l='ls'";
}
{
dump_header;
echo "function $functionName";
echo " if [ -t 1 ]";
echo ' logo-ls -D $argv;';
echo " else";
echo " alias ls=ls;";
echo ' ls --color=auto $argv;';
echo " alias ls='$functionName';";
echo " end";
echo "end";
echo "";
dump_aliases;
} | addFishProfile "logo-ls";
{
echo "";
dump_header;
echo "function ${functionName}() {";
echo " if [ -t 1 ]";
echo " then";
echo ' logo-ls -D "$@";';
echo " else";
echo ' ls --color=auto "$@";'
echo " fi;"
echo "}";
echo "";
dump_aliases;
} | addBashProfile "logo-ls";
popd > /dev/null;