support configurable config

This commit is contained in:
Jesse Duffield 2020-10-04 22:05:39 +11:00
parent 778ca8e6f9
commit 485f6d5386
9 changed files with 222 additions and 24 deletions

View file

@ -49,7 +49,10 @@ func main() {
flaggy.Bool(&configFlag, "c", "config", "Print the default config")
configDirFlag := false
flaggy.Bool(&configDirFlag, "cd", "config-dir", "Print the config directory")
flaggy.Bool(&configDirFlag, "cd", "print-config-dir", "Print the config directory")
useConfigDir := ""
flaggy.String(&useConfigDir, "ucd", "use-config-dir", "override default config directory with provided directory")
workTree := ""
flaggy.String(&workTree, "w", "work-tree", "equivalent of the --work-tree git argument")
@ -68,6 +71,10 @@ func main() {
gitDir = filepath.Join(repoPath, ".git")
}
if useConfigDir != "" {
os.Setenv("CONFIG_DIR", useConfigDir)
}
if workTree != "" {
env.SetGitWorkTreeEnv(workTree)
}