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
|
||||
# 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
|
||||
|
||||
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
|
||||
@ -149,44 +149,44 @@ install.sh_usage() {
|
||||
|
||||
fi
|
||||
|
||||
printf "Usage:\n"
|
||||
printf "%s\n" "Usage:"
|
||||
printf " install.sh [SOURCE] [PUBLISHER] [OPTIONS]\n"
|
||||
printf " install.sh --help | -h\n"
|
||||
printf " install.sh --version | -v\n"
|
||||
echo
|
||||
|
||||
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"
|
||||
echo
|
||||
echo " --version, -v"
|
||||
printf " %s\n" "--version, -v"
|
||||
printf " Show version number\n"
|
||||
echo
|
||||
|
||||
echo " --no-call, -n"
|
||||
printf " %s\n" "--no-call, -n"
|
||||
printf " Do not call outside APIs (only functionally needed)\n"
|
||||
echo
|
||||
|
||||
echo " --dry-run, -d"
|
||||
printf " %s\n" "--dry-run, -d"
|
||||
printf " Dry run (do not install anything)\n"
|
||||
echo
|
||||
|
||||
printf "Arguments:\n"
|
||||
printf "%s\n" "Arguments:"
|
||||
|
||||
echo " SOURCE"
|
||||
printf " %s\n" "SOURCE"
|
||||
printf " Package source that should be used\n"
|
||||
printf " Allowed: stable, master, main\n"
|
||||
printf " Default: stable\n"
|
||||
echo
|
||||
|
||||
echo " PUBLISHER"
|
||||
printf " %s\n" "PUBLISHER"
|
||||
printf " Publisher that should be used\n"
|
||||
printf " Default: inventree\n"
|
||||
echo
|
||||
|
||||
printf "Examples:\n"
|
||||
printf "%s\n" "Examples:"
|
||||
printf " install\n"
|
||||
printf " install master --no-call\n"
|
||||
printf " install master matmair --dry-run\n"
|
||||
@ -208,7 +208,7 @@ normalize_input() {
|
||||
input+=("${BASH_REMATCH[2]}")
|
||||
elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
|
||||
flags="${BASH_REMATCH[1]}"
|
||||
for (( i=0 ; i < ${#flags} ; i++ )); do
|
||||
for ((i = 0; i < ${#flags}; i++)); do
|
||||
input+=("-${flags:i:1}")
|
||||
done
|
||||
else
|
||||
@ -221,14 +221,14 @@ normalize_input() {
|
||||
|
||||
inspect_args() {
|
||||
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
||||
if (( ${#args[@]} )); then
|
||||
if ((${#args[@]})); then
|
||||
echo args:
|
||||
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
||||
else
|
||||
echo args: none
|
||||
fi
|
||||
|
||||
if (( ${#other_args[@]} )); then
|
||||
if ((${#other_args[@]})); then
|
||||
echo
|
||||
echo other_args:
|
||||
echo "- \${other_args[*]} = ${other_args[*]}"
|
||||
@ -240,19 +240,25 @@ inspect_args() {
|
||||
|
||||
parse_requirements() {
|
||||
|
||||
case "${1:-}" in
|
||||
--version | -v )
|
||||
version_command
|
||||
exit
|
||||
;;
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "${1:-}" in
|
||||
--version | -v)
|
||||
version_command
|
||||
exit
|
||||
;;
|
||||
|
||||
--help | -h )
|
||||
long_usage=yes
|
||||
install.sh_usage
|
||||
exit
|
||||
;;
|
||||
--help | -h)
|
||||
long_usage=yes
|
||||
install.sh_usage
|
||||
exit
|
||||
;;
|
||||
|
||||
esac
|
||||
*)
|
||||
break
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
action="root"
|
||||
|
||||
@ -260,47 +266,47 @@ parse_requirements() {
|
||||
key="$1"
|
||||
case "$key" in
|
||||
|
||||
--no-call | -n )
|
||||
--no-call | -n)
|
||||
|
||||
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
|
||||
args['--no-call']=1
|
||||
shift
|
||||
elif [[ -z ${args[publisher]+x} ]]; then
|
||||
;;
|
||||
|
||||
args[publisher]=$1
|
||||
--dry-run | -d)
|
||||
|
||||
args['--dry-run']=1
|
||||
shift
|
||||
else
|
||||
printf "invalid argument: %s\n" "$key" >&2
|
||||
;;
|
||||
|
||||
-?*)
|
||||
printf "invalid option: %s\n" "$key" >&2
|
||||
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
|
||||
done
|
||||
|
||||
[[ -n ${args[source]:-} ]] || args[source]="stable"
|
||||
[[ -n ${args[publisher]:-} ]] || args[publisher]="inventree"
|
||||
[[ -n ${args['source']:-} ]] || args['source']="stable"
|
||||
[[ -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
|
||||
exit 1
|
||||
fi
|
||||
@ -322,9 +328,12 @@ run() {
|
||||
normalize_input "$@"
|
||||
parse_requirements "${input[@]}"
|
||||
|
||||
if [[ $action == "root" ]]; then
|
||||
root_command
|
||||
fi
|
||||
case "$action" in
|
||||
"root")
|
||||
root_command
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
|
||||
initialize
|
||||
|
Loading…
Reference in New Issue
Block a user