feat: group flags by categories (#6)

This commit is contained in:
Robert Kaussow 2022-05-29 13:15:31 +02:00 committed by GitHub
parent 69400ab6b2
commit dcb03e1fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 164 additions and 80 deletions

View File

@ -14,97 +14,115 @@ import (
) )
// buildFlags has the cli.Flags for the drone.Build. // buildFlags has the cli.Flags for the drone.Build.
func buildFlags() []cli.Flag { func buildFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "build.branch", Name: "build.branch",
Usage: "build branch", Usage: "build branch",
EnvVars: []string{"DRONE_BRANCH"}, EnvVars: []string{"DRONE_BRANCH"},
Category: category,
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "build.pull-request", Name: "build.pull-request",
Usage: "build pull request", Usage: "build pull request",
EnvVars: []string{"DRONE_PULL_REQUEST"}, EnvVars: []string{"DRONE_PULL_REQUEST"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.tag", Name: "build.tag",
Usage: "build tag", Usage: "build tag",
EnvVars: []string{"DRONE_TAG"}, EnvVars: []string{"DRONE_TAG"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.source-branch", Name: "build.source-branch",
Usage: "build source branch", Usage: "build source branch",
EnvVars: []string{"DRONE_SOURCE_BRANCH"}, EnvVars: []string{"DRONE_SOURCE_BRANCH"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.target-branch", Name: "build.target-branch",
Usage: "build target branch", Usage: "build target branch",
EnvVars: []string{"DRONE_TARGET_BRANCH"}, EnvVars: []string{"DRONE_TARGET_BRANCH"},
Category: category,
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "build.number", Name: "build.number",
Usage: "build number", Usage: "build number",
EnvVars: []string{"DRONE_BUILD_NUMBER"}, EnvVars: []string{"DRONE_BUILD_NUMBER"},
Category: category,
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "build.parent", Name: "build.parent",
Usage: "build parent", Usage: "build parent",
EnvVars: []string{"DRONE_BUILD_PARENT"}, EnvVars: []string{"DRONE_BUILD_PARENT"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.event", Name: "build.event",
Usage: "build event", Usage: "build event",
EnvVars: []string{"DRONE_BUILD_EVENT"}, EnvVars: []string{"DRONE_BUILD_EVENT"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.action", Name: "build.action",
Usage: "build action", Usage: "build action",
EnvVars: []string{"DRONE_BUILD_ACTION"}, EnvVars: []string{"DRONE_BUILD_ACTION"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.status", Name: "build.status",
Usage: "build status", Usage: "build status",
EnvVars: []string{"DRONE_BUILD_STATUS"}, EnvVars: []string{"DRONE_BUILD_STATUS"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.link", Name: "build.link",
Usage: "build link", Usage: "build link",
EnvVars: []string{"DRONE_BUILD_LINK"}, EnvVars: []string{"DRONE_BUILD_LINK"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.created", Name: "build.created",
Usage: "build created", Usage: "build created",
EnvVars: []string{"DRONE_BUILD_CREATED"}, EnvVars: []string{"DRONE_BUILD_CREATED"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.started", Name: "build.started",
Usage: "build started", Usage: "build started",
EnvVars: []string{"DRONE_BUILD_STARTED"}, EnvVars: []string{"DRONE_BUILD_STARTED"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.finished", Name: "build.finished",
Usage: "build finished", Usage: "build finished",
EnvVars: []string{"DRONE_BUILD_FINISHED"}, EnvVars: []string{"DRONE_BUILD_FINISHED"},
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "build.deploy-to", Name: "build.deploy-to",
Usage: "build deploy to", Usage: "build deploy to",
EnvVars: []string{"DRONE_DEPLOY_TO"}, EnvVars: []string{"DRONE_DEPLOY_TO"},
Category: category,
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "build.deploy-id", Name: "build.deploy-id",
Usage: "build deploy id", Usage: "build deploy id",
EnvVars: []string{"DRONE_DEPLOY_ID"}, EnvVars: []string{"DRONE_DEPLOY_ID"},
Category: category,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "build.failed-stages", Name: "build.failed-stages",
Usage: "build failed stages", Usage: "build failed stages",
EnvVars: []string{"DRONE_FAILED_STAGES"}, EnvVars: []string{"DRONE_FAILED_STAGES"},
Category: category,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "build.failed-steps", Name: "build.failed-steps",
Usage: "build failed steps", Usage: "build failed steps",
EnvVars: []string{"DRONE_FAILED_STEPS"}, EnvVars: []string{"DRONE_FAILED_STEPS"},
Category: category,
}, },
} }
} }

View File

@ -8,7 +8,7 @@ import (
) )
// calVerFlags has the cli.Flags for the drone.CalVer. // calVerFlags has the cli.Flags for the drone.CalVer.
func calVerFlags() []cli.Flag { func calVerFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "calver.version", Name: "calver.version",
@ -16,6 +16,7 @@ func calVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_CALVER", "DRONE_CALVER",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "calver.major", Name: "calver.major",
@ -23,6 +24,7 @@ func calVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_CALVER_MAJOR", "DRONE_CALVER_MAJOR",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "calver.minor", Name: "calver.minor",
@ -30,6 +32,7 @@ func calVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_CALVER_MINOR", "DRONE_CALVER_MINOR",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "calver.micro", Name: "calver.micro",
@ -37,6 +40,7 @@ func calVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_CALVER_MICRO", "DRONE_CALVER_MICRO",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "calver.modifier", Name: "calver.modifier",
@ -44,6 +48,7 @@ func calVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_CALVER_MODIFIER", "DRONE_CALVER_MODIFIER",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "calver.short", Name: "calver.short",
@ -51,6 +56,7 @@ func calVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_CALVER_SHORT", "DRONE_CALVER_SHORT",
}, },
Category: category,
}, },
} }
} }

