mirror of
https://github.com/thegeeklab/drone-github-comment.git
synced 2024-11-25 04:00:39 +00:00
refactor: add plugin flags to category (#107)
This commit is contained in:
parent
ee17131c37
commit
a237020e58
@ -6,13 +6,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// settingsFlags has the cli.Flags for the plugin.Settings.
|
// settingsFlags has the cli.Flags for the plugin.Settings.
|
||||||
func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
||||||
return []cli.Flag{
|
return []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "api-key",
|
Name: "api-key",
|
||||||
EnvVars: []string{"PLUGIN_API_KEY", "GITHUB_COMMENT_API_KEY"},
|
EnvVars: []string{"PLUGIN_API_KEY", "GITHUB_COMMENT_API_KEY"},
|
||||||
Usage: "sets api key to access github api",
|
Usage: "sets api key to access github api",
|
||||||
Destination: &settings.APIKey,
|
Destination: &settings.APIKey,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "base-url",
|
Name: "base-url",
|
||||||
@ -20,24 +21,28 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||||||
Usage: "sets api url; need to be changed for gh enterprise",
|
Usage: "sets api url; need to be changed for gh enterprise",
|
||||||
Value: "https://api.github.com/",
|
Value: "https://api.github.com/",
|
||||||
Destination: &settings.BaseURL,
|
Destination: &settings.BaseURL,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "key",
|
Name: "key",
|
||||||
EnvVars: []string{"PLUGIN_KEY", "GITHUB_COMMENT_KEY"},
|
EnvVars: []string{"PLUGIN_KEY", "GITHUB_COMMENT_KEY"},
|
||||||
Usage: "sets unique key to assign to comment",
|
Usage: "sets unique key to assign to comment",
|
||||||
Destination: &settings.Key,
|
Destination: &settings.Key,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "message",
|
Name: "message",
|
||||||
EnvVars: []string{"PLUGIN_MESSAGE", "GITHUB_COMMENT_MESSAGE"},
|
EnvVars: []string{"PLUGIN_MESSAGE", "GITHUB_COMMENT_MESSAGE"},
|
||||||
Usage: "sets file or string with comment message",
|
Usage: "sets file or string with comment message",
|
||||||
Destination: &settings.Message,
|
Destination: &settings.Message,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "update",
|
Name: "update",
|
||||||
EnvVars: []string{"PLUGIN_UPDATE", "GITHUB_COMMENT_UPDATE"},
|
EnvVars: []string{"PLUGIN_UPDATE", "GITHUB_COMMENT_UPDATE"},
|
||||||
Usage: "enables update of an existing comment that matches the key",
|
Usage: "enables update of an existing comment that matches the key",
|
||||||
Destination: &settings.Update,
|
Destination: &settings.Update,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "skip-missing",
|
Name: "skip-missing",
|
||||||
@ -45,6 +50,7 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||||||
Usage: "skips comment creation if the given message file does not exist",
|
Usage: "skips comment creation if the given message file does not exist",
|
||||||
Value: false,
|
Value: false,
|
||||||
Destination: &settings.SkipMissing,
|
Destination: &settings.SkipMissing,
|
||||||
|
Category: category,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ func main() {
|
|||||||
Name: "drone-github-comment",
|
Name: "drone-github-comment",
|
||||||
Usage: "handle comments to github issues or pull requests",
|
Usage: "handle comments to github issues or pull requests",
|
||||||
Version: BuildVersion,
|
Version: BuildVersion,
|
||||||
Flags: append(settingsFlags(settings), urfave.Flags()...),
|
Flags: append(settingsFlags(settings, urfave.FlagsPluginCategory), urfave.Flags()...),
|
||||||
Action: run(settings),
|
Action: run(settings),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user