trash-cli-color.sh 632 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. # Colorized trash-cli output
  4. list(){
  5. trash-list |
  6. awk -v BLUE="\033[1;34m" -v YELLOW="\033[0;33m" \
  7. -v RED="\033[1;31m" '{ DATE=$1; TIME=$2; $1=""; $2="";
  8. print YELLOW DATE " " BLUE TIME RED $0 }'
  9. }
  10. # restore(){
  11. # trash-restore |
  12. # awk -v BLUE="\033[1;34m" -v YELLOW="\033[0;33m" \
  13. # -v RED="\033[1;31m" '{ DATE=$2; TIME=$3; $1=""; $2="";
  14. # print YELLOW DATE " " BLUE TIME RED $0 }'
  15. # }
  16. case "$1" in
  17. "ls"|"list"|"") list ;;
  18. # "rest"|"restore") restore ;;
  19. "em"|"empty") trash-empty ;;
  20. *) trash-put "$@" ;;
  21. esac