From c8b71073477c0167174ac9b5db50c90e496c2d78 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Thu, 16 May 2024 10:28:13 +0800 Subject: [PATCH] refactor: add some comments Signed-off-by: Jack Yu --- cmd/manager.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/manager.go b/cmd/manager.go index fdde9555..b22e3a1f 100644 --- a/cmd/manager.go +++ b/cmd/manager.go @@ -59,10 +59,11 @@ func init() { managerCmd.PersistentFlags().StringSliceVar(&sbm.BundleCollectors, "extra-collectors", getEnvStringSlice("SUPPORT_BUNDLE_EXTRA_COLLECTORS"), "Get extra resource for the specific components e.g., harvester") managerCmd.PersistentFlags().StringVar(&sbm.Description, "description", os.Getenv("SUPPORT_BUNDLE_DESCRIPTION"), "The support bundle description") managerCmd.PersistentFlags().StringVar(&sbm.IssueURL, "issue-url", os.Getenv("SUPPORT_BUNDLE_ISSUE_URL"), "The support bundle issue url") - managerCmd.PersistentFlags().DurationVar(&sbm.NodeTimeout, "node-timeout", parseNodeTimeout(os.Getenv("SUPPORT_BUNDLE_NODE_TIMEOUT")), "The support bundle node collection time out") + managerCmd.PersistentFlags().DurationVar(&sbm.NodeTimeout, "node-timeout", parseDurationString(os.Getenv("SUPPORT_BUNDLE_NODE_TIMEOUT")), "The support bundle node collection time out") } -func parseNodeTimeout(value string) time.Duration { +// parseDurationString could parse `1s` and `10m` duration string. +func parseDurationString(value string) time.Duration { if value == "" { return 0 }