func mainControl(ctx *cli.Context) { if ctx.Args().First() != "" { // command help. cli.ShowCommandHelp(ctx, ctx.Args().First()) } else { // command with Subcommands is an App. cli.ShowAppHelp(ctx) } }
// mainShare - main handler for mc share command. func mainShare(ctx *cli.Context) { // Set global flags from context. setGlobalsFromContext(ctx) if ctx.Args().First() != "" { // command help. cli.ShowCommandHelp(ctx, ctx.Args().First()) } else { // mc help. cli.ShowAppHelp(ctx) } // Sub-commands like "upload" and "download" have their own main. }
// mainConfig is the handle for "mc config" command. provides sub-commands which write configuration data in json format to config file. func mainConfig(ctx *cli.Context) { // Set global flags from context. setGlobalsFromContext(ctx) if ctx.Args().First() != "" { // command help. cli.ShowCommandHelp(ctx, ctx.Args().First()) } else { // command with Subcommands is an App. cli.ShowAppHelp(ctx) } // Sub-commands like "host" and "alias" have their own main. }
// mainEvents is the handle for "mc events" command. func mainEvents(ctx *cli.Context) error { // Set global flags from context. setGlobalsFromContext(ctx) if ctx.Args().First() != "" { // command help. cli.ShowCommandHelp(ctx, ctx.Args().First()) } else { // command with Subcommands is an App. cli.ShowAppHelp(ctx) } return nil // Sub-commands like "add", "remove", "list" have their own main. }