Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor polishing
Browse files Browse the repository at this point in the history
wtetsu committed Jan 16, 2025
1 parent 07f2051 commit 90c727e
Showing 4 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -19,3 +19,4 @@ coverage.txt

?.py
?.rb
_*.*
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh -eu

if [ $# == 0 ]; then
if [ $# -eq 0 ]; then
echo "Usage: build.sh <version>"
exit 1
fi
15 changes: 11 additions & 4 deletions cmd/gaze/main.go
Original file line number Diff line number Diff line change
@@ -19,6 +19,13 @@ import (

const version = "v1.1.7"

const (
errTimeout = "timeout must be more than 0"
errColor = "color must be 0 or 1"
errMaxWatchDirs = "maxWatchDirs must be more than 0"
versionInfo = "gaze " + version
)

func main() {
args := app.ParseArgs(os.Args, func() {
fmt.Println(usage2())
@@ -64,7 +71,7 @@ func earlyExit(args *app.Args) (bool, int) {
}

if args.Version() {
fmt.Println("gaze " + version)
fmt.Println(versionInfo)
return true, 0
}

@@ -100,13 +107,13 @@ func initLogger(args *app.Args) {
func validate(args *app.Args) error {
var errorList []string
if args.Timeout() <= 0 {
errorList = append(errorList, "timeout must be more than 0")
errorList = append(errorList, errTimeout)
}
if args.Color() != 0 && args.Color() != 1 {
errorList = append(errorList, "color must be 0 or 1")
errorList = append(errorList, errColor)
}
if args.MaxWatchDirs() <= 0 {
errorList = append(errorList, "maxWatchDirs must be more than 0")
errorList = append(errorList, errMaxWatchDirs)
}
if len(errorList) >= 1 {
return errors.New(strings.Join(errorList, "\n"))
8 changes: 4 additions & 4 deletions doc/parallel.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ No controversial point.

## Update twice in a row

In case you update a.py again during the first process stays running,
In case you update a.py again during the first process is still running,

- Gaze waits until the first process finishes.
- Right after the first process finished, a second process launches.
@@ -25,7 +25,7 @@ Since a.py was modified after the first `python a.py` launched, running `python

## Update more than twice in a row

In case you update a.py **multiple times** during the first process stays running,
In case you update a.py **multiple times** during the first process is still running,

- Gaze waits until the first process finishes.
- Right after the first process finished, a second process launches.
@@ -39,7 +39,7 @@ Note that **Gaze doesn't invoke the third process** in this case. Since there is

Gaze deals with multiple processes nicely.

In case you update another file during the first process stays running, what should occur? **Gaze runs a second process in parallel**.
In case you update another file during the first process is still running, what should occur? **Gaze runs a second process in parallel**.

![p04](img/p04.png)

@@ -53,7 +53,7 @@ There is a case Gaze runs the same command even when different files are updated
gaze -c make '*.go'
```

What should happen when you update multiple \*.go files during the first `make` stays running? The Gaze's answer is below.
What should happen when you update multiple \*.go files during the first `make` is still running? The Gaze's answer is below.

![p05](img/p05.png)

0 comments on commit 90c727e

Please sign in to comment.