Skip to content

Commit

Permalink
brew tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
tg44 committed Oct 13, 2021
1 parent a0f3027 commit ae5a70b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ brews:

install: |
bin.install "heptapod"
bin.install Dir["rules/*"]
prefix.install Dir["rules"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ heptapod <action> -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
Expand Down
48 changes: 0 additions & 48 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
},
},
},
}

Expand Down

0 comments on commit ae5a70b

Please sign in to comment.