The ssh install and ssh to commands (closes #2)
All checks were successful
check / check (push) Successful in 2m30s
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user