github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/wsctl/cmd/root.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  
     6  	"github.com/machinefi/w3bstream/pkg/wsctl/client"
     7  	cfgcmd "github.com/machinefi/w3bstream/pkg/wsctl/cmd/config"
     8  	"github.com/machinefi/w3bstream/pkg/wsctl/cmd/instance"
     9  	"github.com/machinefi/w3bstream/pkg/wsctl/cmd/project"
    10  	"github.com/machinefi/w3bstream/pkg/wsctl/config"
    11  )
    12  
    13  // Multi-language support
    14  var (
    15  	_wsctlRootCmdShorts = map[config.Language]string{
    16  		config.English: "Command-line interface for Machinefi W3bstream",
    17  		config.Chinese: "Machinefi W3bstream 命令行工具",
    18  	}
    19  	_wsctlRootCmdLongs = map[config.Language]string{
    20  		config.English: `wsctl is a command-line interface for interacting with Machinefi W3bstream`,
    21  		config.Chinese: `wsctl 是用于与 Machinefi W3bstream 进行交互的命令行工具`,
    22  	}
    23  )
    24  
    25  // NewWsctl returns wsctl root cmd
    26  func NewWsctl(client client.Client) *cobra.Command {
    27  	rootCmd := &cobra.Command{
    28  		Use:   "wsctl",
    29  		Short: client.SelectTranslation(_wsctlRootCmdShorts),
    30  		Long:  client.SelectTranslation(_wsctlRootCmdLongs),
    31  	}
    32  
    33  	rootCmd.AddCommand(cfgcmd.NewConfigCmd(client))
    34  	rootCmd.AddCommand(project.NewProjectCmd(client))
    35  	rootCmd.AddCommand(instance.NewInstanceCmd(client))
    36  
    37  	return rootCmd
    38  }