[NEW] selfupdate

This commit is contained in:
2022-09-11 15:31:16 +02:00
parent 713f7196cf
commit 0102407606
3 changed files with 100 additions and 10 deletions

View File

@@ -15,14 +15,10 @@ import (
// listCmd represents the list command
var listCmd = &cobra.Command{
Use: "list",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Use: "list <bucket>",
Short: "List bucket contents",
Long: `This command lists the content of specified bucket`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
isps3 := util.S3{
Endpoint: "isp-dev.paasdev.sk:9000",
@@ -36,7 +32,14 @@ to quickly create a Cobra application.`,
}
ctx := context.Background()
objectCh := isps3.Client.ListObjects(ctx, "test", minio.ListObjectsOptions{
found, err := isps3.Client.BucketExists(ctx, args[0])
if err != nil {
return err
}
if !found {
return fmt.Errorf("bucket %q does not exist", args[0])
}
objectCh := isps3.Client.ListObjects(ctx, args[0], minio.ListObjectsOptions{
Prefix: "",
Recursive: true,
})