Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FileCmd = &cobra.Command{ Use: "file", Short: "searches the files which has desired file name pattern in it (supports regex)", SilenceUsage: true, SilenceErrors: true, Example: `# search a file on target bucket by specifying regex for files s3-manager search file ".*.json" `, PreRunE: func(cmd *cobra.Command, args []string) error { svc, searchOpts, logger = utils.PrepareConstants(cmd, options.GetSearchOptions()) if err := utils.CheckFlags(args); err != nil { logger.Error().Msg(err.Error()) return err } searchOpts.FileName = args[0] return nil }, RunE: func(cmd *cobra.Command, args []string) (err error) { files, err := aws.GetDesiredFiles(svc, searchOpts) if err != nil { logger.Error(). Str("fileName", searchOpts.FileName). Str("error", err.Error()). Msg("an error occurred while fetching desired files") return err } if len(files) == 0 { logger.Warn(). Str("fileName", searchOpts.FileName). Msg("no file found with the specified fileName or pattern") return nil } for _, v := range files { fmt.Println(v) } return nil }, } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.