mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-23 19:11:38 +01:00
added --config option
Signed-off-by: Andreas Ulm <andreas.ulm@root360.de>
This commit is contained in:
parent
4bd1e56a84
commit
17054a3bcf
@ -76,18 +76,22 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
homeDir, err := utils.Home()
|
||||
if err != nil {
|
||||
log.Fatal("Retrieve home dir failed")
|
||||
}
|
||||
if configValue != "" {
|
||||
yamlConfigPath = configValue
|
||||
} else {
|
||||
homeDir, err := utils.Home()
|
||||
if err != nil {
|
||||
log.Fatal("Retrieve home dir failed")
|
||||
}
|
||||
|
||||
dir := filepath.Join(homeDir, ".tea")
|
||||
err = os.MkdirAll(dir, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Fatal("Init tea config dir", dir, "failed")
|
||||
}
|
||||
dir := filepath.Join(homeDir, ".tea")
|
||||
err = os.MkdirAll(dir, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Fatal("Init tea config dir", dir, "failed")
|
||||
}
|
||||
|
||||
yamlConfigPath = filepath.Join(dir, "tea.yml")
|
||||
yamlConfigPath = filepath.Join(dir, "tea.yml")
|
||||
}
|
||||
}
|
||||
|
||||
func splitRepo(repoPath string) (string, string) {
|
||||
|
11
cmd/flags.go
11
cmd/flags.go
@ -16,6 +16,7 @@ var (
|
||||
loginValue string
|
||||
repoValue string
|
||||
outputValue string
|
||||
configValue string
|
||||
)
|
||||
|
||||
// LoginFlag provides flag to specify tea login profile
|
||||
@ -35,7 +36,14 @@ var RepoFlag = cli.StringFlag{
|
||||
// OutputFlag provides flag to specify output type
|
||||
var OutputFlag = cli.StringFlag{
|
||||
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,
|
||||
}
|
||||
|
||||
@ -44,6 +52,7 @@ var OutputFlag = cli.StringFlag{
|
||||
// subcommand to work around issue:
|
||||
// https://github.com/urfave/cli/issues/585
|
||||
var DefaultFlags = []cli.Flag{
|
||||
ConfigFlag,
|
||||
LoginFlag,
|
||||
OutputFlag,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user