View File

@ -12,7 +12,7 @@ import (
) )
// commitFlags has the cli.Flags for the drone.Commit. // commitFlags has the cli.Flags for the drone.Commit.
func commitFlags() []cli.Flag { func commitFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.sha", Name: "commit.sha",
@ -21,6 +21,7 @@ func commitFlags() []cli.Flag {
"DRONE_COMMIT", "DRONE_COMMIT",
"DRONE_COMMIT_SHA", "DRONE_COMMIT_SHA",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.before", Name: "commit.before",
@ -28,6 +29,7 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_BEFORE", "DRONE_COMMIT_BEFORE",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.after", Name: "commit.after",
@ -35,6 +37,7 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_AFTER", "DRONE_COMMIT_AFTER",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.ref", Name: "commit.ref",
@ -42,6 +45,7 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_REF", "DRONE_COMMIT_REF",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.branch", Name: "commit.branch",
@ -49,12 +53,14 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_BRANCH", "DRONE_COMMIT_BRANCH",
}, },
Category: category,
}, &cli.StringFlag{ }, &cli.StringFlag{
Name: "commit.link", Name: "commit.link",
Usage: "commit link", Usage: "commit link",
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_LINK", "DRONE_COMMIT_LINK",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.message", Name: "commit.message",
@ -62,6 +68,7 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_MESSAGE", "DRONE_COMMIT_MESSAGE",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.author", Name: "commit.author",
@ -69,6 +76,7 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_AUTHOR", "DRONE_COMMIT_AUTHOR",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.author-name", Name: "commit.author-name",
@ -76,6 +84,7 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_AUTHOR_NAME", "DRONE_COMMIT_AUTHOR_NAME",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.author-email", Name: "commit.author-email",
@ -83,6 +92,7 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_AUTHOR_EMAIL", "DRONE_COMMIT_AUTHOR_EMAIL",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "commit.author-avatar", Name: "commit.author-avatar",
@ -90,6 +100,7 @@ func commitFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_COMMIT_AUTHOR_AVATAR", "DRONE_COMMIT_AUTHOR_AVATAR",
}, },
Category: category,
}, },
} }
} }

View File

@ -12,12 +12,13 @@ import (
) )
// loggingFlags has the cli.Flags for logging config. // loggingFlags has the cli.Flags for logging config.
func loggingFlags() []cli.Flag { func loggingFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "log-level", Name: "log-level",
Usage: "log level", Usage: "log level",
EnvVars: []string{"PLUGIN_LOG_LEVEL"}, EnvVars: []string{"PLUGIN_LOG_LEVEL"},
Category: category,
}, },
} }
} }

View File

@ -20,12 +20,13 @@ import (
) )
// networkFlags has the cli.Flags for the drone.Network. // networkFlags has the cli.Flags for the drone.Network.
func networkFlags() []cli.Flag { func networkFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "transport.skip-verify", Name: "transport.skip-verify",
Usage: "skip ssl verify", Usage: "skip ssl verify",
EnvVars: []string{"PLUGIN_SKIP_VERIFY"}, EnvVars: []string{"PLUGIN_SKIP_VERIFY"},
Category: category,
}, },
} }
} }

View File

