46 lines
1 KiB
Bash
Executable file
46 lines
1 KiB
Bash
Executable file
#!/bin/bash
|
|
configFile="/etc/fish/conf.d/logo-ls.fish";
|
|
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;
|
|
} | sudo tee "$configFile" > /dev/null;
|
|
|
|
if ! grep "\blogo-ls\b" ~/.bashrc > /dev/null
|
|
then
|
|
{
|
|
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;
|
|
} | tee -a ~/.bashrc > /dev/null;
|
|
fi;
|