Skip to content

Commit

Permalink
Merge pull request #2256 from rsteube/docker-run-alias
Browse files Browse the repository at this point in the history
docker: run alias
  • Loading branch information
rsteube authored Feb 21, 2024
2 parents c79961b + a9a63f6 commit 7cb0457
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 7cb0457

Please sign in to comment.