* Moved no editor warning to edit function

* Added message in create_sns_root showing SNS's environment was actually initialized
* Changed flag to create SNS's environment from -w to -i
This commit is contained in:
Jon-William Lewis
2016-01-31 21:30:39 -06:00
parent 77c3398c5f
commit ef1469762b
5 changed files with 29 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
function w_conf {
function create_sns_root {
if [ ! -r "$ROOT_DIR" ]; then mkdir -p "$ROOT_DIR"; fi
if [ ! -d "$TMP_DIR" ]; then mkdir -p "$TMP_DIR" ; fi
if [ ! -r "$ROOT_DIR" ]; then mkdir -p "$ROOT_DIR"; WILL_INIT="TRUE"; fi
if [ ! -d "$TMP_DIR" ]; then mkdir -p "$TMP_DIR" ; WILL_INIT="TRUE"; fi
cat > "$CONFIG_FILE" << EOF
@@ -28,4 +28,10 @@ PUBKEY=""
EOF
chmod 600 "$CONFIG_FILE"
if [ "$WILL_INIT" == "TRUE" ]; then
printf "%s %s\n" "Environment initialized in" "$ROOT_DIR"
else
printf "%s\n" "Environment already initialized."
fi
}

View File

@@ -1,5 +1,8 @@
function edit(){
if [ ! -r "$NOTE" ]; then
if [ -z "$EDITOR" ]; then
>&2 echo "Error no editor specified in environment."
exit
elif [ ! -r "$NOTE" ]; then
echo "ERROR: Note cannot be opened for editing."
exit 40;
fi