mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-24 03:21:36 +01:00
added --config option
Signed-off-by: Andreas Ulm <andreas.ulm@root360.de>
This commit is contained in:
parent
4bd1e56a84
commit
17054a3bcf
@ -76,6 +76,9 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
if configValue != "" {
|
||||||
|
yamlConfigPath = configValue
|
||||||
|
} else {
|
||||||
homeDir, err := utils.Home()
|
homeDir, err := utils.Home()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Retrieve home dir failed")
|
log.Fatal("Retrieve home dir failed")
|
||||||
@ -89,6 +92,7 @@ func init() {
|
|||||||
|
|
||||||
yamlConfigPath = filepath.Join(dir, "tea.yml")
|
yamlConfigPath = filepath.Join(dir, "tea.yml")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func splitRepo(repoPath string) (string, string) {
|
func splitRepo(repoPath string) (string, string) {
|
||||||
p := strings.Split(repoPath, "/")
|
p := strings.Split(repoPath, "/")
|
||||||
|
11
cmd/flags.go
11
cmd/flags.go
@ -16,6 +16,7 @@ var (
|
|||||||
loginValue string
|
loginValue string
|
||||||
repoValue string
|
repoValue string
|
||||||
outputValue string
|
outputValue string
|
||||||
|
configValue string
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoginFlag provides flag to specify tea login profile
|
// LoginFlag provides flag to specify tea login profile
|
||||||
@ -35,7 +36,14 @@ var RepoFlag = cli.StringFlag{
|
|||||||
// OutputFlag provides flag to specify output type
|
// OutputFlag provides flag to specify output type
|
||||||
var OutputFlag = cli.StringFlag{
|
var OutputFlag = cli.StringFlag{
|
||||||
Name: "output, o",
|
Name: "output, o",
|
||||||
Usage: "Indicate one repository, optional when inside a gitea repository",
|
Usage: "Specify output format. (csv, simple, table, tsv, yaml)",
|
||||||
|
Destination: &outputValue,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ConfigFlag provides flag to specify output type
|
||||||
|
var ConfigFlag = cli.StringFlag{
|
||||||
|
Name: "config, c",
|
||||||
|
Usage: "Specify tea.yml path",
|
||||||
Destination: &outputValue,
|
Destination: &outputValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,6 +52,7 @@ var OutputFlag = cli.StringFlag{
|
|||||||
// subcommand to work around issue:
|
// subcommand to work around issue:
|
||||||
// https://github.com/urfave/cli/issues/585
|
// https://github.com/urfave/cli/issues/585
|
||||||
var DefaultFlags = []cli.Flag{
|
var DefaultFlags = []cli.Flag{
|
||||||
|
ConfigFlag,
|
||||||
LoginFlag,
|
LoginFlag,
|
||||||
OutputFlag,
|
OutputFlag,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user