Use contMask to ignore categories beginning with . by default

This commit is contained in:
Joel Elkins 2022-11-01 15:36:51 -05:00
parent 34a209f336
commit 60a3ba71bb
Signed by: joel
GPG Key ID: 133589DC38921AE2
1 changed files with 6 additions and 4 deletions

View File

@ -47,10 +47,6 @@ from a toml configuration file, and the utility uses this information to
execute the necessary podman commands.`,
ValidArgsFunction: cobra.NoFileCompletions,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
if !incDisabled {
contMask = []string{"."}
}
requireConn := []string{"create", "pull", "recreate", "restart", "rm", "start", "stop", "update"}
if slices.Contains(requireConn, cmd.Name()) {
// connect to podman
@ -63,6 +59,12 @@ execute the necessary podman commands.`,
err := config.Init(conn)
if err != nil {
fmt.Fprintln(os.Stderr, "Warning: Could not initialize configuration:", err)
} else if !incDisabled {
for _, c := range config.Categories() {
if len(c) > 0 && c[0] == '.' {
contMask = append(contMask, c)
}
}
}
},
}