@ -12,7 +12,7 @@ import (
) )
// repoFlags has the cli.Flags for the drone.Repo // repoFlags has the cli.Flags for the drone.Repo
func repoFlags() []cli.Flag { func repoFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.slug", Name: "repo.slug",
@ -20,6 +20,7 @@ func repoFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_REPO", "DRONE_REPO",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.scm", Name: "repo.scm",
@ -27,6 +28,7 @@ func repoFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_REPO_SCM", "DRONE_REPO_SCM",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.owner", Name: "repo.owner",
@ -35,6 +37,7 @@ func repoFlags() []cli.Flag {
"DRONE_REPO_OWNER", "DRONE_REPO_OWNER",
"DRONE_REPO_NAMESPACE", "DRONE_REPO_NAMESPACE",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.name", Name: "repo.name",
@ -42,6 +45,7 @@ func repoFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_REPO_NAME", "DRONE_REPO_NAME",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.link", Name: "repo.link",
@ -49,6 +53,7 @@ func repoFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_REPO_LINK", "DRONE_REPO_LINK",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.branch", Name: "repo.branch",
@ -56,6 +61,7 @@ func repoFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_REPO_BRANCH", "DRONE_REPO_BRANCH",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.http-url", Name: "repo.http-url",
@ -64,6 +70,7 @@ func repoFlags() []cli.Flag {
"DRONE_REMOTE_URL", "DRONE_REMOTE_URL",
"DRONE_GIT_HTTP_URL", "DRONE_GIT_HTTP_URL",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.ssh-url", Name: "repo.ssh-url",
@ -71,6 +78,7 @@ func repoFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_GIT_SSH_URL", "DRONE_GIT_SSH_URL",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo.visibility", Name: "repo.visibility",
@ -78,6 +86,7 @@ func repoFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_REPO_VISIBILITY", "DRONE_REPO_VISIBILITY",
}, },
Category: category,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "repo.private", Name: "repo.private",
@ -85,6 +94,7 @@ func repoFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_REPO_PRIVATE", "DRONE_REPO_PRIVATE",
}, },
Category: category,
}, },
} }
} }

View File

@ -12,7 +12,7 @@ import (
) )
// semVerFlags has the cli.Flags for the drone.SemVer. // semVerFlags has the cli.Flags for the drone.SemVer.
func semVerFlags() []cli.Flag { func semVerFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "semver.version", Name: "semver.version",
@ -20,6 +20,7 @@ func semVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SEMVER", "DRONE_SEMVER",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "semver.major", Name: "semver.major",
@ -27,6 +28,7 @@ func semVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SEMVER_MAJOR", "DRONE_SEMVER_MAJOR",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "semver.minor", Name: "semver.minor",
@ -34,6 +36,7 @@ func semVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SEMVER_MINOR", "DRONE_SEMVER_MINOR",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "semver.patch", Name: "semver.patch",
@ -41,6 +44,7 @@ func semVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SEMVER_PATCH", "DRONE_SEMVER_PATCH",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "semver.prerelease", Name: "semver.prerelease",
@ -48,6 +52,7 @@ func semVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SEMVER_PRERELEASE", "DRONE_SEMVER_PRERELEASE",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "semver.build", Name: "semver.build",
@ -55,6 +60,7 @@ func semVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SEMVER_BUILD", "DRONE_SEMVER_BUILD",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "semver.short", Name: "semver.short",
@ -62,6 +68,7 @@ func semVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SEMVER_SHORT", "DRONE_SEMVER_SHORT",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "semver.error", Name: "semver.error",
@ -69,6 +76,7 @@ func semVerFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SEMVER_ERROR", "DRONE_SEMVER_ERROR",
}, },
Category: category,
}, },
} }
} }

View File

@ -14,7 +14,7 @@ import (
) )
// stageFlags has the cli.Flags for the drone.Stage. // stageFlags has the cli.Flags for the drone.Stage.
func stageFlags() []cli.Flag { func stageFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.kind", Name: "stage.kind",
@ -22,6 +22,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_KIND", "DRONE_STAGE_KIND",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.type", Name: "stage.type",
@ -29,6 +30,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_TYPE", "DRONE_STAGE_TYPE",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.name", Name: "stage.name",
@ -36,6 +38,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_NAME", "DRONE_STAGE_NAME",
}, },
Category: category,
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "stage.number", Name: "stage.number",
@ -43,6 +46,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_NUMBER", "DRONE_STAGE_NUMBER",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.machine", Name: "stage.machine",
@ -50,6 +54,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_MACHINE", "DRONE_STAGE_MACHINE",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.os", Name: "stage.os",
@ -57,6 +62,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_OS", "DRONE_STAGE_OS",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.arch", Name: "stage.arch",
@ -64,6 +70,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_ARCH", "DRONE_STAGE_ARCH",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.variant", Name: "stage.variant",
@ -71,6 +78,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_VARIANT", "DRONE_STAGE_VARIANT",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.version", Name: "stage.version",
@ -78,6 +86,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_VERSION", "DRONE_STAGE_VERSION",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "stage.status", Name: "stage.status",
@ -85,6 +94,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_STATUS", "DRONE_STAGE_STATUS",
}, },
Category: category,
}, },
&cli.Int64Flag{ &cli.Int64Flag{
Name: "stage.started", Name: "stage.started",
@ -92,6 +102,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_STARTED", "DRONE_STAGE_STARTED",
}, },
Category: category,
}, },
&cli.Int64Flag{ &cli.Int64Flag{
Name: "stage.finished", Name: "stage.finished",
@ -99,6 +110,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_FINISHED", "DRONE_STAGE_FINISHED",
}, },
Category: category,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "stage.depends-on", Name: "stage.depends-on",
@ -106,6 +118,7 @@ func stageFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STAGE_DEPENDS_ON", "DRONE_STAGE_DEPENDS_ON",
}, },
Category: category,
}, },
} }
} }

