Skip to content

Commit

Permalink
Expose Combined Flags on cli (#351)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Valdivia <[email protected]>
  • Loading branch information
dvaldivia authored Nov 28, 2024
1 parent a860612 commit 0836762
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 12 deletions.
4 changes: 3 additions & 1 deletion cli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ var deleteFlags = []cli.Flag{
},
}

var DeletedCombinedFlags = combineFlags(globalFlags, ioFlags, deleteFlags, genFlags, benchFlags, analyzeFlags)

var deleteCmd = cli.Command{
Name: "delete",
Usage: "benchmark delete objects",
Action: mainDelete,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, deleteFlags, genFlags, benchFlags, analyzeFlags),
Flags: DeletedCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand Down
4 changes: 3 additions & 1 deletion cli/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ var getFlags = []cli.Flag{
},
}

var GetCombinedFlags = combineFlags(globalFlags, ioFlags, getFlags, genFlags, benchFlags, analyzeFlags)

var getCmd = cli.Command{
Name: "get",
Usage: "benchmark get objects",
Action: mainGet,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, getFlags, genFlags, benchFlags, analyzeFlags),
Flags: GetCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand Down
4 changes: 3 additions & 1 deletion cli/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ var listFlags = []cli.Flag{
},
}

var ListCombinedFlags = combineFlags(globalFlags, ioFlags, listFlags, genFlags, benchFlags, analyzeFlags)

var listCmd = cli.Command{
Name: "list",
Usage: "benchmark list objects",
Action: mainList,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, listFlags, genFlags, benchFlags, analyzeFlags),
Flags: ListCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand Down
4 changes: 3 additions & 1 deletion cli/mixed.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ var mixedFlags = []cli.Flag{
},
}

var MixedCombinedFlags = combineFlags(globalFlags, ioFlags, mixedFlags, genFlags, benchFlags, analyzeFlags)

var mixedCmd = cli.Command{
Name: "mixed",
Usage: "benchmark mixed objects",
Action: mainMixed,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, mixedFlags, genFlags, benchFlags, analyzeFlags),
Flags: MixedCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand Down
10 changes: 6 additions & 4 deletions cli/multipart.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ var multipartFlags = []cli.Flag{
},
}

// Put command.
var MultiPartCombinedFlags = combineFlags(globalFlags, ioFlags, multipartFlags, genFlags, benchFlags, analyzeFlags)

// MultiPart command.
var multipartCmd = cli.Command{
Name: "multipart",
Usage: "benchmark multipart object",
Action: mainMultipart,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, multipartFlags, genFlags, benchFlags, analyzeFlags),
Flags: MultiPartCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand All @@ -75,7 +77,7 @@ FLAGS:
{{end}}`,
}

// mainPut is the entry point for cp command.
// mainMultipart is the entry point for put command.
func mainMultipart(ctx *cli.Context) error {
checkMultipartSyntax(ctx)
b := bench.Multipart{
Expand All @@ -96,7 +98,7 @@ func mainMultipart(ctx *cli.Context) error {
return runBench(ctx, &b)
}

// putOpts retrieves put options from the context.
// multipartOpts retrieves put options from the context.
func multipartOpts(ctx *cli.Context) minio.PutObjectOptions {
return minio.PutObjectOptions{
ServerSideEncryption: newSSE(ctx),
Expand Down
4 changes: 3 additions & 1 deletion cli/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ var putFlags = []cli.Flag{
},
}

var PutCombinedFlags = combineFlags(globalFlags, ioFlags, putFlags, genFlags, benchFlags, analyzeFlags)

// Put command.
var putCmd = cli.Command{
Name: "put",
Usage: "benchmark put objects",
Action: mainPut,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, putFlags, genFlags, benchFlags, analyzeFlags),
Flags: PutCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand Down
4 changes: 3 additions & 1 deletion cli/retention.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ var retentionFlags = []cli.Flag{
},
}

var RetentionCombinedFlags = combineFlags(globalFlags, ioFlags, retentionFlags, genFlags, benchFlags, analyzeFlags)

var retentionCmd = cli.Command{
Name: "retention",
Usage: "benchmark PutObjectRetention",
Action: mainRetention,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, retentionFlags, genFlags, benchFlags, analyzeFlags),
Flags: RetentionCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand Down
4 changes: 3 additions & 1 deletion cli/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ var statFlags = []cli.Flag{
},
}

var StatCombinedFlags = combineFlags(globalFlags, ioFlags, statFlags, genFlags, benchFlags, analyzeFlags)

var statCmd = cli.Command{
Name: "stat",
Usage: "benchmark stat objects (get file info)",
Action: mainStat,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, statFlags, genFlags, benchFlags, analyzeFlags),
Flags: StatCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand Down
4 changes: 3 additions & 1 deletion cli/versioned.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ var versionedFlags = []cli.Flag{
},
}

var VersionedCombinedFlags = combineFlags(globalFlags, ioFlags, versionedFlags, genFlags, benchFlags, analyzeFlags)

var versionedCmd = cli.Command{
Name: "versioned",
Usage: "benchmark mixed versioned objects",
Action: mainVersioned,
Before: setGlobalsFromContext,
Flags: combineFlags(globalFlags, ioFlags, versionedFlags, genFlags, benchFlags, analyzeFlags),
Flags: VersionedCombinedFlags,
CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}}
Expand Down

0 comments on commit 0836762

Please sign in to comment.