From ae5a70b5dcd50a2878f2a8d6cdcb0ad7df2fa707 Mon Sep 17 00:00:00 2001 From: Gergo Torcsvari Date: Wed, 13 Oct 2021 12:25:28 +0200 Subject: [PATCH] brew tuning --- .goreleaser.yml | 2 +- README.md | 5 +++-- main.go | 48 ------------------------------------------------ 3 files changed, 4 insertions(+), 51 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 020fc09..f8456ca 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -73,4 +73,4 @@ brews: install: | bin.install "heptapod" - bin.install Dir["rules/*"] + prefix.install Dir["rules"] diff --git a/README.md b/README.md index 4c11f38..665f4b1 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,10 @@ heptapod -h Will print help! ``` -heptapod initRules +mkdir -p ~/.heptapod/rules +cp -R $(brew --prefix heptapod)/rules ~/.heptapod/rules ``` -This will move the currently added ruleset to `~/.heptapod/rules` (or the set `--rules dir` directory) they are added as enabled rules! +This will move the currently added ruleset to `~/.heptapod/rules` ``` heptapod ls -a diff --git a/main.go b/main.go index a5c951d..86c9da8 100644 --- a/main.go +++ b/main.go @@ -6,13 +6,9 @@ import ( "github.com/tg44/heptapod/pkg" "github.com/tg44/heptapod/pkg/parser" "github.com/tg44/heptapod/pkg/tmutil" - "github.com/tg44/heptapod/pkg/utils" "github.com/urfave/cli/v2" - "io" - "io/ioutil" "log" "os" - "path/filepath" "sort" "strings" ) @@ -193,50 +189,6 @@ func main() { return nil }, }, - { - Name: "initRules", - Aliases: []string{}, - Usage: "copy the example rules to the given rule dir", - Flags: []cli.Flag{}, - Action: func(c *cli.Context) error { - dest, err := utils.FixupPathsToHandleHome(rulePath) - if err != nil { - return err - } - srcDir := "./rules" - entries, err := ioutil.ReadDir(srcDir) - if err != nil { - return err - } - for _, entry := range entries { - sourcePath := filepath.Join(srcDir, entry.Name()) - destPath := filepath.Join(dest, entry.Name()) - - out, err := os.Create(destPath) - if err != nil { - return err - } - defer func() { - _ = out.Close() - }() - - in, err := os.Open(sourcePath) - if err != nil { - return err - } - defer func() { - _ = in.Close() - }() - - _, err = io.Copy(out, in) - if err != nil { - return err - } - } - fmt.Printf("All the rules are copied to %s, please check them with heptapod ls -a, and optionally edit them for better include/exclude rules!\n", rulePath) - return nil - }, - }, }, }