Finalize minor bug fixes and format for deployment
This commit is contained in:
		@@ -31,7 +31,7 @@ while true; do
 | 
				
			|||||||
    case "${1}" in
 | 
					    case "${1}" in
 | 
				
			||||||
        '-d' | '--dir')
 | 
					        '-d' | '--dir')
 | 
				
			||||||
            template_dir="${2}"
 | 
					            template_dir="${2}"
 | 
				
			||||||
		case "${DIR}" in
 | 
					            case "${template_dir}" in
 | 
				
			||||||
                "")
 | 
					                "")
 | 
				
			||||||
                    exit 1
 | 
					                    exit 1
 | 
				
			||||||
                    ;;
 | 
					                    ;;
 | 
				
			||||||
@@ -44,7 +44,7 @@ while true; do
 | 
				
			|||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
        --dir=*)
 | 
					        --dir=*)
 | 
				
			||||||
            template_dir="${1#*=}"
 | 
					            template_dir="${1#*=}"
 | 
				
			||||||
		case "${DIR}" in
 | 
					            case "${template_dir}" in
 | 
				
			||||||
                "")
 | 
					                "")
 | 
				
			||||||
                    exit 1
 | 
					                    exit 1
 | 
				
			||||||
                    ;;
 | 
					                    ;;
 | 
				
			||||||
@@ -80,7 +80,7 @@ done
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# If no target specified
 | 
					# If no target specified
 | 
				
			||||||
if [[ -z "$1" ]]; then
 | 
					if [[ -z "$1" ]]; then
 | 
				
			||||||
	printf '%s\n' 'Please specify target name'
 | 
					    help
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -90,7 +90,7 @@ if ! [[ -d "$template_dir" ]]; then
 | 
				
			|||||||
    exit 2
 | 
					    exit 2
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
files="$("${fd_opts[@]}" "$DIR")"
 | 
					files="$(fd "${fd_opts[@]}" -- . "$template_dir")"
 | 
				
			||||||
selected_file="$(fzf --select-1 --exit-0 <<< "$files")"
 | 
					selected_file="$(fzf --select-1 --exit-0 <<< "$files")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check if target exists
 | 
					# Check if target exists
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -108,7 +108,7 @@ elif [[ -z $DIR ]]; then
 | 
				
			|||||||
    DIR='.'
 | 
					    DIR='.'
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
files="$(find_files $DIR "${fd_opts[@]}")"
 | 
					files="$(fd "${fd_opts[@]}" -- . $DIR)"
 | 
				
			||||||
selected_file="$(fzf --select-1 --exit-0 <<< "$files")"
 | 
					selected_file="$(fzf --select-1 --exit-0 <<< "$files")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ -w "${selected_file}" ]]; then
 | 
					if [[ -w "${selected_file}" ]]; then
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								bin/quickdel
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								bin/quickdel
									
									
									
									
									
								
							@@ -14,6 +14,7 @@ WHITE_BOLD=$'\e[1;37m'
 | 
				
			|||||||
RESET=$'\e[0;0m'
 | 
					RESET=$'\e[0;0m'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fd_opts=(--hidden --threads "$(nproc)")
 | 
					fd_opts=(--hidden --threads "$(nproc)")
 | 
				
			||||||
 | 
					rm_opts=(--verbose)
 | 
				
			||||||
declare -a typeopts
 | 
					declare -a typeopts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Helper functions
 | 
					# Helper functions
 | 
				
			||||||
@@ -105,7 +106,7 @@ while true; do
 | 
				
			|||||||
                    exit 1
 | 
					                    exit 1
 | 
				
			||||||
                    ;;
 | 
					                    ;;
 | 
				
			||||||
            esac
 | 
					            esac
 | 
				
			||||||
            fd_opts+=('--extension' "$EXT")
 | 
					            fd_opts+=(--extension "$EXT")
 | 
				
			||||||
            shift 2
 | 
					            shift 2
 | 
				
			||||||
            continue
 | 
					            continue
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
@@ -119,7 +120,7 @@ while true; do
 | 
				
			|||||||
                    exit 1
 | 
					                    exit 1
 | 
				
			||||||
                    ;;
 | 
					                    ;;
 | 
				
			||||||
            esac
 | 
					            esac
 | 
				
			||||||
            fd_opts+=('--extension' "$EXT")
 | 
					            fd_opts+=(--extension "$EXT")
 | 
				
			||||||
            shift
 | 
					            shift
 | 
				
			||||||
            continue
 | 
					            continue
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
@@ -129,7 +130,7 @@ while true; do
 | 
				
			|||||||
            continue
 | 
					            continue
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
        '-F' | '--force-directory-delete')
 | 
					        '-F' | '--force-directory-delete')
 | 
				
			||||||
            rm_force='--force'
 | 
					            rm_opts+=(--recursive --force)
 | 
				
			||||||
            shift
 | 
					            shift
 | 
				
			||||||
            continue
 | 
					            continue
 | 
				
			||||||
            ;;
 | 
					            ;;
 | 
				
			||||||
@@ -167,8 +168,10 @@ while true; do
 | 
				
			|||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Interpret options
 | 
					# Interpret options
 | 
				
			||||||
 | 
					# If nothing was entered
 | 
				
			||||||
if [[ -z "$*" ]]; then
 | 
					if [[ -z "$*" ]]; then
 | 
				
			||||||
    help
 | 
					    help
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare -a files pattern_results
 | 
					declare -a files pattern_results
 | 
				
			||||||
@@ -195,7 +198,7 @@ for p in "${paths[@]}"; do
 | 
				
			|||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Padding between files and prompt
 | 
					# Padding between files and prompt
 | 
				
			||||||
#color_output '' reset
 | 
					color_output '' reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
read -r -n 1 -p 'Would you like to delete these files? [y/N]: ' user_response
 | 
					read -r -n 1 -p 'Would you like to delete these files? [y/N]: ' user_response
 | 
				
			||||||
# Padding between prompt and output
 | 
					# Padding between prompt and output
 | 
				
			||||||
@@ -203,10 +206,6 @@ echo ''
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if [[ "$user_response" =~ (y|Y) ]]; then
 | 
					if [[ "$user_response" =~ (y|Y) ]]; then
 | 
				
			||||||
    for p in "${paths[@]}"; do
 | 
					    for p in "${paths[@]}"; do
 | 
				
			||||||
        if [[ -d "$p" ]]; then
 | 
					        rm "${rm_opts[@]}" -- "$p" || printf '%s %s\n' "$(color_output "Unable to remove path:" 'red')" "$(color_path "$p")"
 | 
				
			||||||
            rm --recursive "$rm_force" --verbose -- "$p" || printf '%s %s\n' "$(color_output "Unable to remove path:" 'red')" "$(color_path "$p")"
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
            rm "$rm_force" --verbose -- "$p" || printf '%s %s\n' "$(color_output "Unable to remove path:" 'red')" "$(color_path "$p")"
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    done
 | 
					    done
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user