Commit 1f541f429a2f836b2376e20326c6497bf8d151ae

Authored by Shrikant Sharat
1 parent 4098b408dc

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.

Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff

... ... @@ -216,6 +216,11 @@ antigen-cleanup () {
216 216  
217 217 # Cleanup unused repositories.
218 218  
  219 + local force=false
  220 + if [[ $1 == --force ]]; then
  221 + force=true
  222 + fi
  223 +
219 224 if [[ ! -d "$ADOTDIR/repos" || -z "$(ls "$ADOTDIR/repos/")" ]]; then
220 225 echo "You don't have any bundles."
221 226 return 0
... ... @@ -239,8 +244,7 @@ antigen-cleanup () {
239 244 echo "$unused_clones" \
240 245 | sed -e 's/^/ /' -e 's/|/, branch /'
241 246  
242   - echo -n '\nDelete them all? [y/N] '
243   - if read -q; then
  247 + if $force || (echo -n '\nDelete them all? [y/N] '; read -q); then
244 248 echo
245 249 echo
246 250 echo "$unused_clones" | while read line; do