MCPcopy
hub / github.com/moncho/dry / executeMenuCommand

Method executeMenuCommand

app/model.go:3051–3097  ·  view source on GitHub ↗
(containerID string, cmd docker.Command)

Source from the content-addressed store, hash-verified

3049}
3050
3051func (m model) executeMenuCommand(containerID string, cmd docker.Command) (model, tea.Cmd) {
3052 switch cmd {
3053 case docker.INSPECT:
3054 return m, inspectContainerCmd(m.daemon, containerID)
3055 case docker.LOGS:
3056 return m, showContainerLogsCmd(m.daemon, containerID)
3057 case docker.ATTACH:
3058 return m, attachContainerCmd(m.daemon, containerID)
3059 case docker.EXEC:
3060 var cmd tea.Cmd
3061 m.inputPrompt, cmd = appui.NewInputPromptModelWithLimit(
3062 fmt.Sprintf("Exec in %s:", shortID(containerID)),
3063 "/bin/sh", "exec", containerID, 120,
3064 )
3065 m.inputPrompt.SetSize(m.width, m.height)
3066 m.overlay = overlayInputPrompt
3067 return m, cmd
3068 case docker.KILL:
3069 return m.showPrompt(
3070 fmt.Sprintf("Kill container %s?", shortID(containerID)),
3071 "kill", containerID,
3072 ), nil
3073 case docker.STOP:
3074 return m.showPrompt(
3075 fmt.Sprintf("Stop container %s?", shortID(containerID)),
3076 "stop", containerID,
3077 ), nil
3078 case docker.RESTART:
3079 return m.showPrompt(
3080 fmt.Sprintf("Restart container %s?", shortID(containerID)),
3081 "restart", containerID,
3082 ), nil
3083 case docker.RM:
3084 return m.showPrompt(
3085 fmt.Sprintf("Remove container %s?", shortID(containerID)),
3086 "rm", containerID,
3087 ), nil
3088 case docker.STATS:
3089 return m, showContainerStatsCmd(m.daemon, containerID)
3090 case docker.HISTORY:
3091 if c := m.daemon.ContainerByID(containerID); c != nil {
3092 return m, showImageHistoryCmd(m.daemon, c.ImageID)
3093 }
3094 return m, nil
3095 }
3096 return m, nil
3097}
3098
3099func (m model) executeContainerOp(tag, id string) tea.Cmd {
3100 daemon := m.daemon

Callers 3

UpdateMethod · 0.95
executePaletteActionMethod · 0.95

Calls 10

showPromptMethod · 0.95
inspectContainerCmdFunction · 0.85
showContainerLogsCmdFunction · 0.85
attachContainerCmdFunction · 0.85
shortIDFunction · 0.85
showContainerStatsCmdFunction · 0.85
showImageHistoryCmdFunction · 0.85
ContainerByIDMethod · 0.65
SetSizeMethod · 0.45

Tested by 1