diff --git a/mprofile b/mprofile new file mode 100755 index 0000000..ada5f85 --- /dev/null +++ b/mprofile @@ -0,0 +1,15 @@ +#!/bin/sh + +profiles=$(find "$HOME"/.config/mblaze -type f -exec basename "{}" \;) +currentMaildir=$(grep "^Maildir:" "$HOME"/.mblaze/profile | cut -d: -f 2 | sed 's/ //g') + +[ -z "$1" ] && basename "$(grep -w "$currentMaildir" -l -R "$HOME"/.config/mblaze)" && exit 0 +[ "$1" = "-l" ] && printf '%s\n' "$profiles" && exit 0 + +profile="$1" + +if printf '%s\n' "$profiles" | grep -qw "$profile"; then + cp "$HOME"/.config/mblaze/"$profile" "$HOME"/.mblaze/profile +else + printf '%s\n' "This profile doesn't exist" +fi