diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 450c3e3..c19494c --- a/README.md +++ b/README.md @@ -1,31 +1,19 @@ +---*This project is still under heavy development!*--- Please do not delete this file, as it is used to display help information. # L A C K A D A I S I C A L -A collection of easy-to-understand, easy-to-use scripts, functions and aliases. -Designed to be beginner-friendly but also useful! Contains several tools you 0ccould +A collection of easy-to-understand, easy-to-use scripts, functions and aliases. Designed to be beginner-friendly but also useful! ## Disclaimer -Some aspects of this project were generated by Google Gemini (in particular, -daisy_help and daisy_liist). While we are generally against using LLMs for -code, the added functionality of being able to easily update information for -individual tools is useful and not considered to be vital functionality. +Some aspects of this project were generated by Google Gemini (in particular, daisy_help and daisy_liist). While we are generally against using LLMs for code, the added functionality of being able to get information for individual tools is useful and not considered to be vital functionality. ## How to use -Simply open your shell's RC-file (.bashrc, .zshrc, etc) and include -`source /ld.source`, preferably at the bottom of the file. -We recommend setting your editor before sourcing `lackadaisical`. For instance, -putting `export EDITOR=/usr/bin/nano` near the top of your RC-file. It may -later be overridden by `lackadaisical` itself if you use (or have used) `ched`. +Simply open your shell's RC-file (.bashrc, .zshrc, etc) and include `source /daisy.source`, preferably at the bottom of the file. We recommend setting your editor before sourcing `lackadaisical`. For instance, putting `export EDITOR=/usr/bin/nano` near the top of your RC-file. It may later be overridden by `lackadaisical` itself if you use (or have used) `ched`. -You can also try out the utilities by simply sourcing the file while running -your shell of choice. It will automatically include itself into your `PATH` -variable. +You can also try out the utilities by simply sourcing the file while running your shell of choice. It will automatically include itself into your `PATH` variable. -At first use, `lackadaisical` will provide you with some information. This -information is identical to what can be read in the `Getting Started` section -below. - -Please use `daisy help` to see this message again if you get lost! +At first use, `lackadaisical` will provide you with information via `daisy_help`. This information is identical to what can be read in the `Getting Started` section below. ## Getting started ``` @@ -42,10 +30,6 @@ specifying an env value of; NO_ARCHIVEMOUNT=1. The standard script supports zip, tarballs, and rar archives. We recommend relying on archivemount` if you have it installed. Use "--check" to only check if a file is an archive. It returns 0 if it is, 1 otherwise. - -Usage: cdz - cdz --check -Returns: (with --check) 0 if file is archive, 1 if it is not. ················································································ < squasher > @@ -74,9 +58,6 @@ take the same folder argument: Uses your standard CLI editor to create/modify a file and make it executable. If the executable already exists in path, it will edit that instead. Should you not want this behavior, call the utility with the -n switch. - -Usage: editx - editx -n ················································································ < filewait > @@ -85,9 +66,6 @@ This tool is given a filename of a file that does not exist yet. When the file appears on disk, the tool quits and simply returns the filename. This can be used in personal workflows to stall a longer command that relies on the existence of said file. - -Usage: filewait -Returns: filename specified as argument ················································································ < agenda > @@ -100,21 +78,6 @@ automatically cleans up empty folders. A symbolic link to the base of the folder's tree, ".tree", is created in the root of the specified directly. Can be used for everything you'd like to sort by date. For example; a diary, browser downloads, backups, code. - -There is a switch available: ---view : Lists all entries recursively. For example, if used with a year - like "agenda --view "2026" ", you will get a full - directory listing of all entries in 2026 recursively. - If you specify a month as well, you get all the entries from - said month. You can also select a specific date, but it it does - not exist, you will not get any results. Additionally, you need - to use the date structure YYYY/MM/DD. - Each day will be listed with a full path, allowing you to cd to - them (hint: The ".tree" symlink in your folder also allows you - to browse the tree). - -Usage: agenda - agenda --view ················································································ < own > @@ -129,12 +92,8 @@ This is a wrapper for `ssh`, the meaning of the 'p' is "Plus". Integrates SSHFS support. If both client and host have SSHFS, this wrapper can be used to connect their file systems. For example, if you need to move files from one machine to another, you could do something like this: "sshp -m /:/mnt/pc -m -/home/claire:/home/claire claire@pyon.net". Each "-m" switch indicates a -Docker-style mapping from a local directory to a remote directory. -If privilege escalation is necessary for FS access, you will be asked for a -password. - -Usage: sshp -m : [user@]host [ssh_options] +/home/claire:/home/claire claire@pyon.net" If privilege escalation is necessary +for FS access, you will be asked for a password. ················································································ < shrc > @@ -155,15 +114,10 @@ returns partial matches. It can be used to search for binaries. ················································································ < scriptbox > -························································q························ +················································································ This tool can be used to pack bash scripts into one big megascript, much like how `busybox` works. You can also make symlinks to it to invoke a specific -script. Standard binaries are not supported. - -Usage: -Creating boxed binary: scriptbox -o <-s source files> - <-p include files verbatim> -i INPUT_BINS ... -More information: scriptbox +script. ················································································ < bak/unbak > @@ -220,24 +174,19 @@ Similar to `cdf` but uses tree+peco for the query. An extremely simple utility that functions as a clipboard of sorts. To set the variable, run "clip " or provide data via stdin. To get the variable, simply run clip without any arguments. The variable is stored locally in the -shell as "LD_CLIP". Run with switch "-c" to clear LD_CLIP. - -Usage: clip - clip -c - clip -Returns: Without arguments, the contents of LD_CLIP. +shell as "LD_CLIP". ················································································ < ldrc > ················································································ -Edits ld.source and re-sources it, similarly to shrc. Append "-e" to edit +Edits daisy.source and re-sources it, similarly to shrc. Append "-e" to edit "extra.src", to add custom functions in the lackadaisical namespace. Append "-d" to edit "daisy.command.source". ················································································ < daisy reload > ················································································ -Re-sources ld.source. Essentially `ldrc` without editing. +Re-sources daisy.source. Essentially `ldrc` without editing. ················································································ < grab > @@ -339,7 +288,3 @@ functions provided by `lackadaisical`. ················································································ ``` - -# Future plans -We will keep improving and enhancing the scripts. Possibly, we will add new -utilities. We hope you found LACKADAISICAL useful. diff --git a/agenda b/agenda index 5b9d88c..0ab3fa5 100755 --- a/agenda +++ b/agenda @@ -1,15 +1,39 @@ #!/usr/bin/env bash -# This script is intended to be run via cron. But you can run it manually as -# well +# This script is intended to be run via cron. # It creates a folder structure in home for the current date in the following format: -# //// +# $HOME//// # It also sets up a symlink for the tagged folder. # This symlink will always point to the folder for the current date. # Finally, it removes any folders without data, to prevent clutter. +LD_INTERNAL=1 +. $(dirname $(realpath $0))/daisy.source + +if [[ $1 == '' ]]; then + echo "Usage: $LD_BIN " + echo "Creates a folder within '.daisy' in the current directory containing" + echo "a tree of dates associated with the folder name given by argument." + echo "A symlink is (re-)created at the same time with the same folder name." + echo "For example, if given the folder 'notes', this utility will:" + echo "- Create a folder '/.daisy/notes///'." + echo "- Create a symlink named 'notes' that points to it." + echo "It is recommended to run this via cron." + exit 1 +fi + +dir=$(realpath -s "$1") +parent_dir=$(dirname "$dir") +name=$(basename "$dir") +root_dir="$parent_dir/.daisy/$name" +today_sym="$dir" + +# Present day +read year month day < <(date "+%Y %m %d") +today="$root_dir/$year/$month/$day" + set -e function errorFn @@ -26,70 +50,11 @@ function errorFn # Error handling trap errorFn ERR -# Source LD -LD_INTERNAL=1 -. $(dirname $(realpath $0))/ld.source - -if [[ $1 == '' ]]; then - echo "Usage: $LD_BIN " - echo "Creates a folder within '.daisy' in the current directory containing" - echo "a tree of dates associated with the folder name given by argument." - echo "A symlink is (re-)created at the same time with the same folder name." - echo "For example, if given the folder 'notes', this utility will:" - echo "- Create a folder '/.daisy/notes///'." - echo "- Create a symlink named 'notes' that points to it." - echo "It is recommended to run this via cron." - exit 1 -fi - -view=0 -view_date=0 - -if [[ "$1" == "--view" ]]; then - # We are only going to view the agenda - view_date=$2 - view=1 - shift 2 -fi - -dir=$(realpath -s "$1") -parent_dir=$(dirname "$dir") -name=$(basename "$dir") -root_dir="$parent_dir/.daisy/$name" -today_sym="$dir" - -# Present day -read year month day < <(date "+%Y %m %d") -today="$root_dir/$year/$month/$day" - # First we clear out empty folders, and remove the symlink if it exists -if test -e "$root_dir"; then - find "$root_dir" -name "More..." -delete - find "$root_dir" -depth -maxdepth 3 -type d \ - -not -path "$today" \ - -exec sh -c ' - if [ $(ls -A "$1" | wc -l) -eq 0 ]; then - rm -rf "$1" - fi - ' _ {} \; -fi - -if [[ $view == 1 ]]; then - # View mode - [[ ! -d "$root_dir/$view_date" ]] && echo "This date entry does not exist." && exit 1 - view_date="$root_dir/$view_date" - - # 1. -name "*.squashfs" -prune: If a folder ends in .squashfs, don't descend into it. - # 2. ! -name "*.squashfs": Inside the directory check, ignore squashfs files. - # 3. --ignore="*.squashfs": Tells ls to hide those entries from the final list. - find "$(realpath "$view_date")" -name "*.squashfs" -prune -o -type d -exec sh -c ' - find "$1" -maxdepth 1 -type f ! -name "*.squashfs" | read -r - ' _ {} \; -exec ls --color=always -lah --ignore="*.squashfs" {} + 2>/dev/null - exit 0 -fi +test -e "$root_dir" && find "$root_dir" -maxdepth 3 -type d -empty -delete # Now we can set up today's directory mkdir -p "$today" ln -snf "$today" "$today_sym" -ln -snf "$root_dir" "$dir/More..." +ln -snf "$root_dir" "$dir/.tree" exitcode=$? diff --git a/cdz b/cdz index 275bf77..3b8d15a 100755 --- a/cdz +++ b/cdz @@ -4,20 +4,19 @@ if [[ $LD_INTERNAL -ne 1 ]] then LD_INTERNAL=1 - . $(dirname $(realpath $0))/ld.source + . $(dirname $(realpath $0))/daisy.source fi is_archive() { local file="$1" local mime_type=$(file --mime-type -b "$file") - - if [[ $mime_type == *"tar"* || $file == *.tar* || \ - $mime_type == "application/zip" || $mime_type == "application/x-rar" ]] + + if [[ $mime_type == *"tar"* || $file == *.tar* || $mime_type == "application/zip" || $mime_type == "application/x-rar" ]] then return 0 fi - + if command -v archivemount >/dev/null 2>&1 then local test_dir=$(mktemp -d /tmp/cdz_check.XXXXXXXX) @@ -30,7 +29,7 @@ is_archive() rmdir "$test_dir" return $result fi - + return 1 } diff --git a/daisy.command.source b/daisy.command.source index b825177..144be92 100755 --- a/daisy.command.source +++ b/daisy.command.source @@ -40,20 +40,17 @@ _daisy_enc() fi if [ -n "$1" ] && [ -d "$1" ]; then - printf "daisy_create_folder=%s\n" "$1" + echo -e "daisy_create_folder=$1" else - local file_dir="." + local file_dir="" local file_name="" local perms=755 - local input_source="/dev/stdin" local target=$1 if [[ ! -t 0 ]] && [[ $enc_is_folder == 0 ]]; then - input_source="$1" file_dir="." file_name="$1" elif [ -f "$1" ]; then - input_source="$1" file_dir=$(dirname "$1") file_name=$(basename "$1") perms=$(stat -c %a "$1") @@ -63,10 +60,10 @@ _daisy_enc() fi local base64_inner - base64_inner=$(cat "${input_source:-/dev/stdin}" | base64 | tr -d '\n') - printf "daisy_folder_%s=%s\n" "$file_name" "$file_dir" - printf "daisy_data_base64_%s=\"%s\"\n" "$file_name" "$base64_inner" - printf "daisy_perms_%s=%s\n" "$file_name" "$perms" + base64_inner=$(cat "${1:-/dev/stdin}" | base64 | tr -d '\n') + echo -e "daisy_folder_$file_name=$file_dir" + echo -e "daisy_data_base64_$file_name=\"$base64_inner\"" + echo -e "daisy_perms_$file_name=$perms" fi } @@ -76,15 +73,16 @@ _daisy_dec() echo "$0: No arguments or stdin specified!" return 1 fi - sed -n "s/^daisy_data_base64_.*=\"\(.*\)\"$/\1/p" "${1:-/dev/stdin}" | base64 -d + local data + data=$(cat "${1:-/dev/stdin}" | grep -v "#") + echo -e "$data" | cut -d "=" -f 2- | cut -b 2- | head -c -2 | base64 -d } _daisy_unalias() { local unalias_param="$1" if [[ $unalias_param =~ ^[0-9]+$ ]]; then - unalias_param=$(head -"$unalias_param" "$LD_ALIASFILE" 2>/dev/null | \ - tail -1 | cut -d "=" -f 1 | awk '{print $2}') + unalias_param=$(head -"$unalias_param" "$LD_ALIASFILE" 2>/dev/null | tail -1 | cut -d "=" -f 1 | awk '{print $2}') fi if [[ -z "$unalias_param" ]]; then return @@ -119,49 +117,49 @@ cmd_help() # Match lines defining tools (e.g., "< cdz >" or "< daisy welcome >") $0 ~ /^[[:space:]]*< .* >/ { - printing=0 # Stop printing previous tool + printing=0 # Stop printing previous tool - # Clean the line to get the "signature" - # "< daisy welcome >" becomes "daisy welcome" - sig = $0 - sub(/^[[:space:]]*< /, "", sig) - sub(/ >[[:space:]]*$/, "", sig) + # Clean the line to get the "signature" + # "< daisy welcome >" becomes "daisy welcome" + sig = $0 + sub(/^[[:space:]]*< /, "", sig) + sub(/ >[[:space:]]*$/, "", sig) - # Check for exact match OR match within a slash/space-separated list - split(sig, names, "[ /]") + # Check for exact match OR match within a slash/space-separated list + split(sig, names, "[ /]") - is_match = 0 - if (sig == query) is_match = 1 - else { - for (i in names) - { - if (names[i] == query) - { is_match = 1; break } - } - } + is_match = 0 + if (sig == query) is_match = 1 + else { + for (i in names) + { + if (names[i] == query) + { is_match = 1; break } + } + } - if (is_match) - { - printing=1 - found=1 - print $0 - next - } + if (is_match) + { + printing=1 + found=1 + print $0 + next + } } # Print description lines if we are in a "found" block printing { - # Stop if we hit the start of the NEXT tool - if ($0 ~ /^[[:space:]]*< /) - { printing=0; next } - print + # Stop if we hit the start of the NEXT tool + if ($0 ~ /^[[:space:]]*< /) + { printing=0; next } + print } END { - if (found == 0) - { - print "Tool '"'"'" query "'"'"' not found in README.md." - } + if (found == 0) + { + print "Tool '"'"'" query "'"'"' not found in README.md." + } } ' fi @@ -178,9 +176,9 @@ cmd_list() sed -n '/--- BEGIN OF DAISY HELP ---/,/--- END OF DAISY HELP ---/{//!p;}' "$file" | awk ' /^[[:space:]]*< / { - sub(/^[[:space:]]*< /, ""); - sub(/ >[[:space:]]*$/, ""); - print " " $0 + sub(/^[[:space:]]*< /, ""); + sub(/ >[[:space:]]*$/, ""); + print " " $0 } ' | sort } @@ -222,8 +220,8 @@ cmd_dec() local arg1=$1 local arg2=$2 if [ ! -t 0 ]; then - arg2=$1 - arg1=/dev/stdin + arg2=$1 + arg1=/dev/stdin fi [[ -t 0 ]] && [[ ! -f "$arg1" ]] && echo "daisy dec multi: No input file specified" && exit 1 [[ ! -d "$arg2" ]] && echo "daisy dec multi: No output directory specified" && exit 1 @@ -260,9 +258,9 @@ cmd_alias() local linenum=1 if [[ -f "$LD_ALIASFILE" ]]; then while IFS= read -r line; do - line=$(echo "$line" | sed 's/alias //g') - echo "$linenum: $line" - ((linenum++)) + line=$(echo "$line" | sed 's/alias //g') + echo "$linenum: $line" + ((linenum++)) done < "$LD_ALIASFILE" fi else @@ -323,7 +321,7 @@ cmd_check() check_bin sed "Stream editing" check_bin grep "Pattern matching" check_bin base64 "Data encoding" - check_bin realpath "Path resolution" + check_bin realpath "Path resolution" echo -e "\n--- Enhanced UI & Navigation ---" check_bin fzf "Used by cdf" @@ -400,13 +398,9 @@ daisy () dec) shift; cmd_dec "$@" ;; alias) shift; cmd_alias "$@" ;; unalias) shift; _daisy_unalias "$@" ;; - backup) shift; find "$LD_CONFIG_FOLDER" -name "*.src" -type f | \ - while read -r f; do \ - cp -R "$f" "$f.bak"; \ - echo "Backup made: $f --> $f.bak"; - done ;; + backup) shift; find "$LD_CONFIG_FOLDER" -name "*.src" -type f | while read -r f; do cp -R "$f" "$f.bak"; echo "Backup made: $f --> $f.bak"; done ;; clear) shift; cmd_clear ;; - check) shift; cmd_check ;; + check) shift; cmd_check ;; restore) shift; cmd_restore ;; combine) shift; cmd_combine ;; editor) shift; cmd_editor "$@" ;; diff --git a/ld.source b/daisy.source similarity index 92% rename from ld.source rename to daisy.source index 1882c0c..1b5b165 100755 --- a/ld.source +++ b/daisy.source @@ -5,7 +5,7 @@ # Source this in your RC file or manually to receive some of the simpler # utilities, as well as aliases for `shrc` and `cdf`. Set env variable # FROM_RC to 1 when sourcing this file to get RC-related functionality: -# FROM_RC=1 source /ld.source +# FROM_RC=1 source /daisy.source # This file is also sourced in some of the scripts included within # lackadaisical for common functionality. Some of the shared functionality is @@ -30,7 +30,7 @@ function ld_dbg # Variables for use in other utilities # Find the right argument for our folder arg=$0 -if [[ ! $arg == *ld.source* ]]; +if [[ ! $arg == *daisy.source* ]]; then arg="${BASH_SOURCE[0]}" fi @@ -78,20 +78,17 @@ fi export LD_ALIASFILE="$LD_CONFIG_FOLDER/aliases.src" export LD_EDITORFILE="$LD_CONFIG_FOLDER/editor.src" export LD_ESOURCEFILE="$LD_CONFIG_FOLDER/extra.src" -export LD_SHORTFILE="$LD_CONFIG_FOLDER/short.src" touch $LD_ALIASFILE +touch $LD_EDITORFILE touch $LD_ESOURCEFILE -touch $LD_ESOURCEFILE -touch $LD_SHORTFILE ld_dbg echo "Sourced config contents:" ld_dbg cat $LD_ALIASFILE ld_dbg cat $LD_EDITORFILE ld_dbg cat $LD_ESOURCEFILE -ld_dbg cat $LD_SHORTFILE # Source everything in the config folder -function _ld.source_configs +function _daisy_source_configs { while IFS= read -r -d '' f; do source "$f" @@ -234,7 +231,7 @@ function ched fi editors=("nano" "vim" "nvim" "vi" "emacs" "gedit" "kate" "mousepad" "micro" \ - "code" "subl" "joe" "kwrite" "gnome-text-editor") + "code" "subl" "joe" "kwrite" "gnome-text-editor") # Find which editors are installed available_editors=() @@ -245,12 +242,12 @@ function ched then if [[ $(realpath "$EDITOR") == "$editor_real" ]]; then - available_editors+=("$editor_real" "$editor (current)") + available_editors+=("$editor_real" "$editor (current)") elif [[ $LD_EDITOR == "$editor_real" ]]; then - available_editors+=("$editor_real" "$editor (LD choice)") + available_editors+=("$editor_real" "$editor (LD choice)") else - available_editors+=("$editor_real" "$editor") + available_editors+=("$editor_real" "$editor") fi fi done @@ -267,8 +264,8 @@ function ched # Present all choices choice=$(dialog --output-fd 1 --clear --title "Select Text Editor" \ - --menu "Choose one of the installed text editors:" 15 100 6 \ - "${available_editors[@]}") + --menu "Choose one of the installed text editors:" 15 100 6 \ + "${available_editors[@]}") dialog_ret=$? if [ $dialog_ret -ne 0 ]; @@ -304,12 +301,6 @@ function grab function clip { - if [[ $1 == "-c" ]]; then - echo Clipboard cleared. - LD_CLIP="" - return 0 - fi - data="" if [ ! -t 0 ]; then @@ -351,7 +342,7 @@ _daisy_def_alias help _daisy_def_alias list _daisy_def_alias check -_ld.source_configs +_daisy_source_configs ############################################################################### # check for dependencies @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ diff --git a/editx b/editx index f09eabf..ac031d9 100755 --- a/editx +++ b/editx @@ -3,13 +3,7 @@ # removes the resulting file if it is empty after the editor closes. LD_INTERNAL=1 -. $(dirname $(realpath $0))/ld.source - -use_path=1 -if [[ $1 == "-n" ]]; then - shift - use_path=0 -fi +. $(dirname $(realpath $0))/daisy.source if [[ -z $1 ]]; then @@ -19,7 +13,7 @@ fi if [[ -z "${EDITOR}" ]]; then - # ched is defined in ld.source + # ched is defined in daisy.source ched "EDITOR env variable not set! You will have to set it yourself in the next screen." fi @@ -29,7 +23,7 @@ file_in_path=$(whereis $1 | awk '{print $2}') path_exist=0 [[ -e "$file" ]] && file_exist=1 -[[ $use_path == 1 ]] && [[ -n "$file_in_path" ]] && path_exist=1 +[[ -n "$file_in_path" ]] && path_exist=1 if [[ $path_exist == 1 && $file_exist == 0 ]]; then file=$file_in_path @@ -43,14 +37,14 @@ elif [[ $path_exist == 1 && $file_exist == 1 ]]; then case "$choice" in 1) - file=$file - ;; + file=$file + ;; 2|"") - file="$file_in_path" - ;; + file="$file_in_path" + ;; *) - file="$file_in_path" - ;; + file="$file_in_path" + ;; esac fi fi diff --git a/filewait b/filewait index 8f68340..2705a43 100755 --- a/filewait +++ b/filewait @@ -2,7 +2,7 @@ # A simple utility that waits for a file to become available, infinitely LD_INTERNAL=1 -. $(dirname $(realpath $0))/ld.source +. $(dirname $(realpath $0))/daisy.source file=$@ while [ ! -f "$file" ] diff --git a/own b/own index cc0d581..6db1b49 100755 --- a/own +++ b/own @@ -3,7 +3,7 @@ # user, recursively. LD_INTERNAL=1 -. $(dirname $(realpath $0))/ld.source +. $(dirname $(realpath $0))/daisy.source if [[ -z "$1" ]]; then echo "$LD_BIN: Quickly take ownership of files/folders." diff --git a/scriptbox b/scriptbox index 003bdca..6ddaeb0 100755 --- a/scriptbox +++ b/scriptbox @@ -4,7 +4,7 @@ # said script. The idea is similar to `busybox`. LD_INTERNAL=1 -. $(dirname $(realpath $0))/ld.source +. $(dirname $(realpath $0))/daisy.source args=$@ @@ -16,9 +16,9 @@ function help() echo "call the function like so: 'combi-bin input-bin ." echo "" echo "> Usage:" - echo "Boxing scripts: scriptbox -o <-s source files>" - echo " <-p include files verbatim> -i INPUT_BINS ..." - echo "View help: $LD_BIN " + echo "Creating boxed binary: $LD_BIN -o <-s source files> <-p include files verbatim> -i INPUT_BINS ..." + echo " Unpacking a boxed binary: $LD_BIN -e " + echo "View this screen: $LD_BIN " exit 0 } @@ -63,45 +63,45 @@ while [ $i -lt $# ]; do -i) ((i++)) while [ $i -lt $# ] && [[ ! "${args[$i]}" =~ ^- ]]; do - file="${args[$i]}" - ((i++)) - if [[ -e "$file" ]]; then - inputs+=("$file") - ((b++)) - else - echo "WARNING: Missing input binary: \"$file\"." - echo "Module will NOT be available!" - fi + file="${args[$i]}" + ((i++)) + if [[ -e "$file" ]]; then + inputs+=("$file") + ((b++)) + else + echo "WARNING: Missing input binary: \"$file\"." + echo "Module will NOT be available!" + fi done continue ;; -s) ((i++)) while [ $i -lt $# ] && [[ ! "${args[$i]}" =~ ^- ]]; do - file="${args[$i]}" - ((i++)) - if [[ -e "$file" ]]; then - sources+=("$file") - ((s++)) - else - echo "WARNING: Missing input source: \"$file\"." - echo "File will NOT be sourced!" - fi + file="${args[$i]}" + ((i++)) + if [[ -e "$file" ]]; then + sources+=("$file") + ((s++)) + else + echo "WARNING: Missing input source: \"$file\"." + echo "File will NOT be sourced!" + fi done continue ;; -p) ((i++)) while [ $i -lt $# ] && [[ ! "${args[$i]}" =~ ^- ]]; do - file="${args[$i]}" - ((i++)) - if [[ -e "$file" ]]; then - includes+=("$file") - ((p++)) - else - echo "WARNING: Missing input include: \"$file\"." - echo "File will NOT be included!" - fi + file="${args[$i]}" + ((i++)) + if [[ -e "$file" ]]; then + includes+=("$file") + ((p++)) + else + echo "WARNING: Missing input include: \"$file\"." + echo "File will NOT be included!" + fi done continue ;; diff --git a/squasher b/squasher index a4abc1b..ec9a84d 100755 --- a/squasher +++ b/squasher @@ -147,8 +147,8 @@ case "$COMMAND" in destroy) if [[ ! -f "$DIR/.needs_mount" ]]; then if ! mountpoint -q "$DIR"; then - echo "Error: $DIR is not a SquashFS directory." - exit 1 + echo "Error: $DIR is not a SquashFS directory." + exit 1 fi fi diff --git a/sshp b/sshp index 3d458cf..bc50bb6 100755 --- a/sshp +++ b/sshp @@ -13,18 +13,16 @@ usage() } while [[ $# -gt 0 ]]; do - case "$1" in - -m) - if [[ -z "$2" ]]; then - echo "Error: -m requires argument"; exit 1; - fi - mounts+=("$2") - shift 2 - ;; - *) - ssh_args+=("$1") - shift - ;; + case "$1" in + -m) + if [[ -z "$2" ]]; then echo "Error: -m requires argument"; exit 1; fi + mounts+=("$2") + shift 2 + ;; + *) + ssh_args+=("$1") + shift + ;; esac done @@ -50,9 +48,9 @@ done remote_script=" if ! command -v sshfs >/dev/null 2>&1; then - echo 'WARNING: \"sshfs\" not found on remote host.' + echo 'WARNING: \"sshfs\" not found on remote host.' else - ${mount_logic} + ${mount_logic} fi \${SHELL:-bash}; ${unmount_logic} diff --git a/sw b/sw index d542a11..0971413 100755 --- a/sw +++ b/sw @@ -2,7 +2,7 @@ # It just swaps two files LD_INTERNAL1 -. $(dirname $(realpath $0))/ld.source +. $(dirname $(realpath $0))/daisy.source file1=$1 file2=$2 diff --git a/what b/what index 196c182..707e0ce 100755 --- a/what +++ b/what @@ -24,7 +24,7 @@ # LD_INTERNAL=1 -. $(dirname $(realpath $0))/ld.source +. $(dirname $(realpath $0))/daisy.source all_bins=$(compgen -c | sort -u)