mirror of
https://github.com/containers/podman.git
synced 2025-12-23 22:28:30 -05:00
lint: reenable revive unused-parameter check
Signed-off-by: Matt Souza <medsouz99@gmail.com>
This commit is contained in:
@@ -64,7 +64,6 @@ linters:
|
||||
revive:
|
||||
rules:
|
||||
- name: unused-parameter
|
||||
disabled: true
|
||||
exclusions:
|
||||
generated: strict
|
||||
presets:
|
||||
|
||||
@@ -83,7 +83,7 @@ func init() {
|
||||
rootCmd.AddCommand(installCmd)
|
||||
}
|
||||
|
||||
func install(cmd *cobra.Command, args []string) error {
|
||||
func install(_ *cobra.Command, _ []string) error {
|
||||
userName, uid, homeDir, err := getUser()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -142,7 +142,7 @@ func addPrefixFlag(cmd *cobra.Command) {
|
||||
cmd.Flags().StringVar(&installPrefix, "prefix", defaultPrefix, "Sets the install location prefix")
|
||||
}
|
||||
|
||||
func silentUsage(cmd *cobra.Command, args []string) {
|
||||
func silentUsage(cmd *cobra.Command, _ []string) {
|
||||
cmd.SilenceUsage = true
|
||||
cmd.SilenceErrors = true
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func init() {
|
||||
rootCmd.AddCommand(serviceCmd)
|
||||
}
|
||||
|
||||
func serviceRun(cmd *cobra.Command, args []string) {
|
||||
func serviceRun(_ *cobra.Command, _ []string) {
|
||||
info, err := os.Stdin.Stat()
|
||||
if err != nil || info.Mode()&fs.ModeSocket == 0 {
|
||||
fmt.Fprintln(os.Stderr, "This is an internal command that is not intended for standard terminal usage")
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
rootCmd.AddCommand(uninstallCmd)
|
||||
}
|
||||
|
||||
func uninstall(cmd *cobra.Command, args []string) error {
|
||||
func uninstall(_ *cobra.Command, _ []string) error {
|
||||
userName, _, homeDir, err := getUser()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -88,7 +88,7 @@ func init() {
|
||||
flags.StringVarP(&createContainerOpts.Layer, "layer", "l", "", "ID of containers's read-write layer (default none)")
|
||||
}
|
||||
|
||||
func createStorageLayer(cmd *cobra.Command, args []string) error {
|
||||
func createStorageLayer(_ *cobra.Command, _ []string) error {
|
||||
results, err := testingEngine.CreateStorageLayer(mainContext, createStorageLayerOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -98,7 +98,7 @@ func createStorageLayer(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createLayer(cmd *cobra.Command, args []string) error {
|
||||
func createLayer(_ *cobra.Command, _ []string) error {
|
||||
results, err := testingEngine.CreateLayer(mainContext, createLayerOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -108,7 +108,7 @@ func createLayer(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createImage(cmd *cobra.Command, args []string) error {
|
||||
func createImage(_ *cobra.Command, _ []string) error {
|
||||
results, err := testingEngine.CreateImage(mainContext, createImageOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -118,7 +118,7 @@ func createImage(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createContainer(cmd *cobra.Command, args []string) error {
|
||||
func createContainer(_ *cobra.Command, _ []string) error {
|
||||
results, err := testingEngine.CreateContainer(mainContext, createContainerOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -205,7 +205,7 @@ func init() {
|
||||
flags.StringVarP(&removeContainerDataOpts.Key, "key", "k", "", "Name of the data item")
|
||||
}
|
||||
|
||||
func createLayerData(cmd *cobra.Command, args []string) error {
|
||||
func createLayerData(_ *cobra.Command, _ []string) error {
|
||||
if createLayerDataOpts.ID == "" {
|
||||
return errors.New("layer ID not specified")
|
||||
}
|
||||
@@ -233,7 +233,7 @@ func createLayerData(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createImageData(cmd *cobra.Command, args []string) error {
|
||||
func createImageData(_ *cobra.Command, _ []string) error {
|
||||
if createImageDataOpts.ID == "" {
|
||||
return errors.New("image ID not specified")
|
||||
}
|
||||
@@ -261,7 +261,7 @@ func createImageData(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func createContainerData(cmd *cobra.Command, args []string) error {
|
||||
func createContainerData(_ *cobra.Command, _ []string) error {
|
||||
if createContainerDataOpts.ID == "" {
|
||||
return errors.New("container ID not specified")
|
||||
}
|
||||
@@ -289,7 +289,7 @@ func createContainerData(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func modifyLayerData(cmd *cobra.Command, args []string) error {
|
||||
func modifyLayerData(_ *cobra.Command, _ []string) error {
|
||||
if modifyLayerDataOpts.ID == "" {
|
||||
return errors.New("layer ID not specified")
|
||||
}
|
||||
@@ -314,7 +314,7 @@ func modifyLayerData(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func modifyImageData(cmd *cobra.Command, args []string) error {
|
||||
func modifyImageData(_ *cobra.Command, _ []string) error {
|
||||
if modifyImageDataOpts.ID == "" {
|
||||
return errors.New("image ID not specified")
|
||||
}
|
||||
@@ -339,7 +339,7 @@ func modifyImageData(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func modifyContainerData(cmd *cobra.Command, args []string) error {
|
||||
func modifyContainerData(_ *cobra.Command, _ []string) error {
|
||||
if modifyContainerDataOpts.ID == "" {
|
||||
return errors.New("container ID not specified")
|
||||
}
|
||||
@@ -364,7 +364,7 @@ func modifyContainerData(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeLayerData(cmd *cobra.Command, args []string) error {
|
||||
func removeLayerData(_ *cobra.Command, _ []string) error {
|
||||
if removeLayerDataOpts.ID == "" {
|
||||
return errors.New("layer ID not specified")
|
||||
}
|
||||
@@ -378,7 +378,7 @@ func removeLayerData(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeImageData(cmd *cobra.Command, args []string) error {
|
||||
func removeImageData(_ *cobra.Command, _ []string) error {
|
||||
if removeImageDataOpts.ID == "" {
|
||||
return errors.New("image ID not specified")
|
||||
}
|
||||
@@ -392,7 +392,7 @@ func removeImageData(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeContainerData(cmd *cobra.Command, args []string) error {
|
||||
func removeContainerData(_ *cobra.Command, _ []string) error {
|
||||
if removeContainerDataOpts.ID == "" {
|
||||
return errors.New("container ID not specified")
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ func init() {
|
||||
flags.StringVarP(&modifyLayerFile, "file", "f", "", "archive of contents to extract over layer")
|
||||
}
|
||||
|
||||
func populateLayer(cmd *cobra.Command, args []string) error {
|
||||
func populateLayer(_ *cobra.Command, _ []string) error {
|
||||
if populateLayerOpts.ID == "" {
|
||||
return errors.New("layer ID not specified")
|
||||
}
|
||||
@@ -73,7 +73,7 @@ func populateLayer(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func modifyLayer(cmd *cobra.Command, args []string) error {
|
||||
func modifyLayer(_ *cobra.Command, _ []string) error {
|
||||
if modifyLayerOpts.ID == "" {
|
||||
return errors.New("layer ID not specified")
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ var (
|
||||
mainCmd = &cobra.Command{
|
||||
Use: "podman-testing",
|
||||
Long: "Assorted tools for use in testing podman",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
return cmd.Help()
|
||||
},
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
|
||||
return before()
|
||||
},
|
||||
PersistentPostRunE: func(cmd *cobra.Command, args []string) error {
|
||||
PersistentPostRunE: func(_ *cobra.Command, _ []string) error {
|
||||
return after()
|
||||
},
|
||||
SilenceUsage: true,
|
||||
|
||||
@@ -83,7 +83,7 @@ func init() {
|
||||
flags.StringVarP(&removeContainerOpts.ID, "container", "i", "", "ID of the container to remove")
|
||||
}
|
||||
|
||||
func removeStorageLayer(cmd *cobra.Command, args []string) error {
|
||||
func removeStorageLayer(_ *cobra.Command, _ []string) error {
|
||||
results, err := testingEngine.RemoveStorageLayer(mainContext, removeStorageLayerOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -92,7 +92,7 @@ func removeStorageLayer(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeLayer(cmd *cobra.Command, args []string) error {
|
||||
func removeLayer(_ *cobra.Command, _ []string) error {
|
||||
results, err := testingEngine.RemoveLayer(mainContext, removeLayerOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -101,7 +101,7 @@ func removeLayer(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeImage(cmd *cobra.Command, args []string) error {
|
||||
func removeImage(_ *cobra.Command, _ []string) error {
|
||||
results, err := testingEngine.RemoveImage(mainContext, removeImageOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -110,7 +110,7 @@ func removeImage(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeContainer(cmd *cobra.Command, args []string) error {
|
||||
func removeContainer(_ *cobra.Command, _ []string) error {
|
||||
results, err := testingEngine.RemoveContainer(mainContext, removeContainerOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -58,7 +58,7 @@ func init() {
|
||||
_ = addCmd.RegisterFlagCompletionFunc(fileMIMETypeFlagName, completion.AutocompleteNone)
|
||||
}
|
||||
|
||||
func add(cmd *cobra.Command, args []string) error {
|
||||
func add(_ *cobra.Command, args []string) error {
|
||||
artifactName := args[0]
|
||||
blobs := args[1:]
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ func init() {
|
||||
_ = extractCmd.RegisterFlagCompletionFunc(titleFlagName, completion.AutocompleteNone)
|
||||
}
|
||||
|
||||
func extract(cmd *cobra.Command, args []string) error {
|
||||
func extract(_ *cobra.Command, args []string) error {
|
||||
err := registry.ImageEngine().ArtifactExtract(registry.Context(), args[0], args[1], extractOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -40,7 +40,7 @@ func init() {
|
||||
// _ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&machine.InspectInfo{}))
|
||||
}
|
||||
|
||||
func inspect(cmd *cobra.Command, args []string) error {
|
||||
func inspect(_ *cobra.Command, args []string) error {
|
||||
artifactOptions := entities.ArtifactInspectOptions{}
|
||||
inspectData, err := registry.ImageEngine().ArtifactInspect(registry.Context(), args[0], artifactOptions)
|
||||
if err != nil {
|
||||
|
||||
@@ -41,7 +41,7 @@ func init() {
|
||||
rmFlags(rmCmd)
|
||||
}
|
||||
|
||||
func rm(cmd *cobra.Command, args []string) error {
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
rmOptions.Artifacts = args
|
||||
|
||||
artifactRemoveReport, err := registry.ImageEngine().ArtifactRm(registry.Context(), rmOptions)
|
||||
|
||||
@@ -738,7 +738,7 @@ func AutocompleteSecrets(cmd *cobra.Command, args []string, toComplete string) (
|
||||
return getSecrets(cmd, toComplete, completeDefault)
|
||||
}
|
||||
|
||||
func AutocompleteSecretCreate(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteSecretCreate(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) == 1 {
|
||||
return nil, cobra.ShellCompDirectiveDefault
|
||||
}
|
||||
@@ -776,12 +776,12 @@ func AutocompleteManifestListAndMember(cmd *cobra.Command, args []string, toComp
|
||||
}
|
||||
|
||||
// AutocompleteImageSearchFilters - Autocomplete `search --filter`.
|
||||
func AutocompleteImageSearchFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteImageSearchFilters(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return libimageDefine.SearchFilters, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompletePodExitPolicy - Autocomplete pod exit policy.
|
||||
func AutocompletePodExitPolicy(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompletePodExitPolicy(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return config.PodExitPolicies, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
@@ -845,13 +845,13 @@ func AutocompleteNetworks(cmd *cobra.Command, args []string, toComplete string)
|
||||
|
||||
// AutocompleteHostsFile - Autocomplete hosts file options.
|
||||
// -> "image", "none", paths
|
||||
func AutocompleteHostsFile(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteHostsFile(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
hostsFileModes := []string{"image", "none"}
|
||||
return hostsFileModes, cobra.ShellCompDirectiveDefault
|
||||
}
|
||||
|
||||
// AutocompleteDefaultOneArg - Autocomplete path only for the first argument.
|
||||
func AutocompleteDefaultOneArg(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteDefaultOneArg(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) == 0 {
|
||||
return nil, cobra.ShellCompDirectiveDefault
|
||||
}
|
||||
@@ -1088,7 +1088,7 @@ func AutocompleteScp(cmd *cobra.Command, args []string, toComplete string) ([]st
|
||||
|
||||
// AutocompleteDetachKeys - Autocomplete detach-keys options.
|
||||
// -> "ctrl-"
|
||||
func AutocompleteDetachKeys(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteDetachKeys(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if strings.HasSuffix(toComplete, ",") {
|
||||
return []string{toComplete + "ctrl-"}, cobra.ShellCompDirectiveNoSpace
|
||||
}
|
||||
@@ -1097,36 +1097,36 @@ func AutocompleteDetachKeys(cmd *cobra.Command, args []string, toComplete string
|
||||
|
||||
// AutocompleteChangeInstructions - Autocomplete change instructions options for commit and import.
|
||||
// -> "CMD", "ENTRYPOINT", "ENV", "EXPOSE", "LABEL", "ONBUILD", "STOPSIGNAL", "USER", "VOLUME", "WORKDIR"
|
||||
func AutocompleteChangeInstructions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteChangeInstructions(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return ChangeCmds, cobra.ShellCompDirectiveNoSpace
|
||||
}
|
||||
|
||||
// AutocompleteImageFormat - Autocomplete image format options.
|
||||
// -> "oci", "docker"
|
||||
func AutocompleteImageFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteImageFormat(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
ImageFormat := []string{"oci", "docker"}
|
||||
return ImageFormat, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteInitCtr - Autocomplete init container type
|
||||
// -> "once", "always"
|
||||
func AutocompleteInitCtr(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteInitCtr(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
InitCtrType := []string{define.AlwaysInitContainer, define.OneShotInitContainer}
|
||||
return InitCtrType, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteCreateAttach - Autocomplete create --attach options.
|
||||
// -> "stdin", "stdout", "stderr"
|
||||
func AutocompleteCreateAttach(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteCreateAttach(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return []string{"stdin", "stdout", "stderr"}, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteNamespace - Autocomplete namespace options.
|
||||
// -> host,container:[name],ns:[path],private
|
||||
func AutocompleteNamespace(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteNamespace(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"container:": func(s string) ([]string, cobra.ShellCompDirective) { return getContainers(cmd, s, completeDefault) },
|
||||
"ns:": func(s string) ([]string, cobra.ShellCompDirective) { return nil, cobra.ShellCompDirectiveDefault },
|
||||
"ns:": func(_ string) ([]string, cobra.ShellCompDirective) { return nil, cobra.ShellCompDirectiveDefault },
|
||||
"host": nil,
|
||||
"private": nil,
|
||||
}
|
||||
@@ -1143,21 +1143,21 @@ func AutocompleteUserNamespace(cmd *cobra.Command, args []string, toComplete str
|
||||
|
||||
// AutocompleteCgroupMode - Autocomplete cgroup mode options.
|
||||
// -> "enabled", "disabled", "no-conmon", "split"
|
||||
func AutocompleteCgroupMode(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteCgroupMode(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
cgroupModes := []string{"enabled", "disabled", "no-conmon", "split"}
|
||||
return cgroupModes, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteImageVolume - Autocomplete image volume options.
|
||||
// -> "bind", "tmpfs", "ignore"
|
||||
func AutocompleteImageVolume(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteImageVolume(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
imageVolumes := []string{"bind", "tmpfs", "ignore"}
|
||||
return imageVolumes, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteLogDriver - Autocomplete log-driver options.
|
||||
// -> "journald", "none", "k8s-file", "passthrough", "passthrough-tty"
|
||||
func AutocompleteLogDriver(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteLogDriver(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
// don't show json-file
|
||||
logDrivers := []string{define.JournaldLogging, define.NoLogging, define.KubernetesLogging}
|
||||
if !registry.IsRemote() {
|
||||
@@ -1168,7 +1168,7 @@ func AutocompleteLogDriver(cmd *cobra.Command, args []string, toComplete string)
|
||||
|
||||
// AutocompleteLogOpt - Autocomplete log-opt options.
|
||||
// -> "path=", "tag="
|
||||
func AutocompleteLogOpt(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteLogOpt(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
logOptions := []string{"path=", "tag=", "max-size="}
|
||||
if strings.HasPrefix(toComplete, "path=") {
|
||||
return nil, cobra.ShellCompDirectiveDefault
|
||||
@@ -1178,25 +1178,25 @@ func AutocompleteLogOpt(cmd *cobra.Command, args []string, toComplete string) ([
|
||||
|
||||
// AutocompletePullOption - Autocomplete pull options for create and run command.
|
||||
// -> "always", "missing", "never"
|
||||
func AutocompletePullOption(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompletePullOption(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
pullOptions := []string{"always", "missing", "never", "newer"}
|
||||
return pullOptions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteRestartOption - Autocomplete restart options for create and run command.
|
||||
// -> "always", "no", "on-failure", "unless-stopped"
|
||||
func AutocompleteRestartOption(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteRestartOption(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
restartOptions := []string{define.RestartPolicyAlways, define.RestartPolicyNo,
|
||||
define.RestartPolicyOnFailure, define.RestartPolicyUnlessStopped}
|
||||
return restartOptions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteSecurityOption - Autocomplete security options options.
|
||||
func AutocompleteSecurityOption(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteSecurityOption(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"apparmor=": nil,
|
||||
"no-new-privileges": nil,
|
||||
"seccomp=": func(s string) ([]string, cobra.ShellCompDirective) { return nil, cobra.ShellCompDirectiveDefault },
|
||||
"seccomp=": func(_ string) ([]string, cobra.ShellCompDirective) { return nil, cobra.ShellCompDirectiveDefault },
|
||||
"label=": func(s string) ([]string, cobra.ShellCompDirective) {
|
||||
if strings.HasPrefix(s, "d") {
|
||||
return []string{"disable"}, cobra.ShellCompDirectiveNoFileComp
|
||||
@@ -1209,7 +1209,7 @@ func AutocompleteSecurityOption(cmd *cobra.Command, args []string, toComplete st
|
||||
|
||||
// AutocompleteStopSignal - Autocomplete stop signal options.
|
||||
// Autocompletes signals both lower or uppercase depending on the user input.
|
||||
func AutocompleteStopSignal(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteStopSignal(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
// convertCase will convert a string to lowercase only if the user input is lowercase
|
||||
convertCase := func(s string) string { return s }
|
||||
if len(toComplete) > 0 && unicode.IsLower(rune(toComplete[0])) {
|
||||
@@ -1233,14 +1233,14 @@ func AutocompleteStopSignal(cmd *cobra.Command, args []string, toComplete string
|
||||
|
||||
// AutocompleteSystemdFlag - Autocomplete systemd flag options.
|
||||
// -> "true", "false", "always"
|
||||
func AutocompleteSystemdFlag(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteSystemdFlag(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
systemd := []string{"true", "false", "always"}
|
||||
return systemd, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteUserFlag - Autocomplete user flag based on the names and groups (includes ids after first char) in /etc/passwd and /etc/group files.
|
||||
// -> user:group
|
||||
func AutocompleteUserFlag(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteUserFlag(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if strings.Contains(toComplete, ":") {
|
||||
// It would be nice to read the file in the image
|
||||
// but at this point we don't know the image.
|
||||
@@ -1296,7 +1296,7 @@ func AutocompleteUserFlag(cmd *cobra.Command, args []string, toComplete string)
|
||||
|
||||
// AutocompleteMountFlag - Autocomplete mount flag options.
|
||||
// -> "type=bind,", "type=volume,", "type=tmpfs,"
|
||||
func AutocompleteMountFlag(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteMountFlag(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{"type=bind,", "type=volume,", "type=tmpfs,"}
|
||||
// TODO: Add support for all different options
|
||||
return types, cobra.ShellCompDirectiveNoSpace
|
||||
@@ -1304,7 +1304,7 @@ func AutocompleteMountFlag(cmd *cobra.Command, args []string, toComplete string)
|
||||
|
||||
// AutocompleteVolumeFlag - Autocomplete volume flag options.
|
||||
// -> volumes and paths
|
||||
func AutocompleteVolumeFlag(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteVolumeFlag(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
volumes, _ := getVolumes(cmd, toComplete)
|
||||
directive := cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveDefault
|
||||
if strings.Contains(toComplete, ":") {
|
||||
@@ -1315,7 +1315,7 @@ func AutocompleteVolumeFlag(cmd *cobra.Command, args []string, toComplete string
|
||||
}
|
||||
|
||||
// AutocompleteNetworkFlag - Autocomplete network flag options.
|
||||
func AutocompleteNetworkFlag(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteNetworkFlag(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"container:": func(s string) ([]string, cobra.ShellCompDirective) { return getContainers(cmd, s, completeDefault) },
|
||||
"ns:": func(_ string) ([]string, cobra.ShellCompDirective) {
|
||||
@@ -1589,7 +1589,7 @@ func getMethodNames(f reflect.Value, prefix string) []formatSuggestion {
|
||||
|
||||
// AutocompleteEventFilter - Autocomplete event filter flag options.
|
||||
// -> "container=", "event=", "image=", "pod=", "volume=", "type="
|
||||
func AutocompleteEventFilter(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteEventFilter(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
event := func(_ string) ([]string, cobra.ShellCompDirective) {
|
||||
return []string{events.Attach.String(), events.AutoUpdate.String(), events.Checkpoint.String(), events.Cleanup.String(),
|
||||
events.Commit.String(), events.Create.String(), events.Exec.String(), events.ExecDied.String(),
|
||||
@@ -1621,39 +1621,39 @@ func AutocompleteEventFilter(cmd *cobra.Command, args []string, toComplete strin
|
||||
|
||||
// AutocompleteSystemdRestartOptions - Autocomplete systemd restart options.
|
||||
// -> "no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort", "always"
|
||||
func AutocompleteSystemdRestartOptions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteSystemdRestartOptions(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return systemdDefine.RestartPolicies, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteTrustType - Autocomplete trust type options.
|
||||
// -> "signedBy", "accept", "reject"
|
||||
func AutocompleteTrustType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteTrustType(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{"signedBy", "accept", "reject"}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteImageSort - Autocomplete images sort options.
|
||||
// -> "created", "id", "repository", "size", "tag"
|
||||
func AutocompleteImageSort(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteImageSort(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
sortBy := []string{"created", "id", "repository", "size", "tag"}
|
||||
return sortBy, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteInspectType - Autocomplete inspect type options.
|
||||
func AutocompleteInspectType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteInspectType(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{AllType, ContainerType, ImageType, NetworkType, PodType, VolumeType}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteManifestFormat - Autocomplete manifest format options.
|
||||
// -> "oci", "v2s2"
|
||||
func AutocompleteManifestFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteManifestFormat(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{"oci", "v2s2"}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteNetworkDriver - Autocomplete network driver option.
|
||||
func AutocompleteNetworkDriver(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteNetworkDriver(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
engine, err := setupContainerEngine(cmd)
|
||||
if err != nil {
|
||||
cobra.CompErrorln(err.Error())
|
||||
@@ -1669,14 +1669,14 @@ func AutocompleteNetworkDriver(cmd *cobra.Command, args []string, toComplete str
|
||||
|
||||
// AutocompleteNetworkIPAMDriver - Autocomplete network ipam driver option.
|
||||
// -> "bridge", "macvlan"
|
||||
func AutocompleteNetworkIPAMDriver(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteNetworkIPAMDriver(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
drivers := []string{types.HostLocalIPAMDriver, types.DHCPIPAMDriver, types.NoneIPAMDriver}
|
||||
return drivers, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompletePodShareNamespace - Autocomplete pod create --share flag option.
|
||||
// -> "ipc", "net", "pid", "user", "uts", "cgroup", "none"
|
||||
func AutocompletePodShareNamespace(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompletePodShareNamespace(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
namespaces := []string{"ipc", "net", "pid", "user", "uts", "cgroup", "none"}
|
||||
split := strings.Split(toComplete, ",")
|
||||
split[len(split)-1] = ""
|
||||
@@ -1686,26 +1686,26 @@ func AutocompletePodShareNamespace(cmd *cobra.Command, args []string, toComplete
|
||||
|
||||
// AutocompletePodPsSort - Autocomplete images sort options.
|
||||
// -> "created", "id", "name", "status", "number"
|
||||
func AutocompletePodPsSort(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompletePodPsSort(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
sortBy := []string{"created", "id", "name", "status", "number"}
|
||||
return sortBy, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompletePsSort - Autocomplete images sort options.
|
||||
// -> "command", "created", "id", "image", "names", "runningfor", "size", "status"
|
||||
func AutocompletePsSort(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompletePsSort(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
sortBy := []string{"command", "created", "id", "image", "names", "runningfor", "size", "status"}
|
||||
return sortBy, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteImageSaveFormat - Autocomplete image save format options.
|
||||
func AutocompleteImageSaveFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteImageSaveFormat(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return ValidSaveFormats, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteWaitCondition - Autocomplete wait condition options.
|
||||
// -> "unknown", "configured", "created", "running", "stopped", "paused", "exited", "removing"
|
||||
func AutocompleteWaitCondition(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteWaitCondition(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
states := []string{"unknown", "configured", "created", "exited",
|
||||
"healthy", "initialized", "paused", "removing", "running",
|
||||
"stopped", "stopping", "unhealthy"}
|
||||
@@ -1714,13 +1714,13 @@ func AutocompleteWaitCondition(cmd *cobra.Command, args []string, toComplete str
|
||||
|
||||
// AutocompleteCgroupManager - Autocomplete cgroup manager options.
|
||||
// -> "cgroupfs", "systemd"
|
||||
func AutocompleteCgroupManager(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteCgroupManager(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{config.CgroupfsCgroupsManager, config.SystemdCgroupsManager}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteContainersConfModules- Autocomplete containers.conf modules.
|
||||
func AutocompleteContainersConfModules(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteContainersConfModules(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
dirs, err := config.ModuleDirectories()
|
||||
if err != nil {
|
||||
return nil, cobra.ShellCompDirectiveDefault
|
||||
@@ -1753,27 +1753,27 @@ func AutocompleteContainersConfModules(cmd *cobra.Command, args []string, toComp
|
||||
|
||||
// AutocompleteEventBackend - Autocomplete event backend options.
|
||||
// -> "file", "journald", "none"
|
||||
func AutocompleteEventBackend(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteEventBackend(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{events.LogFile.String(), events.Journald.String(), events.Null.String()}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteNetworkBackend - Autocomplete network backend options.
|
||||
// -> "cni", "netavark"
|
||||
func AutocompleteNetworkBackend(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteNetworkBackend(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{string(types.CNI), string(types.Netavark)}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteLogLevel - Autocomplete log level options.
|
||||
// -> "trace", "debug", "info", "warn", "error", "fatal", "panic"
|
||||
func AutocompleteLogLevel(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteLogLevel(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return LogLevels, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteSDNotify - Autocomplete sdnotify options.
|
||||
// -> "container", "conmon", "ignore"
|
||||
func AutocompleteSDNotify(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteSDNotify(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{define.SdNotifyModeConmon, define.SdNotifyModeContainer, define.SdNotifyModeHealthy, define.SdNotifyModeIgnore}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
@@ -1781,7 +1781,7 @@ func AutocompleteSDNotify(cmd *cobra.Command, args []string, toComplete string)
|
||||
var containerStatuses = []string{"created", "running", "paused", "stopped", "exited", "unknown"}
|
||||
|
||||
// AutocompletePsFilters - Autocomplete ps filter options.
|
||||
func AutocompletePsFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompletePsFilters(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"ancestor=": func(s string) ([]string, cobra.ShellCompDirective) { return getImages(cmd, s) },
|
||||
"before=": func(s string) ([]string, cobra.ShellCompDirective) { return getContainers(cmd, s, completeDefault) },
|
||||
@@ -1807,7 +1807,7 @@ func AutocompletePsFilters(cmd *cobra.Command, args []string, toComplete string)
|
||||
}
|
||||
|
||||
// AutocompleteQuadletFilters - Autocomplete quadlet filter options.
|
||||
func AutocompleteQuadletFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteQuadletFilters(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"name=": func(s string) ([]string, cobra.ShellCompDirective) { return getQuadlets(cmd, s) },
|
||||
}
|
||||
@@ -1815,7 +1815,7 @@ func AutocompleteQuadletFilters(cmd *cobra.Command, args []string, toComplete st
|
||||
}
|
||||
|
||||
// AutocompletePodPsFilters - Autocomplete pod ps filter options.
|
||||
func AutocompletePodPsFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompletePodPsFilters(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"ctr-ids=": func(s string) ([]string, cobra.ShellCompDirective) { return getContainers(cmd, s, completeIDs) },
|
||||
"ctr-names=": func(s string) ([]string, cobra.ShellCompDirective) { return getContainers(cmd, s, completeNames) },
|
||||
@@ -1837,7 +1837,7 @@ func AutocompletePodPsFilters(cmd *cobra.Command, args []string, toComplete stri
|
||||
}
|
||||
|
||||
// AutocompleteImageFilters - Autocomplete image ls --filter options.
|
||||
func AutocompleteImageFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteImageFilters(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
getImg := func(s string) ([]string, cobra.ShellCompDirective) { return getImages(cmd, s) }
|
||||
kv := keyValueCompletion{
|
||||
"after=": getImg,
|
||||
@@ -1858,7 +1858,7 @@ func AutocompleteImageFilters(cmd *cobra.Command, args []string, toComplete stri
|
||||
}
|
||||
|
||||
// AutocompletePruneFilters - Autocomplete container/image prune --filter options.
|
||||
func AutocompletePruneFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompletePruneFilters(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"label=": nil,
|
||||
"until=": nil,
|
||||
@@ -1867,7 +1867,7 @@ func AutocompletePruneFilters(cmd *cobra.Command, args []string, toComplete stri
|
||||
}
|
||||
|
||||
// AutocompleteNetworkFilters - Autocomplete network ls --filter options.
|
||||
func AutocompleteNetworkFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteNetworkFilters(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"dangling=": getBoolCompletion,
|
||||
"driver=": func(_ string) ([]string, cobra.ShellCompDirective) {
|
||||
@@ -1882,7 +1882,7 @@ func AutocompleteNetworkFilters(cmd *cobra.Command, args []string, toComplete st
|
||||
}
|
||||
|
||||
// AutocompleteNetworkInterfaceNames - Autocomplete network create --interface-name options.
|
||||
func AutocompleteNetworkInterfaceNames(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteNetworkInterfaceNames(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
interfaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
cobra.CompErrorln(err.Error())
|
||||
@@ -1896,7 +1896,7 @@ func AutocompleteNetworkInterfaceNames(cmd *cobra.Command, args []string, toComp
|
||||
}
|
||||
|
||||
// AutocompleteVolumeFilters - Autocomplete volume ls --filter options.
|
||||
func AutocompleteVolumeFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteVolumeFilters(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
local := func(_ string) ([]string, cobra.ShellCompDirective) {
|
||||
return []string{"local"}, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
@@ -1916,7 +1916,7 @@ func AutocompleteVolumeFilters(cmd *cobra.Command, args []string, toComplete str
|
||||
}
|
||||
|
||||
// AutocompleteSecretFilters - Autocomplete secret ls --filter options.
|
||||
func AutocompleteSecretFilters(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteSecretFilters(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
kv := keyValueCompletion{
|
||||
"id=": func(s string) ([]string, cobra.ShellCompDirective) { return getSecrets(cmd, s, completeIDs) },
|
||||
"name=": func(s string) ([]string, cobra.ShellCompDirective) { return getSecrets(cmd, s, completeNames) },
|
||||
@@ -1926,13 +1926,13 @@ func AutocompleteSecretFilters(cmd *cobra.Command, args []string, toComplete str
|
||||
|
||||
// AutocompleteCheckpointCompressType - Autocomplete checkpoint compress type options.
|
||||
// -> "gzip", "none", "zstd"
|
||||
func AutocompleteCheckpointCompressType(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteCheckpointCompressType(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{"gzip", "none", "zstd"}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteCompressionFormat - Autocomplete compression-format type options.
|
||||
func AutocompleteCompressionFormat(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteCompressionFormat(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
types := []string{"gzip", "zstd", "zstd:chunked"}
|
||||
return types, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
@@ -1966,12 +1966,12 @@ func AutocompleteSSH(cmd *cobra.Command, args []string, toComplete string) ([]st
|
||||
}
|
||||
|
||||
// AutocompleteHealthOnFailure - action to take once the container turns unhealthy.
|
||||
func AutocompleteHealthOnFailure(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteHealthOnFailure(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return define.SupportedHealthCheckOnFailureActions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteSysctl - autocomplete list all sysctl names
|
||||
func AutocompleteSysctl(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func AutocompleteSysctl(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
var completions []string
|
||||
sysPath := "/proc/sys"
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ func init() {
|
||||
registry.Commands = append(registry.Commands, registry.CliCommand{Command: composeCommand})
|
||||
}
|
||||
|
||||
func composeCompletion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func composeCompletion(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
var stdout strings.Builder
|
||||
|
||||
args = append(args, toComplete)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/containers/podman/v5/pkg/machine/define"
|
||||
)
|
||||
|
||||
func extractConnectionString(podmanSocket *define.VMFile, podmanPipe *define.VMFile) (string, error) {
|
||||
func extractConnectionString(podmanSocket *define.VMFile, _ *define.VMFile) (string, error) {
|
||||
if podmanSocket == nil {
|
||||
return "", errors.New("socket of machine is not set")
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/containers/podman/v5/pkg/machine/define"
|
||||
)
|
||||
|
||||
func extractConnectionString(podmanSocket *define.VMFile, podmanPipe *define.VMFile) (string, error) {
|
||||
func extractConnectionString(_ *define.VMFile, podmanPipe *define.VMFile) (string, error) {
|
||||
if podmanPipe == nil {
|
||||
return "", errors.New("pipe of machine is not set")
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ func init() {
|
||||
validate.AddLatestFlag(containerAttachCommand, &attachOpts.Latest)
|
||||
}
|
||||
|
||||
func attach(cmd *cobra.Command, args []string) error {
|
||||
func attach(_ *cobra.Command, args []string) error {
|
||||
if len(args) > 1 || (len(args) == 0 && !attachOpts.Latest) {
|
||||
return errors.New("attach requires the name or id of one running container or the latest flag")
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func init() {
|
||||
validate.AddLatestFlag(cleanupCommand, &cleanupOptions.Latest)
|
||||
}
|
||||
|
||||
func cleanup(cmd *cobra.Command, args []string) error {
|
||||
func cleanup(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
|
||||
@@ -96,7 +96,7 @@ func init() {
|
||||
commitFlags(containerCommitCommand)
|
||||
}
|
||||
|
||||
func commit(cmd *cobra.Command, args []string) error {
|
||||
func commit(_ *cobra.Command, args []string) error {
|
||||
container := strings.TrimPrefix(args[0], "/")
|
||||
if len(args) == 2 {
|
||||
commitOptions.ImageName = args[1]
|
||||
|
||||
@@ -80,7 +80,7 @@ func init() {
|
||||
cpFlags(containerCpCommand)
|
||||
}
|
||||
|
||||
func cp(cmd *cobra.Command, args []string) error {
|
||||
func cp(_ *cobra.Command, args []string) error {
|
||||
// Parse user input.
|
||||
sourceContainerStr, sourcePath, destContainerStr, destPath, err := copy.ParseSourceAndDestination(args[0], args[1])
|
||||
if err != nil {
|
||||
|
||||
@@ -68,7 +68,7 @@ func init() {
|
||||
exportFlags(containerExportCommand)
|
||||
}
|
||||
|
||||
func export(cmd *cobra.Command, args []string) error {
|
||||
func export(_ *cobra.Command, args []string) error {
|
||||
if len(outputFile) == 0 {
|
||||
file := os.Stdout
|
||||
if term.IsTerminal(int(file.Fd())) {
|
||||
|
||||
@@ -65,7 +65,7 @@ func init() {
|
||||
validate.AddLatestFlag(containerInitCommand, &initOptions.Latest)
|
||||
}
|
||||
|
||||
func initContainer(cmd *cobra.Command, args []string) error {
|
||||
func initContainer(_ *cobra.Command, args []string) error {
|
||||
var errs utils.OutputErrors
|
||||
args = utils.RemoveSlash(args)
|
||||
report, err := registry.ContainerEngine().ContainerInit(registry.Context(), args, initOptions)
|
||||
|
||||
@@ -40,7 +40,7 @@ func init() {
|
||||
validate.AddLatestFlag(inspectCmd, &inspectOpts.Latest)
|
||||
}
|
||||
|
||||
func inspectExec(cmd *cobra.Command, args []string) error {
|
||||
func inspectExec(_ *cobra.Command, args []string) error {
|
||||
// Force container type
|
||||
inspectOpts.Type = common.ContainerType
|
||||
return inspect.Inspect(args, *inspectOpts)
|
||||
|
||||
@@ -86,7 +86,7 @@ func init() {
|
||||
validate.AddLatestFlag(containerPauseCommand, &pauseOpts.Latest)
|
||||
}
|
||||
|
||||
func pause(cmd *cobra.Command, args []string) error {
|
||||
func pause(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
|
||||
@@ -46,7 +46,7 @@ func init() {
|
||||
_ = pruneCommand.RegisterFlagCompletionFunc(filterFlagName, common.AutocompletePruneFilters)
|
||||
}
|
||||
|
||||
func prune(cmd *cobra.Command, _ []string) error {
|
||||
func prune(_ *cobra.Command, _ []string) error {
|
||||
var (
|
||||
pruneOptions = entities.ContainerPruneOptions{}
|
||||
err error
|
||||
|
||||
@@ -44,7 +44,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func rename(cmd *cobra.Command, args []string) error {
|
||||
func rename(_ *cobra.Command, args []string) error {
|
||||
if len(args) > 2 {
|
||||
return errors.New("must provide at least two arguments to rename")
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ func init() {
|
||||
validate.AddLatestFlag(containerStartCommand, &startOptions.Latest)
|
||||
}
|
||||
|
||||
func validateStart(cmd *cobra.Command, args []string) error {
|
||||
func validateStart(_ *cobra.Command, args []string) error {
|
||||
if len(args) == 0 && !startOptions.Latest && !startOptions.All && len(filters) < 1 {
|
||||
return errors.New("start requires at least one argument")
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func init() {
|
||||
|
||||
// stats is different in that it will assume running containers if
|
||||
// no input is given, so we need to validate differently
|
||||
func checkStatOptions(cmd *cobra.Command, args []string) error {
|
||||
func checkStatOptions(_ *cobra.Command, args []string) error {
|
||||
opts := 0
|
||||
if statsOptions.All {
|
||||
opts++
|
||||
|
||||
@@ -76,7 +76,7 @@ func init() {
|
||||
validate.AddLatestFlag(containerUnmountCommand, &unmountOpts.Latest)
|
||||
}
|
||||
|
||||
func unmount(cmd *cobra.Command, args []string) error {
|
||||
func unmount(_ *cobra.Command, args []string) error {
|
||||
var errs utils.OutputErrors
|
||||
args = utils.RemoveSlash(args)
|
||||
reports, err := registry.ContainerEngine().ContainerUnmount(registry.Context(), args, unmountOpts)
|
||||
|
||||
@@ -87,7 +87,7 @@ func init() {
|
||||
validate.AddLatestFlag(containerUnpauseCommand, &unpauseOpts.Latest)
|
||||
}
|
||||
|
||||
func unpause(cmd *cobra.Command, args []string) error {
|
||||
func unpause(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func create(cmd *cobra.Command, args []string) error {
|
||||
func create(_ *cobra.Command, args []string) error {
|
||||
farmName := args[0]
|
||||
connections := args[1:]
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ func init() {
|
||||
flags.BoolVarP(&rmOpts.All, "all", "a", false, "Remove all farms")
|
||||
}
|
||||
|
||||
func rm(cmd *cobra.Command, args []string) error {
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
deletedFarms := []string{}
|
||||
err := config.EditConnectionConfig(func(cfg *config.ConnectionsFile) error {
|
||||
if rmOpts.All {
|
||||
|
||||
@@ -49,7 +49,7 @@ func init() {
|
||||
flags.SetNormalizeFunc(utils.AliasFlags)
|
||||
}
|
||||
|
||||
func spec(cmd *cobra.Command, args []string) error {
|
||||
func spec(_ *cobra.Command, args []string) error {
|
||||
opts.ID = args[0]
|
||||
report, err := registry.ContainerEngine().GenerateSpec(registry.Context(), opts)
|
||||
if err != nil {
|
||||
|
||||
@@ -30,7 +30,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func run(cmd *cobra.Command, args []string) error {
|
||||
func run(_ *cobra.Command, args []string) error {
|
||||
response, err := registry.ContainerEngine().HealthCheckRun(context.Background(), args[0], entities.HealthCheckOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func runBuildxInspect(cmd *cobra.Command, args []string) error {
|
||||
func runBuildxInspect(_ *cobra.Command, _ []string) error {
|
||||
info, err := registry.ContainerEngine().Info(registry.Context())
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -26,7 +26,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func exists(cmd *cobra.Command, args []string) error {
|
||||
func exists(_ *cobra.Command, args []string) error {
|
||||
found, err := registry.ImageEngine().Exists(registry.Context(), args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -94,7 +94,7 @@ func importFlags(cmd *cobra.Command) {
|
||||
}
|
||||
}
|
||||
|
||||
func importCon(cmd *cobra.Command, args []string) error {
|
||||
func importCon(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
source string
|
||||
reference string
|
||||
|
||||
@@ -37,7 +37,7 @@ func init() {
|
||||
_ = inspectCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&inspectTypes.ImageData{}))
|
||||
}
|
||||
|
||||
func inspectExec(cmd *cobra.Command, args []string) error {
|
||||
func inspectExec(_ *cobra.Command, args []string) error {
|
||||
inspectOpts.Type = common.ImageType
|
||||
return inspect.Inspect(args, *inspectOpts)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func loadFlags(cmd *cobra.Command) {
|
||||
}
|
||||
}
|
||||
|
||||
func load(cmd *cobra.Command, args []string) error {
|
||||
func load(_ *cobra.Command, _ []string) error {
|
||||
if len(loadOpts.Input) > 0 {
|
||||
// Download the input file if needed.
|
||||
if strings.HasPrefix(loadOpts.Input, "https://") || strings.HasPrefix(loadOpts.Input, "http://") {
|
||||
|
||||
@@ -55,7 +55,7 @@ func init() {
|
||||
_ = pruneCmd.RegisterFlagCompletionFunc(filterFlagName, common.AutocompletePruneFilters)
|
||||
}
|
||||
|
||||
func prune(cmd *cobra.Command, args []string) error {
|
||||
func prune(_ *cobra.Command, _ []string) error {
|
||||
if !force {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
fmt.Printf("%s", createPruneWarningMessage(pruneOpts))
|
||||
|
||||
@@ -61,7 +61,7 @@ func imageRemoveFlagSet(flags *pflag.FlagSet) {
|
||||
flags.BoolVar(&imageOpts.NoPrune, "no-prune", false, "Do not remove dangling images")
|
||||
}
|
||||
|
||||
func rm(cmd *cobra.Command, args []string) error {
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
if len(args) < 1 && !imageOpts.All {
|
||||
return errors.New("image name or ID must be specified")
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func scpFlags(cmd *cobra.Command) {
|
||||
flags.BoolVarP(&quiet, "quiet", "q", false, "Suppress the output")
|
||||
}
|
||||
|
||||
func scp(cmd *cobra.Command, args []string) (finalErr error) {
|
||||
func scp(_ *cobra.Command, args []string) (finalErr error) {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
|
||||
@@ -44,6 +44,6 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func tag(cmd *cobra.Command, args []string) error {
|
||||
func tag(_ *cobra.Command, args []string) error {
|
||||
return registry.ImageEngine().Tag(registry.Context(), args[0], args[1:], entities.ImageTagOptions{})
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ File(s) must exist before using this command`)
|
||||
_ = setTrustCommand.RegisterFlagCompletionFunc(typeFlagName, common.AutocompleteTrustType)
|
||||
}
|
||||
|
||||
func setTrust(cmd *cobra.Command, args []string) error {
|
||||
func setTrust(_ *cobra.Command, args []string) error {
|
||||
validTrustTypes := []string{"accept", "insecureAcceptAnything", "reject", "signedBy", "sigstoreSigned"}
|
||||
|
||||
valid, err := isValidImageURI(args[0])
|
||||
|
||||
@@ -50,7 +50,7 @@ func init() {
|
||||
unmountFlags(unmountCommand.Flags())
|
||||
}
|
||||
|
||||
func unmount(cmd *cobra.Command, args []string) error {
|
||||
func unmount(_ *cobra.Command, args []string) error {
|
||||
var errs utils.OutputErrors
|
||||
if len(args) < 1 && !unmountOpts.All {
|
||||
return errors.New("image name or ID must be specified")
|
||||
|
||||
@@ -43,6 +43,6 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func untag(cmd *cobra.Command, args []string) error {
|
||||
func untag(_ *cobra.Command, args []string) error {
|
||||
return registry.ImageEngine().Untag(registry.Context(), args[0], args[1:], entities.ImageUntagOptions{})
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func version(cmd *cobra.Command, args []string) error {
|
||||
func version(_ *cobra.Command, _ []string) error {
|
||||
fmt.Printf("%s %s\n", define.Package, define.Version)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -41,6 +41,6 @@ func init() {
|
||||
inspectOpts = inspect.AddInspectFlagSet(inspectCmd)
|
||||
}
|
||||
|
||||
func inspectExec(cmd *cobra.Command, args []string) error {
|
||||
func inspectExec(_ *cobra.Command, args []string) error {
|
||||
return inspect.Inspect(args, *inspectOpts)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func downFlags(cmd *cobra.Command) {
|
||||
flags.BoolVar(&downOptions.Force, "force", false, "remove volumes")
|
||||
}
|
||||
|
||||
func down(cmd *cobra.Command, args []string) error {
|
||||
func down(_ *cobra.Command, args []string) error {
|
||||
reader, err := readerFromArg(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -47,7 +47,7 @@ func init() {
|
||||
}
|
||||
|
||||
// Implementation of podman-logout.
|
||||
func logout(cmd *cobra.Command, args []string) error {
|
||||
func logout(_ *cobra.Command, args []string) error {
|
||||
sysCtx := &types.SystemContext{}
|
||||
common.SetRegistriesConfPath(sysCtx)
|
||||
return auth.Logout(sysCtx, &logoutOptions, args)
|
||||
|
||||
@@ -37,7 +37,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func remoteDirClient(cmd *cobra.Command, args []string) error {
|
||||
func remoteDirClient(_ *cobra.Command, args []string) error {
|
||||
port, err := strconv.Atoi(args[0])
|
||||
if err != nil {
|
||||
return fmt.Errorf("error parsing port number: %w", err)
|
||||
|
||||
@@ -52,7 +52,7 @@ func init() {
|
||||
_ = infoCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&entities.MachineInfo{}))
|
||||
}
|
||||
|
||||
func info(cmd *cobra.Command, args []string) error {
|
||||
func info(cmd *cobra.Command, _ []string) error {
|
||||
info := entities.MachineInfo{}
|
||||
version, err := define.GetVersion()
|
||||
if err != nil {
|
||||
|
||||
@@ -65,7 +65,7 @@ func init() {
|
||||
flags.BoolVar(&listFlag.allProviders, "all-providers", false, "Show machines from all providers")
|
||||
}
|
||||
|
||||
func list(cmd *cobra.Command, args []string) error {
|
||||
func list(cmd *cobra.Command, _ []string) error {
|
||||
var (
|
||||
opts machine.ListOptions
|
||||
err error
|
||||
@@ -91,7 +91,7 @@ func list(cmd *cobra.Command, args []string) error {
|
||||
return listResponse[i].LastUp.After(listResponse[j].LastUp)
|
||||
})
|
||||
// Bring currently running machines to top
|
||||
sort.Slice(listResponse, func(i, j int) bool {
|
||||
sort.Slice(listResponse, func(i, _ int) bool {
|
||||
return listResponse[i].Running
|
||||
})
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func machinePreRunE(c *cobra.Command, args []string) error {
|
||||
}
|
||||
|
||||
// autocompleteMachineSSH - Autocomplete machine ssh command.
|
||||
func autocompleteMachineSSH(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func autocompleteMachineSSH(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) == 0 {
|
||||
return getMachines(toComplete)
|
||||
}
|
||||
@@ -69,7 +69,7 @@ func autocompleteMachineSSH(cmd *cobra.Command, args []string, toComplete string
|
||||
}
|
||||
|
||||
// autocompleteMachineCp - Autocomplete machine cp command.
|
||||
func autocompleteMachineCp(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func autocompleteMachineCp(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) < 2 {
|
||||
if i := strings.IndexByte(toComplete, ':'); i > -1 {
|
||||
// TODO: offer virtual machine path completion
|
||||
@@ -96,7 +96,7 @@ func autocompleteMachineCp(cmd *cobra.Command, args []string, toComplete string)
|
||||
}
|
||||
|
||||
// autocompleteMachine - Autocomplete machines.
|
||||
func autocompleteMachine(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
func autocompleteMachine(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) == 0 {
|
||||
return getMachines(toComplete)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ func isUnixSocket(file os.DirEntry) bool {
|
||||
return file.Type()&os.ModeSocket != 0
|
||||
}
|
||||
|
||||
func rootlessOnly(cmd *cobra.Command, args []string) error {
|
||||
func rootlessOnly(cmd *cobra.Command, _ []string) error {
|
||||
if !rootless.IsRootless() {
|
||||
return fmt.Errorf("cannot run command %q as root", cmd.CommandPath())
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ func isUnixSocket(file os.DirEntry) bool {
|
||||
return !file.Type().IsDir() && strings.HasSuffix(file.Name(), ".sock")
|
||||
}
|
||||
|
||||
func rootlessOnly(cmd *cobra.Command, args []string) error {
|
||||
func rootlessOnly(_ *cobra.Command, _ []string) error {
|
||||
// Rootless is not relevant on Windows. In the future rootless.IsRootless
|
||||
// could be switched to return true on Windows, and other codepaths migrated
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ func init() {
|
||||
flags.BoolVar(&restart, restartFlagName, false, "Restart VM to apply changes")
|
||||
}
|
||||
|
||||
func apply(cmd *cobra.Command, args []string) error {
|
||||
func apply(_ *cobra.Command, args []string) error {
|
||||
vmName := ""
|
||||
if len(args) == 2 {
|
||||
vmName = args[1]
|
||||
|
||||
@@ -46,7 +46,7 @@ var (
|
||||
serveDirs []string
|
||||
)
|
||||
|
||||
func remoteDirServer(cmd *cobra.Command, args []string) error {
|
||||
func remoteDirServer(_ *cobra.Command, args []string) error {
|
||||
pid, err := strconv.Atoi(args[0])
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing PID: %w", err)
|
||||
|
||||
@@ -47,7 +47,7 @@ func init() {
|
||||
|
||||
// TODO Remember that this changed upstream and needs to updated as such!
|
||||
|
||||
func ssh(cmd *cobra.Command, args []string) error {
|
||||
func ssh(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
err error
|
||||
mc *vmconfigs.MachineConfig
|
||||
|
||||
@@ -34,7 +34,7 @@ func init() {
|
||||
}
|
||||
|
||||
// TODO Name shouldn't be required, need to create a default vm
|
||||
func stop(cmd *cobra.Command, args []string) error {
|
||||
func stop(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
|
||||
@@ -89,7 +89,7 @@ func parseCommands() *cobra.Command {
|
||||
}
|
||||
|
||||
// add error message to the command so the user knows that this command is not supported with local/remote
|
||||
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
c.Command.RunE = func(cmd *cobra.Command, _ []string) error {
|
||||
return fmt.Errorf("cannot use command %q with the %s podman client", cmd.CommandPath(), client)
|
||||
}
|
||||
// turn off flag parsing to make we do not get flag errors
|
||||
@@ -110,7 +110,7 @@ func parseCommands() *cobra.Command {
|
||||
_, found := c.Command.Annotations[registry.UnshareNSRequired]
|
||||
if found {
|
||||
if rootless.IsRootless() && os.Getuid() != 0 {
|
||||
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
c.Command.RunE = func(cmd *cobra.Command, _ []string) error {
|
||||
return fmt.Errorf("cannot run command %q in rootless mode, must execute `podman unshare` first", cmd.CommandPath())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func init() {
|
||||
_ = annotateCmd.RegisterFlagCompletionFunc(subjectFlagName, completion.AutocompleteNone)
|
||||
}
|
||||
|
||||
func annotate(cmd *cobra.Command, args []string) error {
|
||||
func annotate(_ *cobra.Command, args []string) error {
|
||||
var listImageSpec, instanceSpec string
|
||||
switch len(args) {
|
||||
case 1:
|
||||
|
||||
@@ -25,7 +25,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func exists(cmd *cobra.Command, args []string) error {
|
||||
func exists(_ *cobra.Command, args []string) error {
|
||||
found, err := registry.ImageEngine().ManifestExists(registry.Context(), args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -27,7 +27,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func remove(cmd *cobra.Command, args []string) error {
|
||||
func remove(_ *cobra.Command, args []string) error {
|
||||
updatedListID, err := registry.ImageEngine().ManifestRemoveDigest(registry.Context(), args[0], args[1])
|
||||
if err != nil {
|
||||
return fmt.Errorf("removing from manifest list %s: %w", args[0], err)
|
||||
|
||||
@@ -34,7 +34,7 @@ func init() {
|
||||
flags.BoolVarP(&rmOptions.Ignore, "ignore", "i", false, "Ignore errors when a specified manifest is missing")
|
||||
}
|
||||
|
||||
func rm(cmd *cobra.Command, args []string) error {
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
report, rmErrors := registry.ImageEngine().ManifestRm(context.Background(), args, rmOptions)
|
||||
if report != nil {
|
||||
for _, u := range report.Untagged {
|
||||
|
||||
@@ -58,7 +58,7 @@ func init() {
|
||||
networkConnectFlags(networkConnectCommand)
|
||||
}
|
||||
|
||||
func networkConnect(cmd *cobra.Command, args []string) error {
|
||||
func networkConnect(_ *cobra.Command, args []string) error {
|
||||
networkConnectOptions.Container = args[1]
|
||||
if macAddress != "" {
|
||||
mac, err := net.ParseMAC(macAddress)
|
||||
|
||||
@@ -38,7 +38,7 @@ func init() {
|
||||
networkDisconnectFlags(flags)
|
||||
}
|
||||
|
||||
func networkDisconnect(cmd *cobra.Command, args []string) error {
|
||||
func networkDisconnect(_ *cobra.Command, args []string) error {
|
||||
networkDisconnectOptions.Container = args[1]
|
||||
return registry.ContainerEngine().NetworkDisconnect(registry.Context(), args[0], networkDisconnectOptions)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func networkExists(cmd *cobra.Command, args []string) error {
|
||||
func networkExists(_ *cobra.Command, args []string) error {
|
||||
response, err := registry.ContainerEngine().NetworkExists(registry.Context(), args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -61,7 +61,7 @@ func init() {
|
||||
networkListFlags(flags)
|
||||
}
|
||||
|
||||
func networkList(cmd *cobra.Command, args []string) error {
|
||||
func networkList(cmd *cobra.Command, _ []string) error {
|
||||
var err error
|
||||
networkListOptions.Filters, err = parse.FilterArgumentsIntoFilters(filters)
|
||||
if err != nil {
|
||||
|
||||
@@ -51,7 +51,7 @@ func init() {
|
||||
networkPruneFlags(networkPruneCommand, flags)
|
||||
}
|
||||
|
||||
func networkPrune(cmd *cobra.Command, _ []string) error {
|
||||
func networkPrune(_ *cobra.Command, _ []string) error {
|
||||
var err error
|
||||
if !force {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
|
||||
@@ -46,7 +46,7 @@ func init() {
|
||||
validate.AddLatestFlag(networkReloadCommand, &reloadOptions.Latest)
|
||||
}
|
||||
|
||||
func networkReload(cmd *cobra.Command, args []string) error {
|
||||
func networkReload(_ *cobra.Command, args []string) error {
|
||||
responses, err := registry.ContainerEngine().NetworkReload(registry.Context(), args, reloadOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -45,7 +45,7 @@ func init() {
|
||||
networkUpdateFlags(networkUpdateCommand)
|
||||
}
|
||||
|
||||
func networkUpdate(cmd *cobra.Command, args []string) error {
|
||||
func networkUpdate(_ *cobra.Command, args []string) error {
|
||||
name := args[0]
|
||||
|
||||
err := registry.ContainerEngine().NetworkUpdate(registry.Context(), name, networkUpdateOptions)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package parse
|
||||
|
||||
func ValidateFileName(filename string) error {
|
||||
func ValidateFileName(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func exists(cmd *cobra.Command, args []string) error {
|
||||
func exists(_ *cobra.Command, args []string) error {
|
||||
response, err := registry.ContainerEngine().PodExists(context.Background(), args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -40,7 +40,7 @@ func init() {
|
||||
validate.AddLatestFlag(inspectCmd, &inspectOpts.Latest)
|
||||
}
|
||||
|
||||
func inspectExec(cmd *cobra.Command, args []string) error {
|
||||
func inspectExec(_ *cobra.Command, args []string) error {
|
||||
inspectOpts.Type = common.PodType
|
||||
return inspect.Inspect(args, *inspectOpts)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func init() {
|
||||
flags.BoolVarP(&pruneOptions.Force, "force", "f", false, "Do not prompt for confirmation. The default is false")
|
||||
}
|
||||
|
||||
func prune(cmd *cobra.Command, args []string) error {
|
||||
func prune(_ *cobra.Command, _ []string) error {
|
||||
if !pruneOptions.Force {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
fmt.Println("WARNING! This will remove all stopped/exited pods..")
|
||||
|
||||
@@ -45,7 +45,7 @@ func init() {
|
||||
validate.AddLatestFlag(restartCommand, &restartOptions.Latest)
|
||||
}
|
||||
|
||||
func restart(cmd *cobra.Command, args []string) error {
|
||||
func restart(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
|
||||
@@ -57,7 +57,7 @@ func init() {
|
||||
validate.AddLatestFlag(startCommand, &startOptions.Latest)
|
||||
}
|
||||
|
||||
func start(cmd *cobra.Command, args []string) error {
|
||||
func start(_ *cobra.Command, args []string) error {
|
||||
var errs utils.OutputErrors
|
||||
|
||||
ids, err := specgenutil.ReadPodIDFiles(startOptions.PodIDFiles)
|
||||
|
||||
@@ -46,7 +46,7 @@ func init() {
|
||||
installFlags(quadletInstallCmd)
|
||||
}
|
||||
|
||||
func install(cmd *cobra.Command, args []string) error {
|
||||
func install(_ *cobra.Command, args []string) error {
|
||||
var errs utils.OutputErrors
|
||||
installReport, err := registry.ContainerEngine().QuadletInstall(registry.Context(), args, installOptions)
|
||||
if err != nil {
|
||||
|
||||
@@ -51,7 +51,7 @@ func init() {
|
||||
listFlags(quadletListCmd)
|
||||
}
|
||||
|
||||
func list(cmd *cobra.Command, args []string) error {
|
||||
func list(cmd *cobra.Command, _ []string) error {
|
||||
quadlets, err := registry.ContainerEngine().QuadletList(registry.Context(), listOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -31,7 +31,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func print(cmd *cobra.Command, args []string) error {
|
||||
func print(_ *cobra.Command, args []string) error {
|
||||
quadletContents, err := registry.ContainerEngine().QuadletPrint(registry.Context(), args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -45,7 +45,7 @@ func init() {
|
||||
rmFlags(quadletRmCmd)
|
||||
}
|
||||
|
||||
func rm(cmd *cobra.Command, args []string) error {
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
if len(args) < 1 && !removeOptions.All {
|
||||
return errors.New("at least one quadlet file must be selected")
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func ImageEngine() entities.ImageEngine {
|
||||
}
|
||||
|
||||
// NewImageEngine is a wrapper for building an ImageEngine to be used for PreRunE functions
|
||||
func NewImageEngine(cmd *cobra.Command, args []string) (entities.ImageEngine, error) {
|
||||
func NewImageEngine(cmd *cobra.Command, _ []string) (entities.ImageEngine, error) {
|
||||
if imageEngine == nil {
|
||||
podmanOptions.FlagSet = cmd.Flags()
|
||||
engine, err := infra.NewImageEngine(&podmanOptions)
|
||||
@@ -61,7 +61,7 @@ func ContainerEngine() entities.ContainerEngine {
|
||||
}
|
||||
|
||||
// NewContainerEngine is a wrapper for building a ContainerEngine to be used for PreRunE functions
|
||||
func NewContainerEngine(cmd *cobra.Command, args []string) (entities.ContainerEngine, error) {
|
||||
func NewContainerEngine(cmd *cobra.Command, _ []string) (entities.ContainerEngine, error) {
|
||||
if containerEngine == nil {
|
||||
podmanOptions.FlagSet = cmd.Flags()
|
||||
if cmd.Name() == "reset" && cmd.Parent().Name() == "system" {
|
||||
|
||||
@@ -108,7 +108,7 @@ func init() {
|
||||
rootFlags(rootCmd, registry.PodmanConfig())
|
||||
|
||||
// backwards compat still allow --cni-config-dir
|
||||
rootCmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||
rootCmd.Flags().SetNormalizeFunc(func(_ *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||
if name == "cni-config-dir" {
|
||||
name = "network-config-dir"
|
||||
}
|
||||
@@ -406,7 +406,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func persistentPostRunE(cmd *cobra.Command, args []string) error {
|
||||
func persistentPostRunE(cmd *cobra.Command, _ []string) error {
|
||||
logrus.Debugf("Called %s.PersistentPostRunE(%s)", cmd.Name(), strings.Join(os.Args, " "))
|
||||
|
||||
if registry.IsRemote() {
|
||||
|
||||
@@ -64,7 +64,7 @@ func init() {
|
||||
_ = createCmd.RegisterFlagCompletionFunc(labelFlagName, completion.AutocompleteNone)
|
||||
}
|
||||
|
||||
func create(cmd *cobra.Command, args []string) error {
|
||||
func create(_ *cobra.Command, args []string) error {
|
||||
name := args[0]
|
||||
|
||||
// Validate that --ignore and --replace are not used together
|
||||
|
||||
@@ -26,7 +26,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func exists(cmd *cobra.Command, args []string) error {
|
||||
func exists(_ *cobra.Command, args []string) error {
|
||||
found, err := registry.ContainerEngine().SecretExists(registry.Context(), args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -60,7 +60,7 @@ func init() {
|
||||
flags.BoolVarP(&listFlag.quiet, quietFlagName, "q", false, "Print secret IDs only")
|
||||
}
|
||||
|
||||
func ls(cmd *cobra.Command, args []string) error {
|
||||
func ls(cmd *cobra.Command, _ []string) error {
|
||||
var err error
|
||||
lsOpts := entities.SecretListRequest{}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ var (
|
||||
rmOptions = entities.SecretRmOptions{}
|
||||
)
|
||||
|
||||
func rm(cmd *cobra.Command, args []string) error {
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
var (
|
||||
errs utils.OutputErrors
|
||||
)
|
||||
|
||||
@@ -46,7 +46,7 @@ func checkCommand(t *testing.T, cmd *cobra.Command) {
|
||||
// loop over all local flags
|
||||
cmd.LocalFlags().VisitAll(func(flag *pflag.Flag) {
|
||||
// an error means that there is a completion function for this flag
|
||||
err := cmd.RegisterFlagCompletionFunc(flag.Name, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
err := cmd.RegisterFlagCompletionFunc(flag.Name, func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||
return nil, cobra.ShellCompDirectiveDefault
|
||||
})
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ func init() {
|
||||
_ = checkCommand.RegisterFlagCompletionFunc("max", completion.AutocompleteNone)
|
||||
}
|
||||
|
||||
func check(cmd *cobra.Command, args []string) error {
|
||||
func check(cmd *cobra.Command, _ []string) error {
|
||||
flags := cmd.Flags()
|
||||
if flags.Changed("max") {
|
||||
maxAge, err := flags.GetDuration("max")
|
||||
|
||||
@@ -243,7 +243,7 @@ func add(cmd *cobra.Command, args []string) error {
|
||||
})
|
||||
}
|
||||
|
||||
func create(cmd *cobra.Command, args []string) error {
|
||||
func create(_ *cobra.Command, args []string) error {
|
||||
dest, err := translateDest(dockerPath)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -44,7 +44,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func defaultRunE(cmd *cobra.Command, args []string) error {
|
||||
func defaultRunE(_ *cobra.Command, args []string) error {
|
||||
connection := args[0]
|
||||
return config.EditConnectionConfig(func(cfg *config.ConnectionsFile) error {
|
||||
if _, found := cfg.Connection.Connections[connection]; !found {
|
||||
|
||||
@@ -52,7 +52,7 @@ func init() {
|
||||
_ = flags.MarkHidden("force")
|
||||
}
|
||||
|
||||
func rm(cmd *cobra.Command, args []string) error {
|
||||
func rm(_ *cobra.Command, args []string) error {
|
||||
return config.EditConnectionConfig(func(cfg *config.ConnectionsFile) error {
|
||||
if rmOpts.All {
|
||||
cfg.Connection.Connections = nil
|
||||
|
||||
@@ -32,7 +32,7 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func rename(cmd *cobra.Command, args []string) error {
|
||||
func rename(_ *cobra.Command, args []string) error {
|
||||
return config.EditConnectionConfig(func(cfg *config.ConnectionsFile) error {
|
||||
if _, found := cfg.Connection.Connections[args[0]]; !found {
|
||||
return fmt.Errorf("%q destination is not defined. See \"podman system connection add ...\" to create a connection", args[0])
|
||||
|
||||
@@ -51,7 +51,7 @@ func init() {
|
||||
_ = dfSystemCommand.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&dfSummary{}))
|
||||
}
|
||||
|
||||
func df(cmd *cobra.Command, args []string) error {
|
||||
func df(cmd *cobra.Command, _ []string) error {
|
||||
reports, err := registry.ContainerEngine().SystemDf(registry.Context(), dfOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -21,7 +21,7 @@ var (
|
||||
Short: "Proxy the stdio stream to the daemon connection. Should not be invoked manually.",
|
||||
Args: validate.NoArgs,
|
||||
Hidden: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return runDialStdio()
|
||||
},
|
||||
Example: "podman system dial-stdio",
|
||||
|
||||
@@ -74,7 +74,7 @@ func infoFlags(cmd *cobra.Command) {
|
||||
_ = cmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&define.Info{}))
|
||||
}
|
||||
|
||||
func info(cmd *cobra.Command, args []string) error {
|
||||
func info(cmd *cobra.Command, _ []string) error {
|
||||
info, err := registry.ContainerEngine().Info(registry.Context())
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -14,7 +14,7 @@ var (
|
||||
Short: "Debug Libpod's use of locks, identifying any potential conflicts",
|
||||
Args: validate.NoArgs,
|
||||
Hidden: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
return runLocks()
|
||||
},
|
||||
Example: "podman system locks",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user