switch to -u,--user to force a specific user
This commit is contained in:
parent
1cbe1a6c1e
commit
8a7cf0a941
|
@ -5,10 +5,14 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
* Force a user name with `-u,--user` option (default is still `logname(1)`).
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
* `--autosysadmin` is replaced by `--user autosysadmin`
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -47,7 +47,7 @@ Options
|
||||||
--no-evocheck disable evocheck execution
|
--no-evocheck disable evocheck execution
|
||||||
--auto use "auto" mode
|
--auto use "auto" mode
|
||||||
--no-auto use "manual" mode (default)
|
--no-auto use "manual" mode (default)
|
||||||
--autosysadmin author change as autosysadmin
|
-u, --user=USER force USER value (default: logname(1))
|
||||||
-v, --verbose increase verbosity
|
-v, --verbose increase verbosity
|
||||||
-n, --dry-run actions are not executed
|
-n, --dry-run actions are not executed
|
||||||
--help print this message and exit
|
--help print this message and exit
|
||||||
|
@ -127,8 +127,8 @@ get_now() {
|
||||||
}
|
}
|
||||||
|
|
||||||
get_user() {
|
get_user() {
|
||||||
if is_autosysadmin; then
|
if [ -n "${USER}" ]; then
|
||||||
echo autosysadmin
|
echo "${USER}"
|
||||||
else
|
else
|
||||||
logname
|
logname
|
||||||
fi
|
fi
|
||||||
|
@ -193,7 +193,7 @@ print_session_data() {
|
||||||
}
|
}
|
||||||
|
|
||||||
is_autosysadmin() {
|
is_autosysadmin() {
|
||||||
test "${AUTOSYSADMIN}" -eq 1
|
test "${USER}" = "autosysadmin"
|
||||||
}
|
}
|
||||||
|
|
||||||
is_repository_readonly() {
|
is_repository_readonly() {
|
||||||
|
@ -404,7 +404,7 @@ AUTO=${AUTO:-"0"}
|
||||||
EVOCHECK=${EVOCHECK:-"0"}
|
EVOCHECK=${EVOCHECK:-"0"}
|
||||||
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
|
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
|
||||||
API_ENDPOINT=${API_ENDPOINT:-""}
|
API_ENDPOINT=${API_ENDPOINT:-""}
|
||||||
AUTOSYSADMIN=${AUTOSYSADMIN:-0}
|
USER=${USER:-""}
|
||||||
|
|
||||||
# initialize variables
|
# initialize variables
|
||||||
MESSAGE=""
|
MESSAGE=""
|
||||||
|
@ -483,8 +483,29 @@ while :; do
|
||||||
AUTO=1
|
AUTO=1
|
||||||
;;
|
;;
|
||||||
--autosysadmin)
|
--autosysadmin)
|
||||||
|
# Deprecated, backward compatibility
|
||||||
# author change as autosysadmin
|
# author change as autosysadmin
|
||||||
AUTOSYSADMIN=1
|
printf 'WARNING: "--autosysadmin" is deprecated, use "--user autosysadmin".\n' >&2
|
||||||
|
USER="autosysadmin"
|
||||||
|
;;
|
||||||
|
-u|--user)
|
||||||
|
# user options, with value speparated by space
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
USER=$2
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
printf 'ERROR: "--user" requires a non-empty option argument.\n' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--user=?*)
|
||||||
|
# message options, with value speparated by =
|
||||||
|
USER=${1#*=}
|
||||||
|
;;
|
||||||
|
--user=)
|
||||||
|
# message options, without value
|
||||||
|
printf 'ERROR: "--user" requires a non-empty option argument.\n' >&2
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
-n|--dry-run)
|
-n|--dry-run)
|
||||||
# disable actual commands
|
# disable actual commands
|
||||||
|
|
Loading…
Reference in a new issue