mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Bashscript update (#4552)
* fix wget command in Readme Fixes https://github.com/inventree/InvenTree/issues/4548 reported by @liuqun * change doc links int markdown * update bash script * Add typing * regenerate script * fix link to contribute * update more links * update bash script * revert changes
This commit is contained in:
parent
c28c991591
commit
478fec4a4b
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# This script was generated by bashly 0.8.9 (https://bashly.dannyb.co)
|
# This script was generated by bashly 0.9.4 (https://bashly.dannyb.co)
|
||||||
# Modifying it manually is not recommended
|
# Modifying it manually is not recommended
|
||||||
|
|
||||||
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
|
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
|
||||||
@ -149,44 +149,44 @@ install.sh_usage() {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "Usage:\n"
|
printf "%s\n" "Usage:"
|
||||||
printf " install.sh [SOURCE] [PUBLISHER] [OPTIONS]\n"
|
printf " install.sh [SOURCE] [PUBLISHER] [OPTIONS]\n"
|
||||||
printf " install.sh --help | -h\n"
|
printf " install.sh --help | -h\n"
|
||||||
printf " install.sh --version | -v\n"
|
printf " install.sh --version | -v\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if [[ -n $long_usage ]]; then
|
if [[ -n $long_usage ]]; then
|
||||||
printf "Options:\n"
|
printf "%s\n" "Options:"
|
||||||
|
|
||||||
echo " --help, -h"
|
printf " %s\n" "--help, -h"
|
||||||
printf " Show this help\n"
|
printf " Show this help\n"
|
||||||
echo
|
echo
|
||||||
echo " --version, -v"
|
printf " %s\n" "--version, -v"
|
||||||
printf " Show version number\n"
|
printf " Show version number\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo " --no-call, -n"
|
printf " %s\n" "--no-call, -n"
|
||||||
printf " Do not call outside APIs (only functionally needed)\n"
|
printf " Do not call outside APIs (only functionally needed)\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo " --dry-run, -d"
|
printf " %s\n" "--dry-run, -d"
|
||||||
printf " Dry run (do not install anything)\n"
|
printf " Dry run (do not install anything)\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
printf "Arguments:\n"
|
printf "%s\n" "Arguments:"
|
||||||
|
|
||||||
echo " SOURCE"
|
printf " %s\n" "SOURCE"
|
||||||
printf " Package source that should be used\n"
|
printf " Package source that should be used\n"
|
||||||
printf " Allowed: stable, master, main\n"
|
printf " Allowed: stable, master, main\n"
|
||||||
printf " Default: stable\n"
|
printf " Default: stable\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
echo " PUBLISHER"
|
printf " %s\n" "PUBLISHER"
|
||||||
printf " Publisher that should be used\n"
|
printf " Publisher that should be used\n"
|
||||||
printf " Default: inventree\n"
|
printf " Default: inventree\n"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
printf "Examples:\n"
|
printf "%s\n" "Examples:"
|
||||||
printf " install\n"
|
printf " install\n"
|
||||||
printf " install master --no-call\n"
|
printf " install master --no-call\n"
|
||||||
printf " install master matmair --dry-run\n"
|
printf " install master matmair --dry-run\n"
|
||||||
@ -208,7 +208,7 @@ normalize_input() {
|
|||||||
input+=("${BASH_REMATCH[2]}")
|
input+=("${BASH_REMATCH[2]}")
|
||||||
elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
||||||
flags="${BASH_REMATCH[1]}"
|
flags="${BASH_REMATCH[1]}"
|
||||||
for (( i=0 ; i < ${#flags} ; i++ )); do
|
for ((i = 0; i < ${#flags}; i++)); do
|
||||||
input+=("-${flags:i:1}")
|
input+=("-${flags:i:1}")
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@ -221,14 +221,14 @@ normalize_input() {
|
|||||||
|
|
||||||
inspect_args() {
|
inspect_args() {
|
||||||
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
||||||
if (( ${#args[@]} )); then
|
if ((${#args[@]})); then
|
||||||
echo args:
|
echo args:
|
||||||
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
||||||
else
|
else
|
||||||
echo args: none
|
echo args: none
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( ${#other_args[@]} )); then
|
if ((${#other_args[@]})); then
|
||||||
echo
|
echo
|
||||||
echo other_args:
|
echo other_args:
|
||||||
echo "- \${other_args[*]} = ${other_args[*]}"
|
echo "- \${other_args[*]} = ${other_args[*]}"
|
||||||
@ -240,19 +240,25 @@ inspect_args() {
|
|||||||
|
|
||||||
parse_requirements() {
|
parse_requirements() {
|
||||||
|
|
||||||
case "${1:-}" in
|
while [[ $# -gt 0 ]]; do
|
||||||
--version | -v )
|
case "${1:-}" in
|
||||||
version_command
|
--version | -v)
|
||||||
exit
|
version_command
|
||||||
;;
|
exit
|
||||||
|
;;
|
||||||
|
|
||||||
--help | -h )
|
--help | -h)
|
||||||
long_usage=yes
|
long_usage=yes
|
||||||
install.sh_usage
|
install.sh_usage
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
action="root"
|
action="root"
|
||||||
|
|
||||||
@ -260,47 +266,47 @@ parse_requirements() {
|
|||||||
key="$1"
|
key="$1"
|
||||||
case "$key" in
|
case "$key" in
|
||||||
|
|
||||||
--no-call | -n )
|
--no-call | -n)
|
||||||
|
|
||||||
args[--no-call]=1
|
args['--no-call']=1
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
--dry-run | -d )
|
|
||||||
|
|
||||||
args[--dry-run]=1
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-?* )
|
|
||||||
printf "invalid option: %s\n" "$key" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
|
|
||||||
* )
|
|
||||||
|
|
||||||
if [[ -z ${args[source]+x} ]]; then
|
|
||||||
|
|
||||||
args[source]=$1
|
|
||||||
shift
|
shift
|
||||||
elif [[ -z ${args[publisher]+x} ]]; then
|
;;
|
||||||
|
|
||||||
args[publisher]=$1
|
--dry-run | -d)
|
||||||
|
|
||||||
|
args['--dry-run']=1
|
||||||
shift
|
shift
|
||||||
else
|
;;
|
||||||
printf "invalid argument: %s\n" "$key" >&2
|
|
||||||
|
-?*)
|
||||||
|
printf "invalid option: %s\n" "$key" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
;;
|
||||||
|
|
||||||
;;
|
*)
|
||||||
|
|
||||||
|
if [[ -z ${args['source']+x} ]]; then
|
||||||
|
|
||||||
|
args['source']=$1
|
||||||
|
shift
|
||||||
|
elif [[ -z ${args['publisher']+x} ]]; then
|
||||||
|
|
||||||
|
args['publisher']=$1
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
printf "invalid argument: %s\n" "$key" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ -n ${args[source]:-} ]] || args[source]="stable"
|
[[ -n ${args['source']:-} ]] || args['source']="stable"
|
||||||
[[ -n ${args[publisher]:-} ]] || args[publisher]="inventree"
|
[[ -n ${args['publisher']:-} ]] || args['publisher']="inventree"
|
||||||
|
|
||||||
if [[ ! ${args[source]} =~ ^(stable|master|main)$ ]]; then
|
if [[ ! ${args['source']} =~ ^(stable|master|main)$ ]]; then
|
||||||
printf "%s\n" "source must be one of: stable, master, main" >&2
|
printf "%s\n" "source must be one of: stable, master, main" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -322,9 +328,12 @@ run() {
|
|||||||
normalize_input "$@"
|
normalize_input "$@"
|
||||||
parse_requirements "${input[@]}"
|
parse_requirements "${input[@]}"
|
||||||
|
|
||||||
if [[ $action == "root" ]]; then
|
case "$action" in
|
||||||
root_command
|
"root")
|
||||||
fi
|
root_command
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize
|
initialize
|
||||||
|
Loading…
Reference in New Issue
Block a user