feat(ff-ssh): add host from ssh args with ssh-copy-id
- ff ssh <ssh-args> parses target like ssh, runs ssh-copy-id, then writes ~/.ssh/config.d/<alias>.conf (HostName/User/Port/IdentityFile/ ProxyJump/ProxyCommand); supports --no-copy, add and run subcommands - record IdentityFile whenever -i / -o IdentityFile= is given and pass the same key to ssh-copy-id; omit it otherwise so ssh falls back to default identities - ff ssh re-sources ff-ssh.fish each call, ff reload clears cached dotfile functions so edits take effect - fix broken copy subcommand and ssh-arg parsing caused by --argument-names argv shadowing fish $argv - fix ssh subcommand completion guards; wrap ssh completions for add/run
This commit is contained in:
@@ -14,7 +14,7 @@ function ff
|
||||
"s|Alias for script" \
|
||||
"update|Update dotfile" \
|
||||
"region|Toggle or set CN_REGION (mirror/proxy region)" \
|
||||
"ssh|SSH init (keys + config.d) or copy config to remote" \
|
||||
"ssh|SSH init, copy key + add host config, or copy config to remote" \
|
||||
"dirsize|Show directory sizes (du wrapper)" \
|
||||
"help|Show this help message"
|
||||
|
||||
@@ -28,6 +28,11 @@ function ff
|
||||
|
||||
switch $argv[1]
|
||||
case reload
|
||||
# autoload 会缓存函数定义,先清掉 dotfile 里的函数再重载
|
||||
for __f in ~/.dotfile/fish/functions/*.fish
|
||||
functions -e (basename $__f .fish) 2>/dev/null
|
||||
end
|
||||
set -e __f
|
||||
source ~/.config/fish/config.fish
|
||||
echo "Fish configuration reloaded!"
|
||||
case edit
|
||||
@@ -95,9 +100,8 @@ function ff
|
||||
return 1
|
||||
end
|
||||
case ssh
|
||||
if not functions -q ff_ssh
|
||||
source ~/.dotfile/fish/functions/ff-ssh.fish
|
||||
end
|
||||
# 每次都重新 source,避免 autoload 缓存旧定义
|
||||
source ~/.dotfile/fish/functions/ff-ssh.fish
|
||||
ff_ssh $argv[2..-1]
|
||||
case dirsize
|
||||
set -l script_path ~/.dotfile/script/dirsize.sh
|
||||
|
||||
Reference in New Issue
Block a user