|
1 |
| -#!/bin/bash |
2 |
| -# Written by Nishant Srivastava |
| 1 | +#!/usr/bin/env bash |
3 | 2 |
|
| 3 | +# Copyright 2018 Nishant Srivastava |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# ______________________________________________________________________ |
| 17 | +# Dependency: trash cli tool |
| 18 | +# >> Install: brew install trash |
| 19 | +# |
4 | 20 | # Call as
|
5 | 21 | # ./delete_build_folder.sh
|
| 22 | +# ______________________________________________________________________ |
6 | 23 |
|
7 |
| -# Install trash cli |
8 |
| -# brew install trash |
9 |
| - |
10 |
| -echo "# Deleting build directories..." |
| 24 | +echo " 🗑 Deleting build directories..." |
11 | 25 |
|
12 | 26 | # Iterate over each sub-directory inside the current directory
|
13 | 27 | for DIR in ./*;
|
14 | 28 | do
|
15 | 29 | # Check if build directory exists inside the $DIR directory
|
16 |
| - # If it does then it is a Flutter project |
17 |
| - if [ -d "$DIR/build/" ]; then |
18 |
| - # Update the packages in the project |
19 |
| - echo "" |
20 |
| - echo ">>>> Deleting build directory inside " "$DIR" |
21 |
| - # Run command inside the sub-directory i.e Flutter project |
22 |
| - (cd "$DIR" && trash build); |
23 |
| - echo "" |
24 |
| - echo ">>>> Done." |
| 30 | + BUILD_DIR="$DIR/build/" |
| 31 | + if [ -d $BUILD_DIR ]; then |
| 32 | + echo " > Deleting build directory inside " "$DIR" |
| 33 | + # Run the trash command on build directory |
| 34 | + trash $BUILD_DIR |
25 | 35 | fi
|
26 | 36 | done
|
| 37 | + |
| 38 | +echo " ✔️ Done." |
0 commit comments