|
1 |
| -#!/usr/bin/env bash |
| 1 | +#!/usr/bin/env sh |
2 | 2 |
|
3 |
| -# ARG_OPTIONAL_SINGLE([from-reference],[],[],[origin/HEAD]) |
4 |
| -# ARGBASH_GO() |
5 |
| -# needed because of Argbash --> m4_ignore([ |
6 |
| -### START OF CODE GENERATED BY Argbash v2.9.0 one line above ### |
7 |
| -# Argbash is a bash code generator used to get arguments parsing right. |
8 |
| -# Argbash is FREE SOFTWARE, see https://argbash.io for more info |
9 |
| -# Generated online by https://argbash.io/generate |
10 |
| - |
11 |
| -die() { |
12 |
| - local _ret="${2:-1}" |
13 |
| - test "${_PRINT_HELP:-no}" = yes && print_help >&2 |
14 |
| - echo "$1" >&2 |
15 |
| - exit "${_ret}" |
16 |
| -} |
17 |
| - |
18 |
| -begins_with_short_option() { |
19 |
| - local first_option all_short_options='' |
20 |
| - first_option="${1:0:1}" |
21 |
| - test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0 |
22 |
| -} |
23 |
| - |
24 |
| -# THE DEFAULTS INITIALIZATION - OPTIONALS |
25 |
| -_arg_from_reference="origin/HEAD" |
26 |
| - |
27 |
| -print_help() { |
28 |
| - printf 'Usage: %s [--from-reference <arg>]\n' "$0" |
29 |
| -} |
30 |
| - |
31 |
| -parse_commandline() { |
32 |
| - while test $# -gt 0; do |
33 |
| - _key="$1" |
34 |
| - case "$_key" in |
35 |
| - --from-reference) |
36 |
| - test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1 |
37 |
| - _arg_from_reference="$2" |
38 |
| - shift |
39 |
| - ;; |
40 |
| - --from-reference=*) |
41 |
| - _arg_from_reference="${_key##--from-reference=}" |
42 |
| - ;; |
43 |
| - *) |
44 |
| - _PRINT_HELP=yes die "FATAL ERROR: Got an unexpected argument '$1'" 1 |
45 |
| - ;; |
46 |
| - esac |
47 |
| - shift |
48 |
| - done |
49 |
| -} |
50 |
| - |
51 |
| -parse_commandline "$@" |
52 |
| - |
53 |
| -# OTHER STUFF GENERATED BY Argbash |
54 |
| - |
55 |
| -### END OF CODE GENERATED BY Argbash (sortof) ### ]) |
56 |
| -# [ <-- needed because of Argbash |
57 | 3 | set -o errexit
|
58 | 4 | set -o xtrace
|
59 | 5 |
|
60 |
| -clean_git_history --from-reference "${_arg_from_reference}" |
61 |
| -# ] <-- needed because of Argbash |
| 6 | +if [ $# -ne 1 ]; then |
| 7 | + echo "Usage: $0 <from>" |
| 8 | + exit 1 |
| 9 | +fi |
| 10 | + |
| 11 | +clean_git_history "$1" |
0 commit comments