* 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

View File

@@ -27,10 +27,7 @@ fi
echo "$PROD_STR, $VER_STR"
if [ -z "$EDITOR" ]; then
>&2 echo "Error no editor specified in environment."
elif [ -n "$ERR_NO_GPG" ]; then
if [ -n "$ERR_NO_GPG" ]; then
>&2 echo " Error: Encryption was specified, but GPG is not installed."
exit 100
elif [ -n "$ERR_NO_KEY" ]; then

View File

@@ -16,7 +16,7 @@ else
elif [ "$ARG" = "-p" ] || [ "$ARG" = "--print" ]; then PRINT="TRUE"
elif [ "$ARG" = "-l" ] || [ "$ARG" = "--list" ]; then LIST="TRUE"
elif [ "$ARG" = "-h" ] || [ "$ARG" == "--help" ]; then help; exit 0
elif [ "$ARG" = "-w" ] || [ "$ARG" == "--wconf" ]; then create_sns_root; exit 0
elif [ "$ARG" = "-i" ] || [ "$ARG" == "--init" ]; then create_sns_root; exit 0
else
if [ -z "$NAME" ] && [ -n "$ARG" ]; then NAME="$ARG"
elif [ -z "$NOTEBOOK" ] && [ -n "$ARG" ]; then NOTEBOOK="$ARG"