spiegel_podman/cmd/podman/networks/update.go
Erik Sjölund de92db0c81 man pages and command help: clean up descriptions
Short description in man pages:
* Use imperative form

Command help (cobra.Command.Short):
* Capitalize first letter
* Use imperative form
* Remove ending full stop when the short description
  only contains one sentence without any commas

Command help (cobra.Command.Long):
* Capitalize first letter unless the sentence starts
  with a command "podman command ..."
* Use imperative form when the long description is
  identical or almost identical to the short description.
  This modification was only done in a few places.

Command tables:
* Use imperative form in the "Description" column

[NO NEW TESTS NEEDED]

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
2023-05-28 18:57:43 +02:00

57 lines
1.7 KiB
Go

package network
import (
"fmt"
"github.com/containers/common/pkg/completion"
"github.com/containers/podman/v4/cmd/podman/common"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/spf13/cobra"
)
var (
networkUpdateDescription = `Update an existing podman network`
networkUpdateCommand = &cobra.Command{
Use: "update [options] NETWORK",
Short: "Update an existing podman network",
Long: networkUpdateDescription,
RunE: networkUpdate,
Args: cobra.ExactArgs(1),
ValidArgsFunction: common.AutocompleteNetworks,
Example: `podman network update podman1`,
}
)
var (
networkUpdateOptions entities.NetworkUpdateOptions
)
func networkUpdateFlags(cmd *cobra.Command) {
flags := cmd.Flags()
addDNSServerFlagName := "dns-add"
flags.StringSliceVar(&networkUpdateOptions.AddDNSServers, addDNSServerFlagName, nil, "add network level nameservers")
removeDNSServerFlagName := "dns-drop"
flags.StringSliceVar(&networkUpdateOptions.RemoveDNSServers, removeDNSServerFlagName, nil, "remove network level nameservers")
_ = cmd.RegisterFlagCompletionFunc(addDNSServerFlagName, completion.AutocompleteNone)
_ = cmd.RegisterFlagCompletionFunc(removeDNSServerFlagName, completion.AutocompleteNone)
}
func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: networkUpdateCommand,
Parent: networkCmd,
})
networkUpdateFlags(networkUpdateCommand)
}
func networkUpdate(cmd *cobra.Command, args []string) error {
name := args[0]
err := registry.ContainerEngine().NetworkUpdate(registry.Context(), name, networkUpdateOptions)
if err != nil {
return err
}
fmt.Println(name)
return nil
}