func targetCfgCmdAll()

in newt/cli/target_cfg_cmds.go [838:1050]


func targetCfgCmdAll() []*cobra.Command {
	cmds := []*cobra.Command{}

	configHelpText := "View or populate a target's system configuration"

	configCmd := &cobra.Command{
		Use:   "config",
		Short: configHelpText,
		Long:  configHelpText,
		Run: func(cmd *cobra.Command, args []string) {
			cmd.Usage()
		},
	}

	cmds = append(cmds, configCmd)

	configShowCmd := &cobra.Command{
		Use:   "show <target> [target...]",
		Short: "View a target's system configuration",
		Long:  "View a target's system configuration",
		Run:   targetConfigShowCmd,
	}

	configShowCmd.Flags().StringVarP(&util.InjectSyscfg, "syscfg", "S", "",
		"Injected syscfg settings, key=value pairs separated by colon")

	configCmd.AddCommand(configShowCmd)
	AddTabCompleteFn(configShowCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	configBriefCmd := &cobra.Command{
		Use:   "brief <target> [target...]",
		Short: "View a summary of target's system configuration",
		Long:  "View a summary of target's system configuration",
		Run:   targetConfigBriefCmd,
	}

	configBriefCmd.Flags().StringVarP(&util.InjectSyscfg, "syscfg", "S", "",
		"Injected syscfg settings, key=value pairs separated by colon")

	configCmd.AddCommand(configBriefCmd)
	AddTabCompleteFn(configBriefCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	configFlatCmd := &cobra.Command{
		Use:   "flat <target> [target...]",
		Short: "View a flat table of target's system configuration",
		Long:  "View a flat table of target's system configuration",
		Run:   targetConfigFlatCmd,
	}

	configFlatCmd.Flags().StringVarP(&util.InjectSyscfg, "syscfg", "S", "",
		"Injected syscfg settings, key=value pairs separated by colon")

	configCmd.AddCommand(configFlatCmd)
	AddTabCompleteFn(configFlatCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	configInitCmd := &cobra.Command{
		Use:   "init",
		Short: "Populate a target's system configuration file",
		Long: "Populate a target's system configuration file (syscfg). " +
			"Unspecified settings are given default values.",
		Run: targetConfigInitCmd,
	}
	configInitCmd.PersistentFlags().BoolVarP(&newtutil.NewtForce,
		"force", "f", false,
		"Force overwrite of target configuration")

	configCmd.AddCommand(configInitCmd)
	AddTabCompleteFn(configInitCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	logHelpText := "View a target's log configuration"

	logCmd := &cobra.Command{
		Use:   "logcfg",
		Short: logHelpText,
		Long:  logHelpText,
		Run: func(cmd *cobra.Command, args []string) {
			cmd.Usage()
		},
	}

	cmds = append(cmds, logCmd)

	logShowCmd := &cobra.Command{
		Use:   "show <target> [target...]",
		Short: "View a target's log configuration",
		Long:  "View a target's log configuration",
		Run:   targetLogShowCmd,
	}

	logCmd.AddCommand(logShowCmd)
	AddTabCompleteFn(logShowCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	logBriefCmd := &cobra.Command{
		Use:   "brief <target> [target...]",
		Short: "View a summary of target's log configuration",
		Long:  "View a summary of target's log configuration",
		Run:   targetLogBriefCmd,
	}

	logCmd.AddCommand(logBriefCmd)
	AddTabCompleteFn(logBriefCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	sysinitHelpText := "View a target's sysinit configuration"

	sysinitCmd := &cobra.Command{
		Use:   "sysinit",
		Short: sysinitHelpText,
		Long:  sysinitHelpText,
		Run: func(cmd *cobra.Command, args []string) {
			cmd.Usage()
		},
	}

	cmds = append(cmds, sysinitCmd)

	sysinitShowCmd := &cobra.Command{
		Use:   "show <target> [target...]",
		Short: "View a target's sysinit configuration",
		Long:  "View a target's sysinit configuration",
		Run:   targetSysinitShowCmd,
	}

	sysinitCmd.AddCommand(sysinitShowCmd)
	AddTabCompleteFn(sysinitShowCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	sysinitBriefCmd := &cobra.Command{
		Use:   "brief <target> [target...]",
		Short: "View a summary of target's sysinit configuration",
		Long:  "View a summary of target's sysinit configuration",
		Run:   targetSysinitBriefCmd,
	}

	sysinitCmd.AddCommand(sysinitBriefCmd)
	AddTabCompleteFn(sysinitBriefCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	sysinitGraphvizCmd := &cobra.Command{
		Use:   "graphviz <target> [target...]",
		Short: "Print a graph representation of target's sysinit configuration (DOT format)",
		Long:  "Print a graph representation of target's sysinit configuration (DOT format)",
		Run:   targetSysinitGraphvizCmd,
	}

	sysinitCmd.AddCommand(sysinitGraphvizCmd)
	AddTabCompleteFn(sysinitGraphvizCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	sysdownHelpText := "View a target's sysdown configuration"

	sysdownCmd := &cobra.Command{
		Use:   "sysdown",
		Short: sysdownHelpText,
		Long:  sysdownHelpText,
		Run: func(cmd *cobra.Command, args []string) {
			cmd.Usage()
		},
	}

	cmds = append(cmds, sysdownCmd)

	sysdownShowCmd := &cobra.Command{
		Use:   "show <target> [target...]",
		Short: "View a target's sysdown configuration",
		Long:  "View a target's sysdown configuration",
		Run:   targetSysdownShowCmd,
	}

	sysdownCmd.AddCommand(sysdownShowCmd)
	AddTabCompleteFn(sysdownShowCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	sysdownBriefCmd := &cobra.Command{
		Use:   "brief <target> [target...]",
		Short: "View a summary of target's sysdown configuration",
		Long:  "View a summary of target's sysdown configuration",
		Run:   targetSysdownBriefCmd,
	}

	sysdownCmd.AddCommand(sysdownBriefCmd)
	AddTabCompleteFn(sysdownBriefCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	dumpCmd := &cobra.Command{
		Use:   "dump <target> [target...]",
		Short: "Dump a target's intermediate form in JSON",
		Run:   targetDumpCmd,
	}

	cmds = append(cmds, dumpCmd)
	AddTabCompleteFn(dumpCmd, func() []string {
		return append(targetList(), unittestList()...)
	})

	return cmds
}