mirror of
https://github.com/luxfi/cli.git
synced 2026-10-30 17:01:20 +00:00
41 lines
915 B
Go
41 lines
915 B
Go
// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
package blockchaincmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/luxfi/cli/v2/pkg/cobrautils"
|
|
"github.com/luxfi/cli/v2/pkg/utils"
|
|
"github.com/luxfi/cli/v2/pkg/ux"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// lux blockchain vmid
|
|
func vmidCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "vmid [vmName]",
|
|
Short: "Prints the VMID of a VM",
|
|
Long: `The blockchain vmid command prints the virtual machine ID (VMID) for the given Blockchain.`,
|
|
Args: cobrautils.ExactArgs(1),
|
|
RunE: printVMID,
|
|
}
|
|
return cmd
|
|
}
|
|
|
|
func printVMID(_ *cobra.Command, args []string) error {
|
|
chains, err := ValidateSubnetNameAndGetChains(args)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
chain := chains[0]
|
|
vmID, err := utils.VMID(chain)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
ux.Logger.PrintToUser(fmt.Sprintf("VM ID : %s", vmID.String()))
|
|
return nil
|
|
}
|