From 1f541f429a2f836b2376e20326c6497bf8d151ae Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Date: Wed, 18 Jul 2012 16:51:29 +0530 Subject: [PATCH] Add --force argument to -cleanup. The force argument makes the `-cleanup` command behave in a non-interactive fashion, by deleting the unused clones without asking for a confirmation. --- antigen.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/antigen.zsh b/antigen.zsh index 4d7bd8d..a8efdc9 100644 --- a/antigen.zsh +++ b/antigen.zsh @@ -216,6 +216,11 @@ antigen-cleanup () { # Cleanup unused repositories. + local force=false + if [[ $1 == --force ]]; then + force=true + fi + if [[ ! -d "$ADOTDIR/repos" || -z "$(ls "$ADOTDIR/repos/")" ]]; then echo "You don't have any bundles." return 0 @@ -239,8 +244,7 @@ antigen-cleanup () { echo "$unused_clones" \ | sed -e 's/^/ /' -e 's/|/, branch /' - echo -n '\nDelete them all? [y/N] ' - if read -q; then + if $force || (echo -n '\nDelete them all? [y/N] '; read -q); then echo echo echo "$unused_clones" | while read line; do -- 2.0.0