The ssh install and ssh to commands (closes #2)
All checks were successful
check / check (push) Successful in 2m30s

keyfunc ssh install appends the public line on a host through the system ssh, only when absent, feeding the line on standard input; keyfunc ssh to serves the derived key from an in-process agent on a private socket and runs the system ssh with it, the private key never on disk. Two review rounds; the second passed with no findings.

Model: opus-5 (implementation and review); fable-5-1 (landing)
This commit was merged in pull request #8.
This commit is contained in:
2026-09-07 18:49:42 +02:00
parent 5bbeec86d6
commit b9c8631788
7 changed files with 613 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
package cli
import (
"errors"
"fmt"
"os"
@@ -37,14 +38,22 @@ func Root() *cobra.Command {
}
// Main runs the tool and returns the status the process should exit
// with.
// with. An error ends the tool with status 1, except when it carries a
// status of its own, which "ssh to" uses to hand on the status ssh
// ended with. ssh has already said whatever it had to say in that
// case, so nothing more is printed.
func Main() int {
err := Root().Execute()
if err != nil {
fmt.Fprintln(os.Stderr, "keyfunc: "+err.Error())
return 1
if err == nil {
return 0
}
return 0
var passed ssh.StatusError
if errors.As(err, &passed) {
return passed.Status
}
fmt.Fprintln(os.Stderr, "keyfunc: "+err.Error())
return 1
}