function init_store { if [ ! -d "$ROOT_DIR" ]; then mkdir -p "$ROOT_DIR" ; WILL_INIT="TRUE"; fi if [ ! -d "$TMP_DIR" ]; then mkdir -p "$TMP_DIR" ; WILL_INIT="TRUE"; fi if [ ! -d "$NOTES_DIR" ]; then mkdir -p "$NOTES_DIR"; fi if [ ! -r "$CONFIG_FILE" ]; then cat > "$CONFIG_FILE" << EOF # This file contains directives for the Simple Note System. EXT=note # File extension to use (for listing notes) #EDITOR= # Preferred Editor: # If you would like to specify a different editor for # sns to use, you may do so here, otherwise, sns will # use the editor specified in the environment. DATE_FMT="+%D %T" # Date Format: # If you would like to modify the date format, you may # specify one appropriate to the \`date\` command. ENCRYPTION="FALSE" # Main Encryption Toggle: # WARNING: ANY PREVIOUSLY UNENCRYPTED NOTES WILL BE LOST # Change this to TRUE to enable encryption. PUBKEY="" # Public Key # Encryption is done using GPG. You must enter your # public key's identifier here. #VCTL="" # Version Control Program # Set this to the name of your preferred version control # program to use it in SNS. Examples: git, hg, svn EOF chmod 600 "$CONFIG_FILE" printf "%s\n" "- Rewrote Default Configuration" else printf "$RED_COLOR!$RESET_COLOR - %s" "Refusing to overwrite existing config" fi if [ "$WILL_INIT" == "TRUE" ]; then printf "%s\n" "- Environment initialized in $ROOT_DIR" else printf "%s\n" "- Store already initialized." fi }