Skip to content

Commit

Permalink
minor cosmetics and readme additions
Browse files Browse the repository at this point in the history
  • Loading branch information
mitranim committed Apr 10, 2023
1 parent ee8baaa commit 4454c47
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/mitranim/gg v0.0.13 h1:gMmGRzkF8ARhxUSXAHEE1CB64ipaXpEFjgzmxclGBZ0=
github.com/mitranim/gg v0.0.13/go.mod h1:UCnf53suG0iX7c9P8tnH6L7iTT9LpMyhQQMVjwi5Jt0=
github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8=
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
github.com/rjeczalik/notify v0.9.3 h1:6rJAzHTGKXGj76sbRgDiDcYj/HniypXmSJo1SWakZeY=
github.com/rjeczalik/notify v0.9.3/go.mod h1:gF3zSOrafR9DQEWSE8TjfI9NkooDxbyT4UgRGKZA0lc=
golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 h1:J27LZFQBFoihqXoegpscI10HpjZ7B5WQLLKL2FZXQKw=
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
2 changes: 2 additions & 0 deletions gow_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ func (self *Cmd) BroadcastUnsync(sig syscall.Signal) {
}

func (self *Cmd) WriteChar(char byte) {
// Locking and unlocking for every character might be wasteful.
// Might even be stupidly wasteful. TODO measure.
defer gg.Lock(self).Unlock()

stdin := self.Stdin
Expand Down
2 changes: 1 addition & 1 deletion gow_flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
type FlagStrMultiline string

func (self *FlagStrMultiline) Parse(src string) error {
*self += FlagStrMultiline(withNewline(REP_SINGLE_MULTI(src)))
*self += FlagStrMultiline(withNewline(REP_SINGLE_MULTI.Replace(src)))
return nil
}

Expand Down
5 changes: 4 additions & 1 deletion gow_misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ import (
)

const (
// These names reflect standard naming and meaning.
// See our re-interpretation below.
ASCII_END_OF_TEXT = 3 // ^C
ASCII_FILE_SEPARATOR = 28 // ^\
ASCII_DEVICE_CONTROL_2 = 18 // ^R
ASCII_DEVICE_CONTROL_4 = 20 // ^T
ASCII_UNIT_SEPARATOR = 31 // ^- or ^?

// These names reflect our re-interpretation of standard codes.
CODE_INTERRUPT = ASCII_END_OF_TEXT
CODE_QUIT = ASCII_FILE_SEPARATOR
CODE_RESTART = ASCII_DEVICE_CONTROL_2
Expand All @@ -35,7 +38,7 @@ var (
`\r\n`, gg.Newline,
`\r`, gg.Newline,
`\n`, gg.Newline,
).Replace
)
)

/**
Expand Down
13 changes: 13 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Currently requires Unix (MacOS, Linux, BSD). On Windows, runs under WSL.
* [Installation](#installation)
* [Usage](#usage)
* [Hotkeys](#hotkeys)
* [Gotchas](#gotchas)
* [Watching Templates](#watching-templates)
* [Alternatives](#alternatives)
* [License](#license)
Expand Down Expand Up @@ -94,6 +95,18 @@ Supported control codes with commonly associated hotkeys. Exact keys may vary be

Other input is forwarded to the subprocess as-is.

## Gotchas

By default, `gow` expects to be used in a foreground, interactive terminal. When running `gow` in a background process, Docker, or any other non-interactive environment, you may see errors similar to the below. To avoid the problem, run `gow` with `-r=false`. This also disables hotkey support.

```
unable to read terminal state
inappropriate ioctl for device
operation not supported by device
```

## Watching Templates

Many Go programs, such as servers, include template files, and want to recompile those templates on change.
Expand Down

0 comments on commit 4454c47

Please sign in to comment.