summaryrefslogtreecommitdiff
path: root/uncrust.go
diff options
context:
space:
mode:
Diffstat (limited to 'uncrust.go')
-rw-r--r--uncrust.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/uncrust.go b/uncrust.go
index 73d237c..4dd1635 100644
--- a/uncrust.go
+++ b/uncrust.go
@@ -19,6 +19,7 @@ import (
var (
fl_lang = flag.String("l", "C", "Language")
fl_verbose = flag.Bool("v", false, "Verbosity on")
+ fl_config = flag.String("c", os.Getenv("UNCRUSTIFY_CONFIG"), "uncrustify config")
pos_rx = regexp.MustCompile(`.* orig line is ([\d]+), orig col is ([\d]+)`)
lin_rx = regexp.MustCompile(`.* orig line is ([\d]+)`)
@@ -49,7 +50,12 @@ func main() {
log.Fatalf("couldn't read body of window id %d: %s\n", wid, e)
}
- args := []string{"--replace", "--no-backup", "-l", *fl_lang}
+ args := []string{}
+ if *fl_config != "" {
+ args = append(args, "-c", *fl_config)
+ }
+ args = append(args, "--no-backup", "-l", *fl_lang)
+
stderr := &bytes.Buffer{}
stdout := &bytes.Buffer{}