Skip to content

Instantly share code, notes, and snippets.

@apollo7321
Last active October 29, 2019 10:30
Show Gist options
  • Select an option

  • Save apollo7321/8cd14252a66cafed105b60836ea73fba to your computer and use it in GitHub Desktop.

Select an option

Save apollo7321/8cd14252a66cafed105b60836ea73fba to your computer and use it in GitHub Desktop.
package cmd
import (
"strings"
)
var usageHintMap = map[string]string{
"bash": `# Run this command to configure your shell:
# eval $(minikube %placeholder docker-env)
`,
"fish": `# Run this command to configure your shell:
# eval (minikube %placeholder docker-env)
`,
"powershell": `# Run this command to configure your shell:
# & minikube docker-env %placeholder | Invoke-Expression
`,
"cmd": `REM Run this command to configure your shell:
REM @FOR /f "tokens=*" %i IN ('minikube %placeholder docker-env') DO @%i
`,
"emacs": `;; Run this command to configure your shell:
;; (with-temp-buffer (shell-command "minikube %placeholder docker-env" (current-buffer)) (eval-buffer))
`,
}
func generateUsageHint(userShell string, parameters map[string]) string {
hint, ok := strings.replace(usageHintMap[userShell], "%placeholder", parameters["p"], 1)
if !ok {
return strings.Replace(usageHintMap["bash"], "%placeholder", parameters["p"], 1)
}
return hint
}
@max-weis

Copy link
Copy Markdown

klein geschriebene funktionen sind private und groß sind public. deswegen kannst du keine kleingeschrieben funktionen auf "externe" objekte aufrufen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment