Ejemplo n.º 1
0
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)
	}
}
Ejemplo n.º 2
0
// 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.
}
Ejemplo n.º 3
0
// 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.
}
Ejemplo n.º 4
0
// 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.
}