func CommandsCmd(root *cmds.Command) *cmds.Command {
	return &cmds.Command{
		Helptext: cmdkit.HelpText{
			Tagline:          "List all available commands.",
			ShortDescription: `Lists all available commands (and subcommands) and exits.`,
		},
		Options: []cmdkit.Option{
			cmdkit.BoolOption(flagsOptionName, "f", "Show command flags"),
		},
		Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) {
			rootCmd := cmd2outputCmd("dms3fs", root)
			rootCmd.showOpts, _ = req.Options[flagsOptionName].(bool)
			err := cmds.EmitOnce(res, &rootCmd)
			if err != nil {
				log.Error(err)
			}
		},
		Encoders: cmds.EncoderMap{
			cmds.Text: func(req *cmds.Request) func(io.Writer) cmds.Encoder {
				return func(w io.Writer) cmds.Encoder { return &commandEncoder{w} }
			},
		},
		Type: Command{},
	}
}
// CommandsCmd takes in a root command,
// and returns a command that lists the subcommands in that root
CommandsCmd takes in a root command,
and returns a command that lists the subcommands in that root
// CommandsCmd takes in a root command // and returns a command that lists the subcommands in that root
func CommandsCmd(root *cmds.Command) *cmds.Command {
	return &cmds.Command{
		Helptext: cmdkit.HelpText{
			Tagline:          "List all available commands.",
			ShortDescription: `Lists all available commands (and subcommands) and exits.`,
		},
		Options: []cmdkit.Option{
			cmdkit.BoolOption(flagsOptionName, "f", "Show command flags"),
		},
		Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) {
			rootCmd := cmd2outputCmd("dms3fs", root)
			rootCmd.showOpts, _ = req.Options[flagsOptionName].(bool)
			err := cmds.EmitOnce(res, &rootCmd)
			if err != nil {
				log.Error(err)
			}
		},
		Encoders: cmds.EncoderMap{
			cmds.Text: func(req *cmds.Request) func(io.Writer) cmds.Encoder {
				return func(w io.Writer) cmds.Encoder { return &commandEncoder{w} }
			},
		},
		Type: Command{},
	}
}
func CommandsCmd ( root * cmds . Command ) * cmds . Command { return & cmds . Command { Helptext : cmdkit . HelpText { Tagline : " " , ShortDescription : `Lists all available commands (and subcommands) and exits.` , } , Options : [ ] cmdkit . Option { cmdkit . BoolOption ( flagsOptionName , " " , " " ) , } , Run : func ( req * cmds . Request , res cmds . ResponseEmitter , env cmds . Environment ) { rootCmd := cmd2outputCmd ( " " , root ) rootCmd . showOpts , _ = req . Options [ flagsOptionName ] . ( bool ) err := cmds . EmitOnce ( res , & rootCmd ) if err != nil { log . Error ( err ) } } , Encoders : cmds . EncoderMap { cmds . Text : func ( req * cmds . Request ) func ( io . Writer ) cmds . Encoder { return func ( w io . Writer ) cmds . Encoder { return & commandEncoder { w } } } , } , Type : Command { } , } }
CommandsCmd takes in a root command,
and returns a command that lists the subcommands in that root
CommandsCmd takes in a root command and returns a command that lists the subcommands in that root