1# To anyone who isn't an admin (owning repos doesn't make one), ssh2# invite, invites and users are unknown commands: the same output and3# exit status as a command that doesn't exist, nothing done, and not in4# their help.5. "$(dirname "$0")/../lib.sh"6user cat7user bob8repo bob/stuff9export FORGE_BASE_URL=https://forge.test10git config --file "$FORGE_ROOT/.gitconfig" forge.admins cat1112# as user word args...: its output and exit status, with the command's13# first word written as "WORD", to compare with an unknown one's.14as() {15 u=$1 w=$216 shift 217 rc=018 ssh_as "$u" "$w" "$@" >"$T/out.$w" 2>&1 || rc=$?19 printf 'exit %s\n' "$rc" >>"$T/out.$w"20 sed "s/$w/WORD/g" "$T/out.$w"21}22for args in "invite fox --ttl 7d" "invite fox" "invites" "invites rm fox" "users"; do23 set -- $args24 w=$125 shift26 got=$(as bob "$w" "$@")27 want=$(as bob nosuch "$@")28 eq "$got" "$want"29done30eq "$(as bob users)" "fatal: unrecognized command 'WORD'31exit 128"32ok forge user invites33eq "$(output)" "no invites; forge user invite <name> makes one"34ok ssh_as bob help35lacks "$T_LOG" 'admins|invite|users'36# An admin's own unknown command is still unknown.37fails_with "^fatal: unrecognized command 'nosuch'$" ssh_as cat nosuch