diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-06-24 05:41:52 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-06-24 05:41:52 +0300 |
commit | 55626cf414f947be0ce5c8300f97f99421c2e222 (patch) | |
tree | b9d5cdaf482eeacaf3e253b6c806ff0b2272bc06 /bin/ak-tempassin | |
parent | d14dda9f79215ab44684e0f5a64327a079a6c58f (diff) | |
download | arching-kaos-tools-55626cf414f947be0ce5c8300f97f99421c2e222.tar.gz arching-kaos-tools-55626cf414f947be0ce5c8300f97f99421c2e222.tar.bz2 arching-kaos-tools-55626cf414f947be0ce5c8300f97f99421c2e222.zip |
Reworked tempassin to lib/_ak_script
Diffstat (limited to 'bin/ak-tempassin')
-rwxr-xr-x | bin/ak-tempassin | 35 |
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" |