about summary refs log tree commit diff stats
path: root/ayu
diff options
context:
space:
mode:
authorAoi Koizumi <novaburst@kalli.st>2022-04-28 09:29:08 -0300
committerAoi Koizumi <novaburst@kalli.st>2022-04-28 09:29:08 -0300
commit27eb27e8380d096f73a697de2e8641db471b3aa9 (patch)
tree1852885b31a9a5c3276e0acba662710e22a95853 /ayu
parent2d528b69bd4bef811f667619a726a8d035d2d149 (diff)
downloadayu-27eb27e8380d096f73a697de2e8641db471b3aa9.tar.gz
Reformatted the whole thing yet again
Diffstat (limited to 'ayu')
-rw-r--r--ayu27
1 files changed, 19 insertions, 8 deletions
diff --git a/ayu b/ayu
index d33db1c..85fa41b 100644
--- a/ayu
+++ b/ayu
@@ -1,16 +1,21 @@
 #!/bin/sh
+
+# Exit on error
 set -e
 
+# Disabling some shellcheck stuff here as I won't really solve it anyway.
 # shellcheck disable=SC2154,SC1091
 
 ayu_dir=${ayu_dir:-$HOME/.ayu}
 ayu_settings=${ayu_settings:-$XDG_CONFIG_HOME/ayu}
 ayu_store=${ayu_store:-$HOME/.ayu-store}
 
+# Check if the above directories exist, otherwise create them
 for dir in "$ayu_dir" "$ayu_settings" "$ayu_store"; do
 	test -d "$dir" || mkdir -p "$dir"
 done
 
+# Same thing for the configuration file
 if ! test -f "$ayu_settings"/config; then
 	cat << EOF > "$ayu_settings"/config
 	#ayu_clipboard=$(wl-copy --primary)
@@ -24,8 +29,11 @@ else
 	. "$ayu_settings"/config
 fi
 
+# Switch directory to the store, else bail out
 cd "$ayu_store" || exit 1
 
+## THEGOODS ##
+
 fn_copy() {
 	fn_view "$2" | "$ayu_clipboard"
 }
@@ -69,13 +77,16 @@ fn_view() {
 		exit
 	fi
 }
+## SDOOGEHT ##
+
+## Command line parsing (I don't get why this has be so difficult for say, Lua)
 case $1 in
--c) fn_copy "$2" ;;
--e) fn_edit "$2" ;;
--l) fn_list ;;
--n) fn_new "$2" ;;
--r) fn_remove_single "$2" ;;
--R) fn_remove_recursive "$2" ;;
--v) fn_view "$2" ;;
-*) fn_usage ;;
+    -c) fn_copy "$2" ;;
+    -e) fn_edit "$2" ;;
+    -l) fn_list ;;
+    -n) fn_new "$2" ;;
+    -r) fn_remove_single "$2" ;;
+    -R) fn_remove_recursive "$2" ;;
+    -v) fn_view "$2" ;;
+    *) fn_usage ;;
 esac