aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-tempassin
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ak-tempassin')
-rwxr-xr-xbin/ak-tempassin35
1 files changed, 27 insertions, 8 deletions
diff --git a/bin/ak-tempassin b/bin/ak-tempassin
index 6831dc2..42042f7 100755
--- a/bin/ak-tempassin
+++ b/bin/ak-tempassin
@@ -1,14 +1,33 @@
#!/bin/bash
-AK_TEMP="$(mktemp -d /tmp/aktmp-XXXXXXX)"
-PROGRAM="$(basename $0)"
+##
+## ak-tempassin: a `mktemp` interface
+##
+## Usage:
+##
+## -h, --help Prints this help message
+##
+## -f, --file Creates a temporary file and output fullpath
+##
+## -d, --dir Makes a temporary directory and returns its
+## fullpath
+##
+fullprogrampath="$(realpath $0)"
+PROGRAM=$(basename $0)
+descriptionString="Temp file/dir creator"
+
+# At least these
source $AK_LIBDIR/_ak_log
+source $AK_LIBDIR/_ak_script
-if [ ! -d "$AK_TEMP" ]
+# Flags to run
+if [ ! -z $1 ]
then
- _ak_log_error "Could not make $AK_TEMP directory to work in"
- echo "Could not make $AK_TEMP directory to work in"
- exit 1
+ case $1 in
+ -h | --help) _ak_usage; exit;;
+ -d | --dir) _ak_make_temp_directory; exit;;
+ -f | --file) _ak_make_temp_file; exit;;
+ * ) _ak_usage;;
+ esac
+else _ak_usage
fi
-_ak_log_info "$AK_TEMP created successfully"
-echo "$AK_TEMP"