diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-07-21 14:27:48 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-07-21 14:27:48 +0000 |
commit | ff5c4909753d1ad5b6b5f2273b125ad0f07617fd (patch) | |
tree | d8beee46864db970e04138dfe16ae8fa76d08d13 /kiss | |
parent | 986e37ad33c1d421896d3f351e1fd9b113d278fa (diff) | |
download | cpt-ff5c4909753d1ad5b6b5f2273b125ad0f07617fd.tar.gz |
kiss: Filter arguments for install/remove
FossilOrigin-Name: 64f4cea06f5b5e41fb25a7a5105e1c753e060780c5618a4ab6ebf9c87bd65b2b
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 33 |
1 files changed, 31 insertions, 2 deletions
@@ -866,6 +866,18 @@ args() { shift [ "$1" ] || die "'kiss install' requires an argument." root_check + + # Create a list of each package's dependencies. + for pkg; do pkg_depends "$pkg"; done + + # Filter the list, only including explicit packages. + for pkg in $missing_deps; do + case " $* " in + *" $pkg "*) install_pkgs="$install_pkgs $pkg " ;; + esac + done + + set -- $install_pkgs pkg_install "$@" ;; @@ -875,7 +887,24 @@ args() { [ "$1" ] || die "'kiss remove' requires an argument." root_check log "Removing packages..." - for pkg; do pkg_remove "$pkg" check; done + + # Create a list of each package's dependencies. + for pkg; do pkg_depends "$pkg"; done + + # Reverse the list of dependencies filtering out anything + # not explicitly set for removal. + for pkg in $missing_deps; do + case " $* " in + *" $pkg "*) remove_pkgs="$pkg $remove_pkgs" ;; + esac + done + + for pkg in $remove_pkgs; do + pkg_list "$pkg" >/dev/null || + die "[$pkg]: Not installed." + + pkg_remove "$pkg" check + done ;; # List installed packages. @@ -898,7 +927,7 @@ args() { # Print version and exit. v*) - log "kiss 0.5.2" + log "kiss 0.5.3" ;; # Catch all invalid arguments as well as |