mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
chore: delete the obsolete 'machine token' command
This commit is contained in:
@@ -17,7 +17,6 @@ func NewRootCommand() *cobra.Command {
|
||||
NewRenameCommand(),
|
||||
NewRmCommand(),
|
||||
NewUpdateCommand(),
|
||||
NewTokenCommand(),
|
||||
)
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package machine
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/psviderski/uncloud/internal/daemon"
|
||||
"github.com/psviderski/uncloud/internal/machine"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type tokenOptions struct {
|
||||
dataDir string
|
||||
}
|
||||
|
||||
func NewTokenCommand() *cobra.Command {
|
||||
opts := tokenOptions{}
|
||||
cmd := &cobra.Command{
|
||||
Use: "token",
|
||||
Short: "Print the local machine's token for adding it to a cluster.",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
token, err := daemon.MachineToken(opts.dataDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("get machine token: %w", err)
|
||||
}
|
||||
tokenStr, err := token.String()
|
||||
if err != nil {
|
||||
return fmt.Errorf("encode machine token: %w", err)
|
||||
}
|
||||
fmt.Println(tokenStr)
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().StringVarP(&opts.dataDir, "data-dir", "d", machine.DefaultDataDir,
|
||||
"Directory for storing persistent machine state.")
|
||||
_ = cmd.MarkFlagDirname("data-dir")
|
||||
|
||||
return cmd
|
||||
}
|
||||
Reference in New Issue
Block a user