From f32431035576a0cdc5fe7529b95875d63b4e197c Mon Sep 17 00:00:00 2001 From: clsty Date: Thu, 30 Oct 2025 12:33:34 +0800 Subject: [PATCH] Update checkdeps --- sdata/lib/functions.sh | 2 +- sdata/subcmd-checkdeps/options.sh | 31 +++++++++---------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/sdata/lib/functions.sh b/sdata/lib/functions.sh index 472c8f57a..b236b8324 100644 --- a/sdata/lib/functions.sh +++ b/sdata/lib/functions.sh @@ -69,10 +69,10 @@ function pause(){ fi } function remove_bashcomments_emptylines(){ - mkdir -p "$(dirname "$2")" echo "pwd=$(pwd)" echo "input=$1" echo "output=$2" + mkdir -p "$(dirname "$2")" cat "$1" | sed -e 's/#.*//' -e '/^[[:space:]]*$/d' > "$2" } function prevent_sudo_or_root(){ diff --git a/sdata/subcmd-checkdeps/options.sh b/sdata/subcmd-checkdeps/options.sh index 903a9c71d..48d085c88 100644 --- a/sdata/subcmd-checkdeps/options.sh +++ b/sdata/subcmd-checkdeps/options.sh @@ -1,20 +1,19 @@ -# Handle args for subcmd: exp-uninstall +# Handle args for subcmd: checkdeps # shellcheck shell=bash showhelp(){ -echo -e "Syntax: $0 checkdeps [OPTIONS]... +echo -e "Syntax: $0 checkdeps [OPTIONS] ... -Experimental unintallation. +Check whether pkgs listed in exist in AUR or repos of Arch. Options: -h, --help Show this help message - --file A file in plain text containing package names " } # `man getopt` to see more para=$(getopt \ -o h \ - -l help,file: \ + -l help \ -n "$0" -- "$@") [ $? != 0 ] && echo "$0: Error when getopt, please recheck parameters." && exit 1 ##################################################################################### @@ -28,21 +27,9 @@ while true ; do *) shift ;; esac done -##################################################################################### -## getopt Phase 2 -eval set -- "$para" -while true ; do - case "$1" in - ## Ones with parameter - --file) - if [[ -f "$2" ]]; - then echo "Using list file \"$2\".";LIST_FILE_PATH="$2";shift 2 - else echo "Wrong argument for $1.";exit 1 - fi;; - - ## Ending - --) break ;; - *) echo -e "$0: Wrong parameters.";exit 1;; - esac -done +if [[ -f "$1" ]]; then + echo "Using list file \"$1\".";LIST_FILE_PATH="$1";shift 2 +else + echo "Wrong path of list file.";exit 1 +fi