From d4154b2d347ef87a1e302ff706f775e1969f83ec Mon Sep 17 00:00:00 2001 From: Özgür Kesim Date: Mon, 17 Mar 2025 19:36:20 +0100 Subject: only --no-backup, not --replace --- uncrust.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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{} -- cgit v1.2.3