Skip to content

Commit 1085b15

Browse files
author
Christian Griset
committed
Merge pull request #9 from Clever/add-basepath-option
Add basepath option
2 parents 224ae87 + 9536079 commit 1085b15

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ repos:
2525
# - it either
2626
# (a) makes changes to files within the repo, outputs a commit message to stdout, and exits with code 0
2727
# (b) exits with a nonzero exit code
28+
29+
# Basepath to prepend temp directories. Not including this option is okay and the program will assume ""
30+
base_path: "path/to/prepend/tmpdir"
2831
change_cmds:
2932
# command paths can either be absolute paths, or paths relative to the configuration file.
3033
- path: "/path/to/the/program"

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.0
1+
1.0.1

main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func (c Command) Validate() error {
3232
// Config for gitbot.
3333
type Config struct {
3434
Repos []string `yaml:"repos"`
35+
BasePath string `yaml:"base_path"`
3536
ChangeCmds []Command `yaml:"change_cmds"`
3637
PostCmds []Command `yaml:"post_cmds"`
3738
}
@@ -104,9 +105,11 @@ func main() {
104105
log.Fatal(err)
105106
}
106107

108+
base_path := cfg.BasePath
109+
107110
for _, repo := range cfg.Repos {
108111
// clone repo to temp directory
109-
tempdir, err := ioutil.TempDir(os.TempDir(), "")
112+
tempdir, err := ioutil.TempDir(base_path+os.TempDir(), "")
110113
if err != nil {
111114
log.Fatal(err)
112115
}

0 commit comments

Comments
 (0)