Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Bunting <6431421+dougbu@users.noreply.github.com>2019-06-13 06:53:17 +0300
committerGitHub <noreply@github.com>2019-06-13 06:53:17 +0300
commit852680f61825679fe6653d8c9d026e5100f70926 (patch)
treec72d969478356734af65eb29700edf20e261afe9 /clean.sh
parent79326220b48df0e4494522f07643ff3637a711d0 (diff)
Add clean.cmd, clean.ps1 and clean.sh (#11154)
- #10463
Diffstat (limited to 'clean.sh')
-rwxr-xr-xclean.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/clean.sh b/clean.sh
new file mode 100755
index 0000000000..e52a56020e
--- /dev/null
+++ b/clean.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+#
+# Functions
+#
+__usage() {
+ echo "Usage: $(basename "${BASH_SOURCE[0]}") <Arguments>
+
+Arguments:
+ <Arguments>... Arguments passed to the 'git' command. Any number of arguments allowed.
+
+Description:
+ This script cleans the repository interactively, leaving downloaded infrastructure untouched.
+ Clean operation is interactive to avoid losing new but unstaged files. Press 'c' then [Enter]
+ to perform the proposed deletions.
+"
+}
+
+git_args=()
+
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ -\?|-h|--help)
+ __usage
+ exit 0
+ ;;
+ *)
+ git_args[${#git_args[*]}]="$1"
+ ;;
+ esac
+ shift
+done
+
+# This incantation avoids unbound variable issues if git_args is empty
+# https://stackoverflow.com/questions/7577052/bash-empty-array-expansion-with-set-u
+git clean -dix -e .dotnet/ -e .tools/ ${git_args[@]+"${git_args[@]}"}