You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
1.0 KiB

  1. #!/bin/sh
  2. echo "Specify account:"
  3. # The account to put the folder in
  4. read -r acc
  5. # get the full path
  6. acc_spec=$(ls ~/.config/mutt/accounts/ | grep "$acc")
  7. echo "Specify folder:"
  8. # Ask for the foldername
  9. read -r folder
  10. # Echo back foldername (for informational purpose)
  11. echo "$folder"
  12. # Create needed directories
  13. mkdir -p ~/.local/share/mail/"$acc"/"$folder"/new
  14. mkdir -p ~/.local/share/mail/"$acc"/"$folder"/tmp
  15. mkdir -p ~/.local/share/mail/"$acc"/"$folder"/cur
  16. # Add the folder to muttrc
  17. sed -i "/^mailboxes/ s/$/ \"="$folder"\"/" ~/.config/mutt/accounts/"$acc_spec"
  18. # Ask if a shortcut is needed
  19. echo "Folder created, do you want to add a shortcut?"
  20. read -r shortcut
  21. # If yes, then ask for the shortcutkey (without prefix)
  22. if [ "$shortcut" = "y" ]
  23. then
  24. echo "Specify Shortcut:"
  25. read -r key
  26. # Add shortcuts to muttrc
  27. cat <<EOF >> ~/.config/mutt/accounts/"$acc_spec"
  28. #
  29. macro index,pager g$key "<change-folder>=$folder<enter>" "go to $folder"
  30. macro index,pager M$key "<save-message>=$folder<enter>" "go to $folder"
  31. EOF
  32. echo "Shortcut created!"
  33. fi