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:
parent
5139da5d08
commit
a77d4f058c
@ -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
14
moar.go
@ -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?
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user