{"modulePath":"github.colasdn.workers.dev/docker/cli","version":"v29.2.0+incompatible","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package hooks\n\n## Constants\n\n```go\nconst (\n\tNextSteps = iota\n)\n```\n\n## Variables\n\n```go\nvar ErrHookTemplateParse = errors.New(\"failed to parse hook template\")\n```\n\n## Functions\n\n```go\nfunc ParseTemplate(hookTemplate string, cmd *cobra.Command) ([]string, error)\n```\n\n```go\nfunc PrintNextSteps(out io.Writer, messages []string)\n```\n\n```go\nfunc TemplateReplaceArg(i int) string\n```\nTemplateReplaceArg takes an index i and returns a hook template string that the CLI will replace the template with the ith argument, after processing the passed flags.\n\nExample:\n\n\"run this image with \\`docker run \" + TemplateReplaceArg(0) + \"\\`\"\n\nwhen being executed after the command: \\`docker pull alpine\\` will result in the message: \"Run this image with \\`docker run alpine\\`\"\n\n```go\nfunc TemplateReplaceFlagValue(flag string) string\n```\nTemplateReplaceFlagValue returns a hook template string that will be replaced by the flags value.\n\nExample:\n\n\"you ran a container named: \" + TemplateReplaceFlagValue(\"name\")\n\nwhen being executed after the command: \\`docker run --name \"my-container\" alpine\\` will result in the message: \\`you ran a container named: my-container\\`\n\n```go\nfunc TemplateReplaceSubcommandName() string\n```\nTemplateReplaceSubcommandName returns a hook template string that will be replaced by the CLI subcommand being executed\n\nExample:\n\n\"you ran the subcommand: \" + TemplateReplaceSubcommandName()\n\nwhen being executed after the command: \\`docker run --name \"my-container\" alpine\\` will result in the message: \\`you ran the subcommand: run\\`\n\n## Types\n\n```go\ntype HookMessage struct {\n\tType     HookType\n\tTemplate string\n}\n```\nHookMessage represents a plugin hook response. Plugins declaring support for CLI hooks need to print a json representation of this type when their hook subcommand is invoked.\n\n```go\ntype HookType int\n```\n\n","path":"github.colasdn.workers.dev/docker/cli/cli-plugins/hooks","name":"hooks","synopsis":"","isRedistributable":true}
