mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-07-30 11:00:29 +08:00
feat(riot): command git
This commit is contained in:
parent
86670306af
commit
ecf652ad7b
12
scripts/riot
12
scripts/riot
@ -269,11 +269,12 @@ remove_hostkey() {
|
||||
# main
|
||||
print_help()
|
||||
{
|
||||
fmt_info "usage: $0 [-Ddhlqt] [--dry-run] [--dev] [--help] [--lite] [--quite] [--trust] [--tmux] [--password] [[-o ssh-option]...] remote [command] [--] [ssh-command-args]"
|
||||
fmt_info "usage: $0 [-Ddhlqt] [--dry-run] [--dev] [--help] [--lite] [--quite] [--trust] [--tmux] [--password] [[-o ssh-option]...] remote [command] [--] [command-args]"
|
||||
cat <<EOF
|
||||
available commands:
|
||||
- ssh [ssh-command-args] (default)
|
||||
- tmux [ssh-command-args] (run ssh in multiple tmux windows)
|
||||
- git [git-command-args] (run git on remote machine)
|
||||
- sshl [local-port:remote-host:]remote-port (ssh -L)
|
||||
- sshd [local-port] (ssh -D)
|
||||
- zssh [ssh-command-args]
|
||||
@ -320,7 +321,7 @@ router() {
|
||||
break
|
||||
;;
|
||||
-* )
|
||||
fmt_fatal "unknown option: $1"
|
||||
fmt_fatal "unknown option: '$1'. if this option is for the remote command, add '--' before."
|
||||
;;
|
||||
* )
|
||||
positional+=("$1")
|
||||
@ -347,6 +348,13 @@ router() {
|
||||
[[ "${positional[1]}" == tmux ]] && USE_TMUX=1
|
||||
run_ssh ssh "${positional[@]:2}"
|
||||
;;
|
||||
git )
|
||||
if printf '%s\0' "${positional[@]:2}" | grep -Fxqz -- '-C'; then
|
||||
run_ssh ssh git "${positional[@]:2}"
|
||||
else
|
||||
run_ssh ssh git -C "$(pwd)" "${positional[@]:2}"
|
||||
fi
|
||||
;;
|
||||
ping|ping4|ping6 )
|
||||
test "${#positional[@]}" -eq 2 || fmt_fatal "ping requires no arguments"
|
||||
run_ping "${positional[1]}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user