haunt/README.md

152 lines
4.1 KiB
Markdown
Raw Normal View History

2023-03-04 22:22:03 +00:00
## Quickstart
2023-03-06 07:52:48 +00:00
### Install
2023-03-04 22:22:03 +00:00
```
go install github.com/abs3ntdev/haunt@latest
```
or
```
git clone https://github.com/abs3ntdev/haunt
cd haunt
make build && sudo make install
```
2023-03-08 21:07:06 +00:00
#### aur
2023-03-08 21:22:04 +00:00
2023-03-08 21:07:06 +00:00
```
yay -S haunt-go-git
```
2023-03-06 07:52:48 +00:00
### 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`
2023-03-04 22:22:03 +00:00
## Commands List
2023-03-06 07:47:02 +00:00
### 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`
2023-03-04 22:22:03 +00:00
2023-03-06 07:47:02 +00:00
haunt init
2023-03-04 22:22:03 +00:00
2023-03-06 07:47:02 +00:00
### Run Command
2023-03-04 22:22:03 +00:00
```
2023-03-06 07:47:02 +00:00
haunt run
2023-03-04 22:22:03 +00:00
```
2023-03-06 07:47:02 +00:00
the run command allows for specifying projects by name, all provided will be ran according to the config file:
2023-03-04 22:22:03 +00:00
Some examples:
2023-03-06 07:47:02 +00:00
haunt run
haunt run server api
2023-03-04 22:22:03 +00:00
### Add Command
2023-03-06 07:47:02 +00:00
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
2023-03-04 22:22:03 +00:00
2023-03-10 17:59:19 +00:00
2023-03-04 22:22:03 +00:00
### 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
2023-03-08 23:16:39 +00:00
env: // env variables for run
2023-03-04 22:22:03 +00:00
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:
2023-03-05 06:29:39 +00:00
paths: // watched paths are relative to directory you run haunt in
2023-03-06 07:47:02 +00:00
- src
- cmd/coin
2023-03-04 22:22:03 +00:00
ignore_paths: // ignored paths
- vendor
extensions: // watched extensions
- go
- html
scripts:
- type: before
command: echo before global
global: true
output: true
2023-03-08 23:16:39 +00:00
env: // env variables per script
test: test
myvar: value
2023-03-04 22:22:03 +00:00
- type: before
command: echo before change
output: true
2023-03-08 23:16:39 +00:00
env: // env variables per script
test: othertest
myvar: othervalue
2023-03-04 22:22:03 +00:00
- type: after
command: echo after change
output: true
2023-03-08 23:16:39 +00:00
env: // env variables per script
key: 1
2023-03-04 22:22:03 +00:00
- type: after
command: echo after global
global: true
output: true