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
|
||||
|
||||
* Force a user name with `-u,--user` option (default is still `logname(1)`).
|
||||
|
||||
### Changed
|
||||
|
||||
### Deprecated
|
||||
|
||||
* `--autosysadmin` is replaced by `--user autosysadmin`
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -47,7 +47,7 @@ Options
|
|||
--no-evocheck disable evocheck execution
|
||||
--auto use "auto" mode
|
||||
--no-auto use "manual" mode (default)
|
||||
--autosysadmin author change as autosysadmin
|
||||
-u, --user=USER force USER value (default: logname(1))
|
||||
-v, --verbose increase verbosity
|
||||
-n, --dry-run actions are not executed
|
||||
--help print this message and exit
|
||||
|
@ -127,8 +127,8 @@ get_now() {
|
|||
}
|
||||
|
||||
get_user() {
|
||||
if is_autosysadmin; then
|
||||
echo autosysadmin
|
||||
if [ -n "${USER}" ]; then
|
||||
echo "${USER}"
|
||||
else
|
||||
logname
|
||||
fi
|
||||
|
@ -193,7 +193,7 @@ print_session_data() {
|
|||
}
|
||||
|
||||
is_autosysadmin() {
|
||||
test "${AUTOSYSADMIN}" -eq 1
|
||||
test "${USER}" = "autosysadmin"
|
||||
}
|
||||
|
||||
is_repository_readonly() {
|
||||
|
@ -404,7 +404,7 @@ AUTO=${AUTO:-"0"}
|
|||
EVOCHECK=${EVOCHECK:-"0"}
|
||||
GIT_STATUS_MAX_LINES=${GIT_STATUS_MAX_LINES:-20}
|
||||
API_ENDPOINT=${API_ENDPOINT:-""}
|
||||
AUTOSYSADMIN=${AUTOSYSADMIN:-0}
|
||||
USER=${USER:-""}
|
||||
|
||||
# initialize variables
|
||||
MESSAGE=""
|
||||
|
@ -483,8 +483,29 @@ while :; do
|
|||
AUTO=1
|
||||
;;
|
||||
--autosysadmin)
|
||||
# Deprecated, backward compatibility
|
||||
# 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)
|
||||
# disable actual commands
|
||||
|
|
Loading…
Reference in a new issue