2021-10-27 19:03:14 +00:00
|
|
|
// Copyright 2021 Woodpecker Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package common
|
|
|
|
|
2023-08-07 18:47:30 +00:00
|
|
|
import (
|
|
|
|
"github.com/urfave/cli/v2"
|
2021-10-27 19:03:14 +00:00
|
|
|
|
2023-12-31 22:29:56 +00:00
|
|
|
"go.woodpecker-ci.org/woodpecker/v2/shared/logger"
|
2023-08-07 18:47:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var GlobalFlags = append([]cli.Flag{
|
2021-10-27 19:03:14 +00:00
|
|
|
&cli.StringFlag{
|
|
|
|
EnvVars: []string{"WOODPECKER_TOKEN"},
|
|
|
|
Name: "token",
|
|
|
|
Aliases: []string{"t"},
|
|
|
|
Usage: "server auth token",
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
EnvVars: []string{"WOODPECKER_SERVER"},
|
|
|
|
Name: "server",
|
|
|
|
Aliases: []string{"s"},
|
|
|
|
Usage: "server address",
|
|
|
|
},
|
2024-02-19 08:16:27 +00:00
|
|
|
&cli.BoolFlag{
|
|
|
|
EnvVars: []string{"DISABLE_UPDATE_CHECK"},
|
|
|
|
Name: "disable-update-check",
|
|
|
|
Usage: "disable update check",
|
|
|
|
},
|
2021-10-27 19:03:14 +00:00
|
|
|
&cli.BoolFlag{
|
|
|
|
EnvVars: []string{"WOODPECKER_SKIP_VERIFY"},
|
|
|
|
Name: "skip-verify",
|
|
|
|
Usage: "skip ssl verification",
|
|
|
|
Hidden: true,
|
|
|
|
},
|
|
|
|
&cli.StringFlag{
|
|
|
|
EnvVars: []string{"SOCKS_PROXY"},
|
|
|
|
Name: "socks-proxy",
|
|
|
|
Usage: "socks proxy address",
|
|
|
|
Hidden: true,
|
|
|
|
},
|
|
|
|
&cli.BoolFlag{
|
|
|
|
EnvVars: []string{"SOCKS_PROXY_OFF"},
|
|
|
|
Name: "socks-proxy-off",
|
|
|
|
Usage: "socks proxy ignored",
|
|
|
|
Hidden: true,
|
|
|
|
},
|
2023-12-31 22:29:56 +00:00
|
|
|
}, logger.GlobalLoggerFlags...)
|
2021-10-27 19:03:14 +00:00
|
|
|
|
|
|
|
// FormatFlag return format flag with value set based on template
|
|
|
|
// if hidden value is set, flag will be hidden
|
|
|
|
func FormatFlag(tmpl string, hidden ...bool) *cli.StringFlag {
|
|
|
|
return &cli.StringFlag{
|
|
|
|
Name: "format",
|
|
|
|
Usage: "format output",
|
|
|
|
Value: tmpl,
|
|
|
|
Hidden: len(hidden) != 0,
|
|
|
|
}
|
|
|
|
}
|
2022-08-29 23:14:07 +00:00
|
|
|
|
|
|
|
var RepoFlag = &cli.StringFlag{
|
|
|
|
Name: "repository",
|
|
|
|
Aliases: []string{"repo"},
|
2023-06-12 23:07:52 +00:00
|
|
|
Usage: "repository id or full-name (e.g. 134 or octocat/hello-world)",
|
2022-08-29 23:14:07 +00:00
|
|
|
}
|
2023-07-21 17:45:32 +00:00
|
|
|
|
|
|
|
var OrgFlag = &cli.StringFlag{
|
|
|
|
Name: "organization",
|
|
|
|
Aliases: []string{"org"},
|
|
|
|
Usage: "organization id or full-name (e.g. 123 or octocat)",
|
|
|
|
}
|