zim_issue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #
  2. # zim_info - easily create an issue template
  3. #
  4. # create our 'pause' function
  5. waiter_func() {
  6. local input_key
  7. read -sk \?"Press [Enter] to continue; anything else to quit." input_key
  8. if [[ ${input_key} == $'\n' ]]; then
  9. print "\r "
  10. return 0
  11. else
  12. return 1
  13. fi
  14. }
  15. # print init dialog
  16. print "Please check the existing issues to make sure you\'re not duplicating a report"
  17. print "https://github.com/zimfw/zimfw/issues"
  18. # if they don't accept, bail
  19. if ! waiter_func; then
  20. return 1
  21. fi
  22. # for convenience, this is our new home
  23. cd ${ZIM_HOME}
  24. # collect sys info
  25. local git_dirty=$(command git status --porcelain 2>/dev/null | tail -n1)
  26. local zim_info=$(zsh tools/zim_info)
  27. print "Environment Info
  28. ----------------
  29. ${zim_info}
  30. Description
  31. -----------
  32. ${user_desc}
  33. Steps to Reproduce
  34. ------------------
  35. ${user_reproduce}
  36. Images or other Information
  37. ---------------------------
  38. "
  39. # if we have a dirty git, report it
  40. if [[ -n ${git_dirty} ]]; then
  41. print "${ZIM_HOME} has a dirty git working tree."
  42. print "here is the diff:"
  43. print '```'
  44. print $(command git diff)
  45. print '```'
  46. fi
  47. print '\n\n'
  48. print 'Please copy the above and use this when reporting the issue\n'
  49. # optionally, now we can produce debug info
  50. print 'If you would like to produce some helpful logs about your environment, run:'
  51. print '$ zmanage debug'