示例#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)
	}
}
示例#2
0
文件: share-main.go 项目: fwessels/mc
// 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.
}
示例#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.
}
示例#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.
}