• R/O
  • HTTP
  • SSH
  • HTTPS

wfa: Commit

GitHubのミラーです
https://github.com/Hayao0819/wfa


Commit MetaInfo

Revisión97ea9a06ffdfec394497569c2e876e7747ce0ef4 (tree)
Tiempo2020-12-24 15:24:56
Autorhayao <shun819.mail@gmai...>
Commiterhayao

Log Message

[update] : Use function to check operation

Cambiar Resumen

Diferencia incremental

--- a/wfa
+++ b/wfa
@@ -827,6 +827,16 @@ check_installed_package() {
827827 fi
828828 }
829829
830+# 引数で渡されたオペレーションが指定されている場合のみ正常終了します。
831+check_operation() {
832+ local _operation="${1}"
833+ if [[ "${_operation}" = "${operation}" ]]; then
834+ return 0
835+ else
836+ return 1
837+ fi
838+}
839+
830840 # ~/.cacheに相当するディレクトリを返します
831841 get_cache_dir() {
832842 local _user_config_dir _cache_dir
@@ -1324,7 +1334,8 @@ while :; do
13241334 -s | --search | --recursive)
13251335 case "${1}" in
13261336 --search)
1327- if [[ "${operation}" = "sync" ]]; then
1337+ #if [[ "${operation}" = "sync" ]]; then
1338+ if check_operation "sync"; then
13281339 add_args pacman "--search"
13291340 sync_search=true
13301341 else
@@ -1332,7 +1343,8 @@ while :; do
13321343 fi
13331344 ;;
13341345 --recursive)
1335- if [[ "${operation}" = "remove" ]]; then
1346+ #if [[ "${operation}" = "remove" ]]; then
1347+ if check_operation "rmeove"; then
13361348 add_args pacman "--recursive"
13371349 else
13381350 unavailable_in_this_operation
@@ -1358,14 +1370,16 @@ while :; do
13581370 -u | --sysupgrade | --unneeded)
13591371 case "${1}" in
13601372 --sysupgrade)
1361- if [[ "${operation}" = "sync" ]]; then
1373+ #if [[ "${operation}" = "sync" ]]; then
1374+ if check_operation "sync"; then
13621375 sync_upgrade=true
13631376 else
13641377 unavailable_in_this_operation
13651378 fi
13661379 ;;
13671380 --unneeded)
1368- if [[ "${operation}" = "remove" ]]; then
1381+ #if [[ "${operation}" = "remove" ]]; then
1382+ if check_operation "rmeove"; then
13691383 add_args pacman "--unneeded"
13701384 else
13711385 unavailable_in_this_operation
@@ -1393,14 +1407,16 @@ while :; do
13931407 -c | --clean | --cascade)
13941408 case "${1}" in
13951409 --clean)
1396- if [[ "${operation}" = "sync" ]]; then
1410+ #if [[ "${operation}" = "sync" ]]; then
1411+ if check_operation "sync"; then
13971412 sync_clean_count=$(( sync_clean_count + 1 ))
13981413 else
13991414 unavailable_in_this_operation
14001415 fi
14011416 ;;
14021417 --cascade)
1403- if [[ "${operation}" = "remove" ]]; then
1418+ #if [[ "${operation}" = "remove" ]]; then
1419+ if check_operation "rmeove"; then
14041420 add_args pacman "--cascade"
14051421 else
14061422 unavailable_in_this_operation
Show on old repository browser