View File

@ -12,7 +12,7 @@ import (
) )
// stepFlags has the cli.Flags for the drone.Step. // stepFlags has the cli.Flags for the drone.Step.
func stepFlags() []cli.Flag { func stepFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "step.name", Name: "step.name",
@ -20,6 +20,7 @@ func stepFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STEP_NAME", "DRONE_STEP_NAME",
}, },
Category: category,
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "step.number", Name: "step.number",
@ -27,6 +28,7 @@ func stepFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_STEP_NUMBER", "DRONE_STEP_NUMBER",
}, },
Category: category,
}, },
} }
} }

View File

@ -12,7 +12,7 @@ import (
) )
// systemFlags has the cli.Flags for the drone.System. // systemFlags has the cli.Flags for the drone.System.
func systemFlags() []cli.Flag { func systemFlags(category string) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "system.proto", Name: "system.proto",
@ -20,6 +20,7 @@ func systemFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SYSTEM_PROTO", "DRONE_SYSTEM_PROTO",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "system.host", Name: "system.host",
@ -28,6 +29,7 @@ func systemFlags() []cli.Flag {
"DRONE_SYSTEM_HOST", "DRONE_SYSTEM_HOST",
"DRONE_SYSTEM_HOSTNAME", "DRONE_SYSTEM_HOSTNAME",
}, },
Category: category,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "system.version", Name: "system.version",
@ -35,6 +37,7 @@ func systemFlags() []cli.Flag {
EnvVars: []string{ EnvVars: []string{
"DRONE_SYSTEM_VERSION", "DRONE_SYSTEM_VERSION",
}, },
Category: category,
}, },
} }
} }

View File

@ -11,20 +11,31 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
var (
FlagsBuildCategory = "Drone Build Flags"
FlagsRepoCategory = "Drone Repo Flags"
FlagsCommitCategory = "Drone Commit Flags"
FlagsStageCategory = "Drone Stage Flags"
FlagsStepCategory = "Drone Step Flags"
FlagsVersioningCategory = "Drone Versioning Flags"
FlagsSystemCategory = "Drone System Flags"
FlagsPluginCategory = "Plugin Flags"
)
// Flags has the cli.Flags for the Drone plugin. // Flags has the cli.Flags for the Drone plugin.
func Flags() []cli.Flag { func Flags() []cli.Flag {
flags := []cli.Flag{} flags := []cli.Flag{}
flags = append(flags, buildFlags()...) flags = append(flags, buildFlags(FlagsBuildCategory)...)
flags = append(flags, repoFlags()...) flags = append(flags, repoFlags(FlagsRepoCategory)...)
flags = append(flags, commitFlags()...) flags = append(flags, commitFlags(FlagsCommitCategory)...)
flags = append(flags, stageFlags()...) flags = append(flags, stageFlags(FlagsStageCategory)...)
flags = append(flags, stepFlags()...) flags = append(flags, stepFlags(FlagsStepCategory)...)
flags = append(flags, semVerFlags()...) flags = append(flags, semVerFlags(FlagsVersioningCategory)...)
flags = append(flags, calVerFlags()...) flags = append(flags, calVerFlags(FlagsVersioningCategory)...)
flags = append(flags, systemFlags()...) flags = append(flags, systemFlags(FlagsSystemCategory)...)
flags = append(flags, networkFlags()...) flags = append(flags, networkFlags(FlagsPluginCategory)...)
flags = append(flags, loggingFlags()...) flags = append(flags, loggingFlags(FlagsPluginCategory)...)
return flags return flags
} }