feat(agent,command): add show-thumbprint command
This commit is contained in:
parent
258d0bc158
commit
55db21ad23
@ -14,6 +14,7 @@ func Root() *cli.Command {
|
||||
openwrt.Root(),
|
||||
config.Root(),
|
||||
RunCommand(),
|
||||
ShowThumbprintCommand(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
30
internal/command/agent/show_thumbprint.go
Normal file
30
internal/command/agent/show_thumbprint.go
Normal file
@ -0,0 +1,30 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/command/common"
|
||||
"forge.cadoles.com/Cadoles/emissary/internal/machineid"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func ShowThumbprintCommand() *cli.Command {
|
||||
flags := common.Flags()
|
||||
|
||||
return &cli.Command{
|
||||
Name: "show-thumbprint",
|
||||
Usage: "Show the current agent thumbprint",
|
||||
Flags: flags,
|
||||
Action: func(ctx *cli.Context) error {
|
||||
thumbprint, err := machineid.Get()
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
fmt.Println(thumbprint)
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user