From caffa48a206a68f15f50361bacd94709fb39d579 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 22 Nov 2018 02:24:19 -0600
Subject: [PATCH] DSK: Update

---
 .dsk     |  2 +-
 .profile | 42 ++++++++++++++++++++++++++++--------------
 2 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/.dsk b/.dsk
index 116ff501..2ba069ed 160000
--- a/.dsk
+++ b/.dsk
@@ -1 +1 @@
-Subproject commit 116ff5018765d157f522d5ae8674185e9152301a
+Subproject commit 2ba069edf111cbaf7a95b66b11d9ac046dec9a5a
diff --git a/.profile b/.profile
index fe322343..e1c644a9 100755
--- a/.profile
+++ b/.profile
@@ -25,10 +25,22 @@
 # If it is not, open a bug report at gitlab.com/rehashedsalt/home and I'll take
 # care of it
 
+# Not finding these sources is none of my concern; they're out of scope
+# shellcheck disable=1091
+# shellcheck disable=1090
+
+# I'm well aware of when functions are defined vs used
+# Those choices are deliberate
+# shellcheck disable=2139
+# shellcheck disable=2016
+
+# Quit being pedantic
+# shellcheck disable=1117
+
 # Environment variables
 # Use Vim if we have it
 export EDITOR="vi"
-which vim > /dev/null 2>&1 && export EDITOR="vim"
+command -v vim > /dev/null 2>&1 && export EDITOR="vim"
 
 # Patch PATH
 desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games:$HOME/.bin:$HOME/.local/bin"
@@ -50,21 +62,21 @@ PATH="$desiredpath:$PATH"
 [ -f "/etc/profile.d/bash_completion.sh" ] && . "/etc/profile.d/bash_completion.sh"
 
 # Grab pip completion, if it exists
-if which pip > /dev/null 2>&1; then
+if command -v pip > /dev/null 2>&1; then
 	case "$(basename "$SHELL")" in
 		*bash)
 			if ! [ -f "$HOME/.pip-completion-bash" ]; then
 				pip completion --bash > "$HOME/.pip-completion-bash"
 				echo ".profile: Created pip completion for bash"
 			fi
-			source "$HOME/.pip-completion-bash"
+			. "$HOME/.pip-completion-bash"
 			;;
 		zsh)
 			if ! [ -f "$HOME/.pip-completion-zsh" ]; then
 				pip completion --zsh > "$HOME/.pip-completion-zsh"
 				echo ".profile: Created pip completion for zsh"
 			fi
-			source "$HOME/.pip-completion-zsh"
+			. "$HOME/.pip-completion-zsh"
 			;;
 		*)
 			;;
@@ -72,20 +84,20 @@ if which pip > /dev/null 2>&1; then
 fi
 
 # If emerge exists, add emerge aliases
-if which emerge > /dev/null 2>&1 ; then
+if command -v emerge > /dev/null 2>&1 ; then
 	alias e-depclean='sudo emerge -a --depclean'
 	alias e-inst='sudo emerge -a --jobs --tree --quiet-build y'
 	alias e-upgrade='sudo emerge -DNUua --jobs --tree --quiet-build y --with-bdeps=y --keep-going --backtrack=1000 @world'
 	alias e-newuse='sudo emerge -Uva --jobs --tree --quiet-build y @world'
 	alias e-search='emerge -s'
 	alias e-sync='sudo emerge --sync'
-	if which eclean > /dev/null 2>&1; then
+	if command -v eclean > /dev/null 2>&1; then
 		alias e-cleanup='sudo eclean -d distfiles && sudo eclean -d packages'
 	fi
 fi
 
 # If we have instantmusic, add aliases for that
-if which instantmusic > /dev/null 2>&1; then
+if command -v instantmusic > /dev/null 2>&1; then
 	alias song='instantmusic -p -s'
 	alias songp='instantmusic -s'
 fi
@@ -105,7 +117,7 @@ if [ -d "$HOME/.dotfiles" ]; then
 fi
 
 # Aliases for common utilities
-if [ "`uname`" = "Linux" ]; then
+if [ "$(uname)" = "Linux" ]; then
 	# Assume we have GNU coreutils
 	lsarguments='--color=auto --group-directories-first'
 	alias l="ls -CF  --file-type $lsarguments"
@@ -135,11 +147,9 @@ alias waitwhat='echo $?'
 
 # Set up a default PS1
 # This *should* work for all terminals. I know it works on ksh
-function _ps1() {
+_ps1() {
 	exitcode="$?"
 	r="\e[0m"
-	fg_blue="\e[34m"
-	fg_cyan="\e[36m"
 	fg_red="\e[31m"
 	fg_green="\e[32m"
 	fg_yellow="\e[33m"
@@ -148,10 +158,10 @@ function _ps1() {
 
 	# Add hostname prefix in SSH sessions
 	if [ "$SSH_CLIENT" ]; then
-		prefix="${fg_bold}${fg_red}`hostname`${r}${fg_red}:"
+		prefix="${fg_bold}${fg_red}$(hostname)${r}${fg_red}:"
 	fi
 	# Append a "restricted" prefix in rbash
-	if [ "$0" == "rbash" ]; then
+	if [ "$0" = "rbash" ]; then
 		prefix="${fg_bold}${fg_grey}rbash${r}:"
 	fi
 	# Change PWD color depending on the shell
@@ -175,11 +185,15 @@ function _ps1() {
 	if ! [ "$exitcode" = "0" ]; then
 		fail="${fg_bold}${fg_red}?"
 	fi
+	# printf is used here less for its C-like arguments and more becasue
+	# POSIX echo doesn't have an option to not print a newline.
+	# Hence this warning is disabled
+	# shellcheck disable=2059
 	printf "[${prefix}${cpwd}${r}]${fail}${r}${fg_green}\$${r} "
 }
 
 if ! [ "$ZSH_NAME" ]; then
 	# I've got a different ZSH theme
-	export PS1='`_ps1`'
+	export PS1='$(_ps1)'
 fi