mutt-wizard

fork of Luke Smiths mutt-wizard
git clone git://git.jakekoroman.com/mutt-wizard
Log | Files | Refs | README | LICENSE

commit b3974d3191e206ab842ca91b21c47e9b9e88a1bc
parent d48f2818a9234935e24d2494b4c5e5a781335229
Author: Luke Smith <luke@lukesmith.xyz>
Date:   Tue, 16 Apr 2019 11:08:43 -0400

unnecessary sed 1q removed

Diffstat:
Mmw | 25++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/mw b/mw @@ -237,22 +237,22 @@ finalize() { \ printf "Setting default mailboxes for your Inbox, Sent, Drafts and Trash in mutt...\\n" oneline="$(sed -e "s/^\|$/\"/g" "$tmpdir/title_boxes" | tr "\n" " ")" oneline="=$title $delim $oneline" - spoolfile=$(grep -i "$tmpdir/title_boxes" -e inbox | sed -e 's/=/+/g' | sed 1q) - record=$(grep -i "$tmpdir/title_boxes" -e sent | sed -e 's/=/+/g' | sed 1q) - postponed=$(grep -i "$tmpdir/title_boxes" -e draft | sed -e 's/=/+/g' | sed 1q) - trash=$(grep -i "$tmpdir/title_boxes" -e trash | sed -e 's/=/+/g' | sed 1q) + spoolfile=$(grep -i -m 1 "$tmpdir/title_boxes" -e inbox | sed -e 's/=/+/g') + record=$(grep -i -m 1 "$tmpdir/title_boxes" -e sent | sed -e 's/=/+/g') + postponed=$(grep -i -m 1 "$tmpdir/title_boxes" -e draft | sed -e 's/=/+/g') + trash=$(grep -i -m 1 "$tmpdir/title_boxes" -e trash | sed -e 's/=/+/g') sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$muttdir/accounts/$title.muttrc" { echo "set spoolfile = \"$spoolfile\""; echo "set record = \"$record\""; echo "set postponed = \"$postponed\""; echo "set trash = \"$trash\""; } >> "$muttdir/accounts/$title.muttrc" echo mailboxes "$oneline" >> "$muttdir/accounts/$title.muttrc" printf "Setting up your keyboard shortcuts for jumping between mailboxes...\\n" sed -i "/# autogenerated/d" "$muttdir/accounts/$title.muttrc" - grep -i "$tmpdir/title_boxes" -e inbox | sed 1q | formatShortcut i inbox "$title" - grep -i "$tmpdir/title_boxes" -e sent | sed 1q | formatShortcut s sent "$title" - grep -i "$tmpdir/title_boxes" -e draft | sed 1q | formatShortcut d drafts "$title" - grep -i "$tmpdir/title_boxes" -e trash | sed 1q | formatShortcut t trash "$title" - grep -i "$tmpdir/title_boxes" -e spam | sed 1q | formatShortcut S spam "$title" - grep -i "$tmpdir/title_boxes" -e junk | sed 1q | formatShortcut j junk "$title" - grep -i "$tmpdir/title_boxes" -e archive | sed 1q | formatShortcut a archive "$title" + grep -i -m 1 inbox "$tmpdir/title_boxes" | formatShortcut i inbox "$title" + grep -i -m 1 sent "$tmpdir/title_boxes" | formatShortcut s sent "$title" + grep -i -m 1 draft "$tmpdir/title_boxes" | formatShortcut d drafts "$title" + grep -i -m 1 trash "$tmpdir/title_boxes" | formatShortcut t trash "$title" + grep -i -m 1 spam "$tmpdir/title_boxes" | formatShortcut S spam "$title" + grep -i -m 1 junk "$tmpdir/title_boxes" | formatShortcut j junk "$title" + grep -i -m 1 archive "$tmpdir/title_boxes" | formatShortcut a archive "$title" printf "All done.\\n" } @@ -261,8 +261,7 @@ confirm() { printf "Are you \033[31;1mreally\033[0m sure you want to %s?\\n\t" " return 0 ;} -pick() { \ - numbered="$(ls $accdir/*muttrc | sed "s/.*\///;s/\..*//" | nl)" +pick() { numbered="$(ls $accdir/*muttrc | sed "s/.*\///;s/\..*//" | nl)" [ "$(echo "$numbered" | wc -w)" = 0 ] && printf "No accounts to choose from.\\n" && return 1 printf "Select an accounts to %s:\\n" "$1" echo "$numbered"