1
1
mirror of https://github.com/walles/moar.git synced 2024-10-26 21:13:11 +03:00

Only inform about PAGER= if we're not already it

This commit is contained in:
Johan Walles 2019-07-15 22:43:27 +02:00
parent 5139da5d08
commit a77d4f058c
2 changed files with 10 additions and 6 deletions

View File

@ -61,6 +61,8 @@ func _ReadStream(stream io.Reader, reader *Reader, fromFilter *exec.Cmd) {
reader.err = err
}
// FIXME: Report any filter printouts to stderr to the user
// Must send non-blocking since the channel has no buffer and sometimes no reader
select {
case reader.done <- true:

14
moar.go
View File

@ -41,12 +41,14 @@ func _PrintUsage(output io.Writer) {
moarPath, err := filepath.Abs(os.Args[0])
if err == nil {
// FIXME: Don't print this if PAGER already point to ourselves
fmt.Fprintln(output)
fmt.Fprintln(output, "To make Moar your default pager, put the following line in")
fmt.Fprintln(output, "your .bashrc or .bash_profile and it will be default in all")
fmt.Fprintln(output, "new terminal windows:")
fmt.Fprintf(output, " export PAGER=%s\n", moarPath)
if os.Getenv("PAGER") != moarPath {
// We're not the default pager
fmt.Fprintln(output)
fmt.Fprintln(output, "To make Moar your default pager, put the following line in")
fmt.Fprintln(output, "your .bashrc or .bash_profile and it will be default in all")
fmt.Fprintln(output, "new terminal windows:")
fmt.Fprintf(output, " export PAGER=%s\n", moarPath)
}
} else {
// FIXME: Report this error?
}