[NEW] selfupdate
This commit is contained in:
21
cmd/list.go
21
cmd/list.go
@@ -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,
|
||||
})
|
||||
|
Reference in New Issue
Block a user