Skip to content

Commit

Permalink
docker: run alias
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Feb 21, 2024
1 parent c79961b commit a9a63f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 140 deletions.
5 changes: 5 additions & 0 deletions completers/docker_completer/cmd/container_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func init() {
"network": carapace.ActionValues("bridge", "container", "host", "none"),
"pid": carapace.ActionValues("container", "host"),
"user": os.ActionUsers(),
"volume": docker.ActionVolumes(),
"volumes-from": carapace.Batch(
docker.ActionContainers(),
docker.ActionContainerIds(),
).ToA(),
})

carapace.Gen(container_runCmd).PositionalCompletion(
Expand Down
18 changes: 18 additions & 0 deletions completers/docker_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,23 @@ func init() {
}
}
}

addRootAlias("run", container_runCmd.Short, "common", []string{"docker", "container", "run"})
})
}

func addRootAlias(use string, short, groupID string, command []string) {
cmd := &cobra.Command{
Use: use,
Short: short,
GroupID: groupID,
Run: func(cmd *cobra.Command, args []string) {},
DisableFlagParsing: true,
}

carapace.Gen(cmd).PositionalAnyCompletion(
bridge.ActionCarapaceBin(command...),
)

rootCmd.AddCommand(cmd)
}
140 changes: 0 additions & 140 deletions completers/docker_completer/cmd/run.go

This file was deleted.

0 comments on commit a9a63f6

Please sign in to comment.