add.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #! /usr/bin/env bash
  2. # Copyright (c) Meta Platforms, Inc. and affiliates.
  3. set -e
  4. set -o pipefail
  5. cat << EOF
  6. Release note advice:
  7. * Speak to the RocksDB user and what is impacted in the public API
  8. Formatting with markdown:
  9. * This is an example list item referring to \`BlockBasedTableOptions\`.
  10. If not starting with "* " it will be inserted at release time. This is OK.
  11. *This asterisk begins italics, NOT a list item. PROBABLY WRONG
  12. EOF
  13. if [ "$1" ]; then
  14. echo "Press return to continue"
  15. read
  16. # Target file specified on command line
  17. TARGET="$1"
  18. else
  19. # Interactively choose a group and file name
  20. DIRS="`find unreleased_history/ -mindepth 1 -maxdepth 1 -type d`"
  21. echo "Choose a group for new release note:"
  22. echo "$DIRS" | grep -nEo '[^/]+$'
  23. echo -n "Enter a number: "
  24. while [ ! "$DIRNUM" ]; do read -r DIRNUM; done
  25. DIR="$(echo "$DIRS" | head -n "$DIRNUM" | tail -1)"
  26. echo "Choose a file name for new release note (e.g. improved_whatever.md):"
  27. while [ ! "$FNAME" ]; do read -re FNAME; done
  28. # Replace spaces with underscores
  29. TARGET="$(echo "$DIR/$FNAME" | tr ' ' '_')"
  30. fi
  31. # Edit/create the file
  32. ${EDITOR:-nano} "$TARGET"
  33. # Add to version control (easy to forget!)
  34. git add "$TARGET"