| 1 | #!/bin/bash |
| 2 | |
| 3 | # Created by argbash-init v2.5.0 |
| 4 | # ARG_POSITIONAL_SINGLE([new-version],[The next openscap version string]) |
| 5 | # ARGBASH_SET_DELIM([ ]) |
| 6 | # ARGBASH_SET_INDENT([ ]) |
| 7 | # ARG_OPTION_STACKING([none]) |
| 8 | # ARG_RESTRICT_VALUES([none]) |
| 9 | # DEFINE_SCRIPT_DIR([]) |
| 10 | # ARG_HELP([Push the release commit and the tag to GitHub, then bump the version numbers and push those too.]) |
| 11 | # ARGBASH_GO() |
| 12 | # needed because of Argbash --> m4_ignore([ |
| 13 | ### START OF CODE GENERATED BY Argbash v2.5.0 one line above ### |
| 14 | # Argbash is a bash code generator used to get arguments parsing right. |
| 15 | # Argbash is FREE SOFTWARE, see https://argbash.io for more info |
| 16 | |
| 17 | die() |
| 18 | { |
| 19 | local _ret=$2 |
| 20 | test -n "$_ret" || _ret=1 |
| 21 | test "$_PRINT_HELP" = yes && print_help >&2 |
| 22 | echo "$1" >&2 |
| 23 | exit ${_ret} |
| 24 | } |
| 25 | |
| 26 | |
| 27 | # THE DEFAULTS INITIALIZATION - POSITIONALS |
| 28 | _positionals=() |
| 29 | # THE DEFAULTS INITIALIZATION - OPTIONALS |
| 30 | |
| 31 | print_help () |
| 32 | { |
| 33 | printf "%s\n" "Push the release commit and the tag to GitHub, then bump the version numbers and push those too." |
| 34 | printf 'Usage: %s [-h|--help] <new-version>\n' "$0" |
| 35 | printf "\t%s\n" "<new-version>: The next openscap version string" |
| 36 | printf "\t%s\n" "-h,--help: Prints help" |
| 37 | echo |
| 38 | echo 'Short options stacking mode is not supported.' |
| 39 | } |
| 40 | |
| 41 | parse_commandline () |
| 42 | { |
| 43 | while test $# -gt 0 |
| 44 | do |
| 45 | _key="$1" |
| 46 | case "$_key" in |
| 47 | -h|--help) |
| 48 | print_help |
| 49 | exit 0 |
| 50 | ;; |
| 51 | *) |
| 52 | _positionals+=("$1") |
| 53 | ;; |
| 54 | esac |
| 55 | shift |
| 56 | done |
| 57 | } |
| 58 | |
| 59 | |
| 60 | handle_passed_args_count () |
| 61 | { |
| 62 | _required_args_string="'new-version'" |
| 63 | test ${#_positionals[@]} -lt 1 && _PRINT_HELP=yes die "FATAL ERROR: Not enough positional arguments - we require exactly 1 (namely: $_required_args_string), but got only ${#_positionals[@]}." 1 |
| 64 | test ${#_positionals[@]} -gt 1 && _PRINT_HELP=yes die "FATAL ERROR: There were spurious positional arguments --- we expect exactly 1 (namely: $_required_args_string), but got ${#_positionals[@]} (the last one was: '${_positionals[*]: -1}')." 1 |
| 65 | } |
| 66 | |
| 67 | assign_positional_args () |
| 68 | { |
| 69 | _positional_names=('_arg_new_version' ) |
| 70 | |
| 71 | for (( ii = 0; ii < ${#_positionals[@]}; ii++)) |
| 72 | do |
| 73 | eval "${_positional_names[ii]}=\${_positionals[ii]}" || die "Error during argument parsing, possibly an Argbash bug." 1 |
| 74 | done |
| 75 | } |
| 76 | |
| 77 | parse_commandline "$@" |
| 78 | handle_passed_args_count |
| 79 | assign_positional_args |
| 80 | |
| 81 | # OTHER STUFF GENERATED BY Argbash |
| 82 | script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || die "Couldn't determine the script's running directory, which probably matters, bailing out" 2 |
| 83 | |
| 84 | ### END OF CODE GENERATED BY Argbash (sortof) ### ]) |
| 85 | # [ <-- needed because of Argbash |
| 86 | |
| 87 | . "$script_dir/release.sh" |
| 88 | |
| 89 | release_to_git_and_bump_release "$_arg_new_version" |
| 90 | |
| 91 | # ] <-- needed because of Argbash |