Commit 9dd10834e9480196b3fc0be1cd595a3ced7a4f6d

Authored by Shrikant Sharat
1 parent d91893a12a

Fix cleanup giving an error on no bundles.

Where there are no bundles, or the bundle directory does not exist, the
`bundle-cleanup` command gives out an error. This fix is to make it give a saner
message instead.

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

... ... @@ -136,6 +136,12 @@ bundle-install! () {
136 136  
137 137 bundle-cleanup () {
138 138  
  139 + if [[ ! -d "$ANTIGEN_BUNDLE_DIR" || \
  140 + "$(ls "$ANTIGEN_BUNDLE_DIR/" | wc -l)" == 0 ]]; then
  141 + echo "You don't have any bundles."
  142 + return 0
  143 + fi
  144 +
139 145 # Find directores in ANTIGEN_BUNDLE_DIR, that are not in the bundles record.
140 146 local unidentified_bundles="$(comm -13 \
141 147 <(echo-non-empty "$bundles" | awk '{print $1}' | sort) \