Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: update installation instruction #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 35 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,63 @@
# gowatch

![Go](https://github.com/silenceper/gowatch/workflows/Go/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/silenceper/gowatch)](https://goreportcard.com/report/github.com/silenceper/gowatch)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/silenceper/gowatch)](https://pkg.go.dev/github.com/silenceper/gowatch)
[![codecov](https://codecov.io/gh/silenceper/gowatch/branch/master/graph/badge.svg)](https://codecov.io/gh/silenceper/gowatch)

[中文文档](./README_ZH_CN.md)

gowatch is a command line tool that builds and (re)starts your go project everytime you save a Go or template file.
gowatch is a command line tool that builds and (re)starts your go project
everytime you save a Go or template file.

![gowatch](./screenshot/gowatch.png)

## Installation
To install `gowatch` use the `go insall` command:

```go
go install github.com/silenceper/gowatch@latest
> If you already have `gowatch` installed, updating `gowatch` is simple:

```
go get -u github.com/silenceper/gowatch
```

Then you can add `gowatch` binary to PATH environment variable in your ~/.bashrc or ~/.bash_profile file:
To install: `gowatch`

>If you already have `gowatch` installed, updating `gowatch` is simple:
1. Use the `go insall` command:

```go
go install github.com/silenceper/gowatch@latest
```
go get -u github.com/silenceper/gowatch

2. Add `gowatch` binary to PATH environment variable in your ~/.bashrc or
~/.bash_profile file:

```sh
export GOPATH="$HOME/go"
export PATH="$GOPATH/bin:$PATH"
```

## Usage

```
cd /path/to/myapp
```

Start gowatch:

```
gowatch
```


Gowatch will watch for file events, and every time you create/modify/delete a file it will build and restart the application,If `go build` returns an error, it will log it in stdout.
Gowatch will watch for file events, and every time you create/modify/delete a
file it will build and restart the application,If `go build` returns an error,
it will log it in stdout.

### Support Options

- -o : Not required, specify the target file path for the build
- -p : Not required, specify the package to be built (can also be a single file)
- -args: Not required, specify program runtime parameters, for example: -args = '-host =: 8080, -name = demo'
- -args: Not required, specify program runtime parameters, for example: -args =
'-host =: 8080, -name = demo'
- -v: Not required, display gowatch version information
- -l: Not required, specify the log level, default is debug
- -h: Not required, show usage
Expand All @@ -52,13 +68,18 @@ example:

### Configuration file

In most cases, you don't need to specify the configuration. You can meet most of the requirements by directly executing the `gowatch` command.
In most cases, you don't need to specify the configuration. You can meet most of
the requirements by directly executing the `gowatch` command.

You can initialize the gowatch.yml configuration file to the current directory
with the default settings running the following command.

You can initialize the gowatch.yml configuration file to the current directory with the default settings running the following command.
```
gowatch init
```

Create a `gowatch.yml` file in the execution directory:

```
# gowatch.yml configuration example

Expand Down Expand Up @@ -115,7 +136,7 @@ log_level: "debug"
```

## Author
[@silenceper](http://silenceper.com)

[@silenceper](http://silenceper.com)

>Inspired by [bee](https://github.com/beego/bee)
> Inspired by [bee](https://github.com/beego/bee)