Go to file
2024-07-06 13:49:54 -07:00
cmd docs: version bump 2023-03-11 21:35:03 -08:00
hack/unpack ci: add site unpacking / packing to makefile, ignore assets directory 2023-03-06 10:39:51 -08:00
src feat: per script environmental variables 2023-03-08 15:14:45 -08:00
.githubrelease.yaml ci: fix github build 2023-03-04 23:44:28 -08:00
.gitignore ci: add site unpacking / packing to makefile, ignore assets directory 2023-03-06 10:39:51 -08:00
.goreleaser.yaml update urls 2023-03-09 23:48:25 -08:00
.woodpecker.yml ci: build changes 2023-03-04 23:42:01 -08:00
go.mod fix(deps): update module github.com/spf13/cobra to v1.8.1 2024-07-06 13:49:54 -07:00
go.sum fix(deps): update module github.com/spf13/cobra to v1.8.1 2024-07-06 13:49:54 -07:00
LICENSE initial commit 2023-03-04 14:22:03 -08:00
main.go server redo 2023-03-06 10:17:28 -08:00
Makefile feat: per script environmental variables 2023-03-08 15:14:45 -08:00
README.md updates 2023-03-10 09:59:19 -08:00
renovate.json Update renovate.json 2024-07-06 20:35:58 +00:00

Quickstart

Install

go install github.com/abs3ntdev/haunt@latest

or

git clone https://github.com/abs3ntdev/haunt
cd haunt
make build && sudo make install

aur

yay -S haunt-go-git

Completions

completions will be automatically installed if you used the Makefile, if you did not you can generate completions with haunt completion [bash/fish/powershell/zsh]

for example: haunt completion zsh > _haunt

you can also source the output of the completion command directly in your .zshrc with:
source <(haunt completion zsh) && compdef _haunt haunt

Commands List

Init Command

This command will generate a .haunt.yaml with sane default for your current project/projects.
If there is a main.go in the root directory it will be added along with any directories inside the relative path cmd

haunt init

Run Command

haunt run

the run command allows for specifying projects by name, all provided will be ran according to the config file:

Some examples:

haunt run
haunt run server api

Add Command

Add a project, the same defaults init uses will be used for new projects unless flags are provided.

haunt add [name] [--flags]

Possible flags are:

-b, --build         Enable go build
-f, --fmt           Enable go fmt
-g, --generate      Enable go generate
-h, --help          help for add
-i, --install       Enable go install (default true)
-p, --path string   Project base path (default "./")
-r, --run           Enable go run (default true)
-t, --test          Enable go test
-v, --vet           Enable go vet

Remove Command

Remove a project by its name

haunt remove [name]

Config sample

settings:
    legacy:
        force: true             // force polling watcher instead fsnotifiy
        interval: 100ms         // polling interval
    resources:                  // files names
        outputs: outputs.log
        logs: logs.log
        errors: errors.log
server:
    status: false               // server status
    open: false                 // open browser at start
    host: localhost             // server host
    port: 5001                  // server port
schema:
- name: coin
  path: cmd/coin                // project path
  env:            // env variables for run
        test: test
        myvar: value
  commands:               // go commands supported
    vet:
        status: true
    fmt:
        status: true
        args:
        - -s
        - -w
    test:
        status: true
        method: gb test    // support different build tools
    generate:
        status: true
    install:
        status: true
    build:
        status: false
        method: gb build    // support differents build tool
        args:               // additional params for the command
        - -race
    run:
        status: true
  args:                     // arguments to pass at the project
  - --myarg
  watcher:
      paths:                 // watched paths are relative to directory you run haunt in
      - src
      - cmd/coin
      ignore_paths:          // ignored paths
      - vendor
      extensions:                  // watched extensions
      - go
      - html
      scripts:
      - type: before
        command: echo before global
        global: true
        output: true
        env:            // env variables per script
          test: test
          myvar: value
      - type: before
        command: echo before change
        output: true
        env:            // env variables per script
          test: othertest
          myvar: othervalue
      - type: after
        command: echo after change
        output: true
        env:            // env variables per script
          key: 1
      - type: after
        command: echo after global
        global: true
        output: true