github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/command/commands.go (about)

     1  package command
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	"github.com/hashicorp/nomad/command/agent"
     8  	"github.com/hashicorp/nomad/version"
     9  	colorable "github.com/mattn/go-colorable"
    10  	"github.com/mitchellh/cli"
    11  )
    12  
    13  const (
    14  	// EnvNomadCLINoColor is an env var that toggles colored UI output.
    15  	EnvNomadCLINoColor = `NOMAD_CLI_NO_COLOR`
    16  )
    17  
    18  // DeprecatedCommand is a command that wraps an existing command and prints a
    19  // deprecation notice and points the user to the new command. Deprecated
    20  // commands are always hidden from help output.
    21  type DeprecatedCommand struct {
    22  	cli.Command
    23  	Meta
    24  
    25  	// Old is the old command name, New is the new command name.
    26  	Old, New string
    27  }
    28  
    29  // Help wraps the embedded Help command and prints a warning about deprecations.
    30  func (c *DeprecatedCommand) Help() string {
    31  	c.warn()
    32  	return c.Command.Help()
    33  }
    34  
    35  // Run wraps the embedded Run command and prints a warning about deprecation.
    36  func (c *DeprecatedCommand) Run(args []string) int {
    37  	c.warn()
    38  	return c.Command.Run(args)
    39  }
    40  
    41  func (c *DeprecatedCommand) warn() {
    42  	c.Ui.Warn(wrapAtLength(fmt.Sprintf(
    43  		"WARNING! The \"nomad %s\" command is deprecated. Please use \"nomad %s\" "+
    44  			"instead. This command will be removed in Nomad 0.10 (or later).",
    45  		c.Old,
    46  		c.New)))
    47  	c.Ui.Warn("")
    48  }
    49  
    50  // NamedCommand is a interface to denote a commmand's name.
    51  type NamedCommand interface {
    52  	Name() string
    53  }
    54  
    55  // Commands returns the mapping of CLI commands for Nomad. The meta
    56  // parameter lets you set meta options for all commands.
    57  func Commands(metaPtr *Meta, agentUi cli.Ui) map[string]cli.CommandFactory {
    58  	if metaPtr == nil {
    59  		metaPtr = new(Meta)
    60  	}
    61  
    62  	meta := *metaPtr
    63  	if meta.Ui == nil {
    64  		meta.Ui = &cli.BasicUi{
    65  			Reader:      os.Stdin,
    66  			Writer:      colorable.NewColorableStdout(),
    67  			ErrorWriter: colorable.NewColorableStderr(),
    68  		}
    69  	}
    70  
    71  	all := map[string]cli.CommandFactory{
    72  		"acl": func() (cli.Command, error) {
    73  			return &ACLCommand{
    74  				Meta: meta,
    75  			}, nil
    76  		},
    77  		"acl bootstrap": func() (cli.Command, error) {
    78  			return &ACLBootstrapCommand{
    79  				Meta: meta,
    80  			}, nil
    81  		},
    82  		"acl policy": func() (cli.Command, error) {
    83  			return &ACLPolicyCommand{
    84  				Meta: meta,
    85  			}, nil
    86  		},
    87  		"acl policy apply": func() (cli.Command, error) {
    88  			return &ACLPolicyApplyCommand{
    89  				Meta: meta,
    90  			}, nil
    91  		},
    92  		"acl policy delete": func() (cli.Command, error) {
    93  			return &ACLPolicyDeleteCommand{
    94  				Meta: meta,
    95  			}, nil
    96  		},
    97  		"acl policy info": func() (cli.Command, error) {
    98  			return &ACLPolicyInfoCommand{
    99  				Meta: meta,
   100  			}, nil
   101  		},
   102  		"acl policy list": func() (cli.Command, error) {
   103  			return &ACLPolicyListCommand{
   104  				Meta: meta,
   105  			}, nil
   106  		},
   107  		"acl token": func() (cli.Command, error) {
   108  			return &ACLTokenCommand{
   109  				Meta: meta,
   110  			}, nil
   111  		},
   112  		"acl token create": func() (cli.Command, error) {
   113  			return &ACLTokenCreateCommand{
   114  				Meta: meta,
   115  			}, nil
   116  		},
   117  		"acl token update": func() (cli.Command, error) {
   118  			return &ACLTokenUpdateCommand{
   119  				Meta: meta,
   120  			}, nil
   121  		},
   122  		"acl token delete": func() (cli.Command, error) {
   123  			return &ACLTokenDeleteCommand{
   124  				Meta: meta,
   125  			}, nil
   126  		},
   127  		"acl token info": func() (cli.Command, error) {
   128  			return &ACLTokenInfoCommand{
   129  				Meta: meta,
   130  			}, nil
   131  		},
   132  		"acl token list": func() (cli.Command, error) {
   133  			return &ACLTokenListCommand{
   134  				Meta: meta,
   135  			}, nil
   136  		},
   137  		"acl token self": func() (cli.Command, error) {
   138  			return &ACLTokenSelfCommand{
   139  				Meta: meta,
   140  			}, nil
   141  		},
   142  		"alloc": func() (cli.Command, error) {
   143  			return &AllocCommand{
   144  				Meta: meta,
   145  			}, nil
   146  		},
   147  		"alloc exec": func() (cli.Command, error) {
   148  			return &AllocExecCommand{
   149  				Meta: meta,
   150  			}, nil
   151  		},
   152  		"alloc signal": func() (cli.Command, error) {
   153  			return &AllocSignalCommand{
   154  				Meta: meta,
   155  			}, nil
   156  		},
   157  		"alloc stop": func() (cli.Command, error) {
   158  			return &AllocStopCommand{
   159  				Meta: meta,
   160  			}, nil
   161  		},
   162  		"alloc fs": func() (cli.Command, error) {
   163  			return &AllocFSCommand{
   164  				Meta: meta,
   165  			}, nil
   166  		},
   167  		"alloc logs": func() (cli.Command, error) {
   168  			return &AllocLogsCommand{
   169  				Meta: meta,
   170  			}, nil
   171  		},
   172  		"alloc restart": func() (cli.Command, error) {
   173  			return &AllocRestartCommand{
   174  				Meta: meta,
   175  			}, nil
   176  		},
   177  		"alloc status": func() (cli.Command, error) {
   178  			return &AllocStatusCommand{
   179  				Meta: meta,
   180  			}, nil
   181  		},
   182  		"alloc-status": func() (cli.Command, error) {
   183  			return &AllocStatusCommand{
   184  				Meta: meta,
   185  			}, nil
   186  		},
   187  		"agent": func() (cli.Command, error) {
   188  			return &agent.Command{
   189  				Version:    version.GetVersion(),
   190  				Ui:         agentUi,
   191  				ShutdownCh: make(chan struct{}),
   192  			}, nil
   193  		},
   194  		"agent-info": func() (cli.Command, error) {
   195  			return &AgentInfoCommand{
   196  				Meta: meta,
   197  			}, nil
   198  		},
   199  		"check": func() (cli.Command, error) {
   200  			return &AgentCheckCommand{
   201  				Meta: meta,
   202  			}, nil
   203  		},
   204  		// operator debug was released in 0.12 as debug. This top-level alias preserves compatibility
   205  		"debug": func() (cli.Command, error) {
   206  			return &OperatorDebugCommand{
   207  				Meta: meta,
   208  			}, nil
   209  		},
   210  		"deployment": func() (cli.Command, error) {
   211  			return &DeploymentCommand{
   212  				Meta: meta,
   213  			}, nil
   214  		},
   215  		"deployment fail": func() (cli.Command, error) {
   216  			return &DeploymentFailCommand{
   217  				Meta: meta,
   218  			}, nil
   219  		},
   220  		"deployment list": func() (cli.Command, error) {
   221  			return &DeploymentListCommand{
   222  				Meta: meta,
   223  			}, nil
   224  		},
   225  		"deployment pause": func() (cli.Command, error) {
   226  			return &DeploymentPauseCommand{
   227  				Meta: meta,
   228  			}, nil
   229  		},
   230  		"deployment promote": func() (cli.Command, error) {
   231  			return &DeploymentPromoteCommand{
   232  				Meta: meta,
   233  			}, nil
   234  		},
   235  		"deployment resume": func() (cli.Command, error) {
   236  			return &DeploymentResumeCommand{
   237  				Meta: meta,
   238  			}, nil
   239  		},
   240  		"deployment status": func() (cli.Command, error) {
   241  			return &DeploymentStatusCommand{
   242  				Meta: meta,
   243  			}, nil
   244  		},
   245  		"deployment unblock": func() (cli.Command, error) {
   246  			return &DeploymentUnblockCommand{
   247  				Meta: meta,
   248  			}, nil
   249  		},
   250  		"eval": func() (cli.Command, error) {
   251  			return &EvalCommand{
   252  				Meta: meta,
   253  			}, nil
   254  		},
   255  		"eval status": func() (cli.Command, error) {
   256  			return &EvalStatusCommand{
   257  				Meta: meta,
   258  			}, nil
   259  		},
   260  		"eval-status": func() (cli.Command, error) {
   261  			return &EvalStatusCommand{
   262  				Meta: meta,
   263  			}, nil
   264  		},
   265  		"exec": func() (cli.Command, error) {
   266  			return &AllocExecCommand{
   267  				Meta: meta,
   268  			}, nil
   269  		},
   270  		"fs": func() (cli.Command, error) {
   271  			return &AllocFSCommand{
   272  				Meta: meta,
   273  			}, nil
   274  		},
   275  		"init": func() (cli.Command, error) {
   276  			return &JobInitCommand{
   277  				Meta: meta,
   278  			}, nil
   279  		},
   280  		"inspect": func() (cli.Command, error) {
   281  			return &JobInspectCommand{
   282  				Meta: meta,
   283  			}, nil
   284  		},
   285  		"keygen": func() (cli.Command, error) {
   286  			return &OperatorKeygenCommand{
   287  				Meta: meta,
   288  			}, nil
   289  		},
   290  		"keyring": func() (cli.Command, error) {
   291  			return &OperatorKeyringCommand{
   292  				Meta: meta,
   293  			}, nil
   294  		},
   295  		"job": func() (cli.Command, error) {
   296  			return &JobCommand{
   297  				Meta: meta,
   298  			}, nil
   299  		},
   300  		"job deployments": func() (cli.Command, error) {
   301  			return &JobDeploymentsCommand{
   302  				Meta: meta,
   303  			}, nil
   304  		},
   305  		"job dispatch": func() (cli.Command, error) {
   306  			return &JobDispatchCommand{
   307  				Meta: meta,
   308  			}, nil
   309  		},
   310  		"job eval": func() (cli.Command, error) {
   311  			return &JobEvalCommand{
   312  				Meta: meta,
   313  			}, nil
   314  		},
   315  		"job history": func() (cli.Command, error) {
   316  			return &JobHistoryCommand{
   317  				Meta: meta,
   318  			}, nil
   319  		},
   320  		"job init": func() (cli.Command, error) {
   321  			return &JobInitCommand{
   322  				Meta: meta,
   323  			}, nil
   324  		},
   325  		"job inspect": func() (cli.Command, error) {
   326  			return &JobInspectCommand{
   327  				Meta: meta,
   328  			}, nil
   329  		},
   330  		"job periodic": func() (cli.Command, error) {
   331  			return &JobPeriodicCommand{
   332  				Meta: meta,
   333  			}, nil
   334  		},
   335  		"job periodic force": func() (cli.Command, error) {
   336  			return &JobPeriodicForceCommand{
   337  				Meta: meta,
   338  			}, nil
   339  		},
   340  		"job plan": func() (cli.Command, error) {
   341  			return &JobPlanCommand{
   342  				Meta: meta,
   343  			}, nil
   344  		},
   345  		"job promote": func() (cli.Command, error) {
   346  			return &JobPromoteCommand{
   347  				Meta: meta,
   348  			}, nil
   349  		},
   350  		"job revert": func() (cli.Command, error) {
   351  			return &JobRevertCommand{
   352  				Meta: meta,
   353  			}, nil
   354  		},
   355  		"job run": func() (cli.Command, error) {
   356  			return &JobRunCommand{
   357  				Meta: meta,
   358  			}, nil
   359  		},
   360  		"job scale": func() (cli.Command, error) {
   361  			return &JobScaleCommand{
   362  				Meta: meta,
   363  			}, nil
   364  		},
   365  		"job scaling-events": func() (cli.Command, error) {
   366  			return &JobScalingEventsCommand{
   367  				Meta: meta,
   368  			}, nil
   369  		},
   370  		"job status": func() (cli.Command, error) {
   371  			return &JobStatusCommand{
   372  				Meta: meta,
   373  			}, nil
   374  		},
   375  		"job stop": func() (cli.Command, error) {
   376  			return &JobStopCommand{
   377  				Meta: meta,
   378  			}, nil
   379  		},
   380  		"job validate": func() (cli.Command, error) {
   381  			return &JobValidateCommand{
   382  				Meta: meta,
   383  			}, nil
   384  		},
   385  		"license": func() (cli.Command, error) {
   386  			return &LicenseCommand{
   387  				Meta: meta,
   388  			}, nil
   389  		},
   390  		"license get": func() (cli.Command, error) {
   391  			return &LicenseGetCommand{
   392  				Meta: meta,
   393  			}, nil
   394  		},
   395  		"license put": func() (cli.Command, error) {
   396  			return &LicensePutCommand{
   397  				Meta: meta,
   398  			}, nil
   399  		},
   400  		"logs": func() (cli.Command, error) {
   401  			return &AllocLogsCommand{
   402  				Meta: meta,
   403  			}, nil
   404  		},
   405  		"monitor": func() (cli.Command, error) {
   406  			return &MonitorCommand{
   407  				Meta: meta,
   408  			}, nil
   409  		},
   410  		"namespace": func() (cli.Command, error) {
   411  			return &NamespaceCommand{
   412  				Meta: meta,
   413  			}, nil
   414  		},
   415  		"namespace apply": func() (cli.Command, error) {
   416  			return &NamespaceApplyCommand{
   417  				Meta: meta,
   418  			}, nil
   419  		},
   420  		"namespace delete": func() (cli.Command, error) {
   421  			return &NamespaceDeleteCommand{
   422  				Meta: meta,
   423  			}, nil
   424  		},
   425  		"namespace inspect": func() (cli.Command, error) {
   426  			return &NamespaceInspectCommand{
   427  				Meta: meta,
   428  			}, nil
   429  		},
   430  		"namespace list": func() (cli.Command, error) {
   431  			return &NamespaceListCommand{
   432  				Meta: meta,
   433  			}, nil
   434  		},
   435  		"namespace status": func() (cli.Command, error) {
   436  			return &NamespaceStatusCommand{
   437  				Meta: meta,
   438  			}, nil
   439  		},
   440  		"node": func() (cli.Command, error) {
   441  			return &NodeCommand{
   442  				Meta: meta,
   443  			}, nil
   444  		},
   445  		"node config": func() (cli.Command, error) {
   446  			return &NodeConfigCommand{
   447  				Meta: meta,
   448  			}, nil
   449  		},
   450  		"node-drain": func() (cli.Command, error) {
   451  			return &NodeDrainCommand{
   452  				Meta: meta,
   453  			}, nil
   454  		},
   455  		"node drain": func() (cli.Command, error) {
   456  			return &NodeDrainCommand{
   457  				Meta: meta,
   458  			}, nil
   459  		},
   460  		"node eligibility": func() (cli.Command, error) {
   461  			return &NodeEligibilityCommand{
   462  				Meta: meta,
   463  			}, nil
   464  		},
   465  		"node-status": func() (cli.Command, error) {
   466  			return &NodeStatusCommand{
   467  				Meta: meta,
   468  			}, nil
   469  		},
   470  		"node status": func() (cli.Command, error) {
   471  			return &NodeStatusCommand{
   472  				Meta: meta,
   473  			}, nil
   474  		},
   475  		"operator": func() (cli.Command, error) {
   476  			return &OperatorCommand{
   477  				Meta: meta,
   478  			}, nil
   479  		},
   480  
   481  		"operator autopilot": func() (cli.Command, error) {
   482  			return &OperatorAutopilotCommand{
   483  				Meta: meta,
   484  			}, nil
   485  		},
   486  
   487  		"operator autopilot get-config": func() (cli.Command, error) {
   488  			return &OperatorAutopilotGetCommand{
   489  				Meta: meta,
   490  			}, nil
   491  		},
   492  
   493  		"operator autopilot set-config": func() (cli.Command, error) {
   494  			return &OperatorAutopilotSetCommand{
   495  				Meta: meta,
   496  			}, nil
   497  		},
   498  		"operator debug": func() (cli.Command, error) {
   499  			return &OperatorDebugCommand{
   500  				Meta: meta,
   501  			}, nil
   502  		},
   503  		"operator keygen": func() (cli.Command, error) {
   504  			return &OperatorKeygenCommand{
   505  				Meta: meta,
   506  			}, nil
   507  		},
   508  		"operator keyring": func() (cli.Command, error) {
   509  			return &OperatorKeyringCommand{
   510  				Meta: meta,
   511  			}, nil
   512  		},
   513  		"operator metrics": func() (cli.Command, error) {
   514  			return &OperatorMetricsCommand{
   515  				Meta: meta,
   516  			}, nil
   517  		},
   518  		"operator raft": func() (cli.Command, error) {
   519  			return &OperatorRaftCommand{
   520  				Meta: meta,
   521  			}, nil
   522  		},
   523  
   524  		"operator raft list-peers": func() (cli.Command, error) {
   525  			return &OperatorRaftListCommand{
   526  				Meta: meta,
   527  			}, nil
   528  		},
   529  
   530  		"operator raft remove-peer": func() (cli.Command, error) {
   531  			return &OperatorRaftRemoveCommand{
   532  				Meta: meta,
   533  			}, nil
   534  		},
   535  		"operator raft _info": func() (cli.Command, error) {
   536  			return &OperatorRaftInfoCommand{
   537  				Meta: meta,
   538  			}, nil
   539  		},
   540  		"operator raft _logs": func() (cli.Command, error) {
   541  			return &OperatorRaftLogsCommand{
   542  				Meta: meta,
   543  			}, nil
   544  		},
   545  		"operator raft _state": func() (cli.Command, error) {
   546  			return &OperatorRaftStateCommand{
   547  				Meta: meta,
   548  			}, nil
   549  		},
   550  
   551  		"operator snapshot": func() (cli.Command, error) {
   552  			return &OperatorSnapshotCommand{
   553  				Meta: meta,
   554  			}, nil
   555  		},
   556  		"operator snapshot save": func() (cli.Command, error) {
   557  			return &OperatorSnapshotSaveCommand{
   558  				Meta: meta,
   559  			}, nil
   560  		},
   561  		"operator snapshot inspect": func() (cli.Command, error) {
   562  			return &OperatorSnapshotInspectCommand{
   563  				Meta: meta,
   564  			}, nil
   565  		},
   566  		"operator snapshot restore": func() (cli.Command, error) {
   567  			return &OperatorSnapshotRestoreCommand{
   568  				Meta: meta,
   569  			}, nil
   570  		},
   571  
   572  		"plan": func() (cli.Command, error) {
   573  			return &JobPlanCommand{
   574  				Meta: meta,
   575  			}, nil
   576  		},
   577  
   578  		"plugin": func() (cli.Command, error) {
   579  			return &PluginCommand{
   580  				Meta: meta,
   581  			}, nil
   582  		},
   583  		"plugin status": func() (cli.Command, error) {
   584  			return &PluginStatusCommand{
   585  				Meta: meta,
   586  			}, nil
   587  		},
   588  
   589  		"quota": func() (cli.Command, error) {
   590  			return &QuotaCommand{
   591  				Meta: meta,
   592  			}, nil
   593  		},
   594  
   595  		"quota apply": func() (cli.Command, error) {
   596  			return &QuotaApplyCommand{
   597  				Meta: meta,
   598  			}, nil
   599  		},
   600  
   601  		"quota delete": func() (cli.Command, error) {
   602  			return &QuotaDeleteCommand{
   603  				Meta: meta,
   604  			}, nil
   605  		},
   606  
   607  		"quota init": func() (cli.Command, error) {
   608  			return &QuotaInitCommand{
   609  				Meta: meta,
   610  			}, nil
   611  		},
   612  
   613  		"quota inspect": func() (cli.Command, error) {
   614  			return &QuotaInspectCommand{
   615  				Meta: meta,
   616  			}, nil
   617  		},
   618  
   619  		"quota list": func() (cli.Command, error) {
   620  			return &QuotaListCommand{
   621  				Meta: meta,
   622  			}, nil
   623  		},
   624  
   625  		"quota status": func() (cli.Command, error) {
   626  			return &QuotaStatusCommand{
   627  				Meta: meta,
   628  			}, nil
   629  		},
   630  
   631  		"recommendation": func() (cli.Command, error) {
   632  			return &RecommendationCommand{
   633  				Meta: meta,
   634  			}, nil
   635  		},
   636  		"recommendation apply": func() (cli.Command, error) {
   637  			return &RecommendationApplyCommand{
   638  				RecommendationAutocompleteCommand: RecommendationAutocompleteCommand{
   639  					Meta: meta,
   640  				},
   641  			}, nil
   642  		},
   643  		"recommendation dismiss": func() (cli.Command, error) {
   644  			return &RecommendationDismissCommand{
   645  				RecommendationAutocompleteCommand: RecommendationAutocompleteCommand{
   646  					Meta: meta,
   647  				},
   648  			}, nil
   649  		},
   650  		"recommendation info": func() (cli.Command, error) {
   651  			return &RecommendationInfoCommand{
   652  				RecommendationAutocompleteCommand: RecommendationAutocompleteCommand{
   653  					Meta: meta,
   654  				},
   655  			}, nil
   656  		},
   657  		"recommendation list": func() (cli.Command, error) {
   658  			return &RecommendationListCommand{
   659  				Meta: meta,
   660  			}, nil
   661  		},
   662  
   663  		"run": func() (cli.Command, error) {
   664  			return &JobRunCommand{
   665  				Meta: meta,
   666  			}, nil
   667  		},
   668  		"scaling": func() (cli.Command, error) {
   669  			return &ScalingCommand{
   670  				Meta: meta,
   671  			}, nil
   672  		},
   673  		"scaling policy": func() (cli.Command, error) {
   674  			return &ScalingPolicyCommand{
   675  				Meta: meta,
   676  			}, nil
   677  		},
   678  		"scaling policy info": func() (cli.Command, error) {
   679  			return &ScalingPolicyInfoCommand{
   680  				Meta: meta,
   681  			}, nil
   682  		},
   683  		"scaling policy list": func() (cli.Command, error) {
   684  			return &ScalingPolicyListCommand{
   685  				Meta: meta,
   686  			}, nil
   687  		},
   688  		"sentinel": func() (cli.Command, error) {
   689  			return &SentinelCommand{
   690  				Meta: meta,
   691  			}, nil
   692  		},
   693  		"sentinel list": func() (cli.Command, error) {
   694  			return &SentinelListCommand{
   695  				Meta: meta,
   696  			}, nil
   697  		},
   698  		"sentinel apply": func() (cli.Command, error) {
   699  			return &SentinelApplyCommand{
   700  				Meta: meta,
   701  			}, nil
   702  		},
   703  		"sentinel delete": func() (cli.Command, error) {
   704  			return &SentinelDeleteCommand{
   705  				Meta: meta,
   706  			}, nil
   707  		},
   708  		"sentinel read": func() (cli.Command, error) {
   709  			return &SentinelReadCommand{
   710  				Meta: meta,
   711  			}, nil
   712  		},
   713  		"server": func() (cli.Command, error) {
   714  			return &ServerCommand{
   715  				Meta: meta,
   716  			}, nil
   717  		},
   718  		"server force-leave": func() (cli.Command, error) {
   719  			return &ServerForceLeaveCommand{
   720  				Meta: meta,
   721  			}, nil
   722  		},
   723  		"server join": func() (cli.Command, error) {
   724  			return &ServerJoinCommand{
   725  				Meta: meta,
   726  			}, nil
   727  		},
   728  		"server members": func() (cli.Command, error) {
   729  			return &ServerMembersCommand{
   730  				Meta: meta,
   731  			}, nil
   732  		},
   733  		"server-force-leave": func() (cli.Command, error) {
   734  			return &ServerForceLeaveCommand{
   735  				Meta: meta,
   736  			}, nil
   737  		},
   738  		"server-join": func() (cli.Command, error) {
   739  			return &ServerJoinCommand{
   740  				Meta: meta,
   741  			}, nil
   742  		},
   743  		"server-members": func() (cli.Command, error) {
   744  			return &ServerMembersCommand{
   745  				Meta: meta,
   746  			}, nil
   747  		},
   748  		"status": func() (cli.Command, error) {
   749  			return &StatusCommand{
   750  				Meta: meta,
   751  			}, nil
   752  		},
   753  		"stop": func() (cli.Command, error) {
   754  			return &JobStopCommand{
   755  				Meta: meta,
   756  			}, nil
   757  		},
   758  		"system": func() (cli.Command, error) {
   759  			return &SystemCommand{
   760  				Meta: meta,
   761  			}, nil
   762  		},
   763  		"system gc": func() (cli.Command, error) {
   764  			return &SystemGCCommand{
   765  				Meta: meta,
   766  			}, nil
   767  		},
   768  		"system reconcile": func() (cli.Command, error) {
   769  			return &SystemReconcileCommand{
   770  				Meta: meta,
   771  			}, nil
   772  		},
   773  		"system reconcile summaries": func() (cli.Command, error) {
   774  			return &SystemReconcileSummariesCommand{
   775  				Meta: meta,
   776  			}, nil
   777  		},
   778  		"ui": func() (cli.Command, error) {
   779  			return &UiCommand{
   780  				Meta: meta,
   781  			}, nil
   782  		},
   783  		"validate": func() (cli.Command, error) {
   784  			return &JobValidateCommand{
   785  				Meta: meta,
   786  			}, nil
   787  		},
   788  		"version": func() (cli.Command, error) {
   789  			return &VersionCommand{
   790  				Version: version.GetVersion(),
   791  				Ui:      meta.Ui,
   792  			}, nil
   793  		},
   794  		"volume": func() (cli.Command, error) {
   795  			return &VolumeCommand{
   796  				Meta: meta,
   797  			}, nil
   798  		},
   799  		"volume status": func() (cli.Command, error) {
   800  			return &VolumeStatusCommand{
   801  				Meta: meta,
   802  			}, nil
   803  		},
   804  		"volume register": func() (cli.Command, error) {
   805  			return &VolumeRegisterCommand{
   806  				Meta: meta,
   807  			}, nil
   808  		},
   809  		"volume deregister": func() (cli.Command, error) {
   810  			return &VolumeDeregisterCommand{
   811  				Meta: meta,
   812  			}, nil
   813  		},
   814  		"volume detach": func() (cli.Command, error) {
   815  			return &VolumeDetachCommand{
   816  				Meta: meta,
   817  			}, nil
   818  		},
   819  	}
   820  
   821  	deprecated := map[string]cli.CommandFactory{
   822  		"client-config": func() (cli.Command, error) {
   823  			return &DeprecatedCommand{
   824  				Old:  "client-config",
   825  				New:  "node config",
   826  				Meta: meta,
   827  				Command: &NodeConfigCommand{
   828  					Meta: meta,
   829  				},
   830  			}, nil
   831  		},
   832  
   833  		"keygen": func() (cli.Command, error) {
   834  			return &DeprecatedCommand{
   835  				Old:  "keygen",
   836  				New:  "operator keygen",
   837  				Meta: meta,
   838  				Command: &OperatorKeygenCommand{
   839  					Meta: meta,
   840  				},
   841  			}, nil
   842  		},
   843  
   844  		"keyring": func() (cli.Command, error) {
   845  			return &DeprecatedCommand{
   846  				Old:  "keyring",
   847  				New:  "operator keyring",
   848  				Meta: meta,
   849  				Command: &OperatorKeyringCommand{
   850  					Meta: meta,
   851  				},
   852  			}, nil
   853  		},
   854  
   855  		"server-force-leave": func() (cli.Command, error) {
   856  			return &DeprecatedCommand{
   857  				Old:  "server-force-leave",
   858  				New:  "server force-leave",
   859  				Meta: meta,
   860  				Command: &ServerForceLeaveCommand{
   861  					Meta: meta,
   862  				},
   863  			}, nil
   864  		},
   865  
   866  		"server-join": func() (cli.Command, error) {
   867  			return &DeprecatedCommand{
   868  				Old:  "server-join",
   869  				New:  "server join",
   870  				Meta: meta,
   871  				Command: &ServerJoinCommand{
   872  					Meta: meta,
   873  				},
   874  			}, nil
   875  		},
   876  
   877  		"server-members": func() (cli.Command, error) {
   878  			return &DeprecatedCommand{
   879  				Old:  "server-members",
   880  				New:  "server members",
   881  				Meta: meta,
   882  				Command: &ServerMembersCommand{
   883  					Meta: meta,
   884  				},
   885  			}, nil
   886  		},
   887  	}
   888  
   889  	for k, v := range deprecated {
   890  		all[k] = v
   891  	}
   892  
   893  	for k, v := range EntCommands(metaPtr, agentUi) {
   894  		all[k] = v
   895  	}
   896  
   897  	return all
   898  }