unalias -a
+HELPSTRING="""\
+
+
+ \e[37;45;1mxdg-ninja\e[0m
+
+ \e[1;3mCheck your \$HOME for unwanted files.\e[1;0m
+
+ ────────────────────────────────────
+
+ \e[3m--help\e[0m \e[1mThis help menu\e[0m
+ \e[3m-h\e[0m
+
+ \e[3m--no-skip-ok\e[0m \e[1mDisplay messages for all files checked (verbose)\e[0m
+ \e[3m-v\e[0m
+
+ \e[3m--skip-ok\e[0m \e[1mDon't display anything for files that do not exist (default)\e[0m
+
+"""
+
+SKIP_OK=true
+for i in "$@" ; do
+ if [[ $i == "--help" ]] || [[ $i == "-h" ]] ; then
+ echo -e "$HELPSTRING"
+ exit
+ elif [[ $i == "--skip-ok" ]] ; then
+ SKIP_OK=true
+ elif [[ $i == "--no-skip-ok" ]] ; then
+ SKIP_OK=false
+ elif [[ $i == "-v" ]] ; then
+ SKIP_OK=false
+ fi
+done
+
+if ! command -v jq &> /dev/null
+then
+ echo "jq is needed to run this script, but it wasn't found. Please install it to be able to use this script."
+ exit
+fi
+
ERR=0
WARN=1
INFO=2
;;
SUCS)
- printf "[\e[1;32m$NAME\e[1;0m]: \e[1;3m$FILENAME\e[1;0m\n"
+ if [ "$SKIP_OK" = false ]; then
+ printf "[\e[1;32m$NAME\e[1;0m]: \e[1;3m$FILENAME\e[1;0m\n"
+ fi
;;
HELP)
INPUT=$1
NAME=$(echo "$INPUT" | jq -r .name)
-
while IFS= read -r file; do
# Loops over all files in the programs/ directory and calls check_program
enumerate_programs() {
- for prog_filename in "./programs/*"; do
+ echo -e "\e[1;3mStarting to check your \e[1;36m\$HOME.\e[1;0m"
+ echo -e ""
+ for prog_filename in ./programs/*; do
check_program "$(cat $prog_filename)"
done
+ echo -e "\e[1;3mDone checking your \e[1;36m\$HOME.\e[1;0m"
+ echo -e ""
+ echo -e "\e[3mIf you have files in your \e[1;36m\$HOME\e[1;0m that shouldn't be there, but weren't recognised by xdg-ninja, please consider creating a configuration file for it and opening a pull request on github.\e[1;0m"
+ echo -e ""
}
enumerate_programs