Style improvements #3
                
     Open
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
(based on #2, on the presumption that that is sufficiently uncontroversial that this'll save rebase time)
In implementing #2, I found multiple corners for improvement. Not all of this is necessary, of course.
Basic shellcheck improvements
Dead code elimination, quoting
Finish shellcheck corrections
Use traps to clean up temp files, use mktemp
This is less error-prone than trying to remember to do so on all exit paths. Use mktemp to avoid collisions and enable the sysadmins to configure where to put temp files.
Use symbolic escapes instead of codepoints
I find them clearer
Use semantic markup, avoid echo
echo's escape expansion is non-portable, usingprintfdirectly is preferable here. Or heredocs, as can be seen in some of the lengthier cases.See too: https://www.shellcheck.net/wiki/SC2028
Use explicit error codes to distinguish fail modes
This makes it easier for users to figure out what went wrong, plus adds documentation
Make the prompts retry until correct input
Also solidify them by using select loops where possible (which restricts the valid inputs)
Use jq more extensively for output massaging
Extract jq rendering code to use throughout
These two I'm particularly proud of -- they simplify the comment selection code immensely.
Matters of taste
These are absolutely understandable if you reject, and just represent my personal preferences here
Closes: #2