mirror of
https://github.com/thegeeklab/wp-matrix.git
synced 2024-11-13 23:50:39 +00:00
Robert Kaussow
22ead9610a
BREAKING CHANGE: The new template helper provided by https://github.com/thegeeklab/drone-plugin-lib/pull/28 is using pure Golang templates and sprig functions. As the unmaintained Golang handlebar library was removed entirely, the template syntax has changed and custom templates need to be adjusted. For more details, please read the [documentation](https://drone-plugin-index.geekdocs.de/plugins/drone-matrix/#parameters).
71 lines
2.3 KiB
Go
71 lines
2.3 KiB
Go
// Copyright (c) 2020, the Drone Plugins project authors.
|
|
// Copyright (c) 2021, Robert Kaussow <mail@thegeeklab.de>
|
|
|
|
// Use of this source code is governed by an Apache 2.0 license that can be
|
|
// found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/drone-plugins/drone-matrix/plugin"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// settingsFlags has the cli.Flags for the plugin.Settings.
|
|
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|
return []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "username",
|
|
EnvVars: []string{"PLUGIN_USERNAME", "MATRIX_USERNAME"},
|
|
Usage: "authentication username",
|
|
Destination: &settings.Username,
|
|
Category: category,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "password",
|
|
EnvVars: []string{"PLUGIN_PASSWORD", "MATRIX_PASSWORD"},
|
|
Usage: "authentication password",
|
|
Destination: &settings.Password,
|
|
Category: category,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "userid",
|
|
EnvVars: []string{"PLUGIN_USERID,PLUGIN_USER_ID", "MATRIX_USERID", "MATRIX_USER_ID"},
|
|
Usage: "authentication user id",
|
|
Destination: &settings.UserID,
|
|
Category: category,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "accesstoken",
|
|
EnvVars: []string{"PLUGIN_ACCESSTOKEN,PLUGIN_ACCESS_TOKEN", "MATRIX_ACCESSTOKEN", "MATRIX_ACCESS_TOKEN"},
|
|
Usage: "authentication access token",
|
|
Destination: &settings.AccessToken,
|
|
Category: category,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "homeserver",
|
|
EnvVars: []string{"PLUGIN_HOMESERVER", "MATRIX_HOMESERVER"},
|
|
Usage: "matrix home server url",
|
|
Value: "https://matrix.org",
|
|
Destination: &settings.Homeserver,
|
|
Category: category,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "roomid",
|
|
EnvVars: []string{"PLUGIN_ROOMID", "MATRIX_ROOMID"},
|
|
Usage: "roomid to send messages to",
|
|
Destination: &settings.RoomID,
|
|
Category: category,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "template",
|
|
EnvVars: []string{"PLUGIN_TEMPLATE", "MATRIX_TEMPLATE"},
|
|
Usage: "message template",
|
|
//nolint:lll
|
|
Value: "Build {{ .Build.Status }} [{{ .Repo.Owner }}/{{ .Repo.Name }}#{{ trunc 8 .Commit.SHA }}]({{ .Build.Link }}) ({{ .Build.Branch }}) by {{ .Commit.Author }}",
|
|
Destination: &settings.Template,
|
|
Category: category,
|
|
},
|
|
}
|
|
}
|