Johan Walles
4692fb00f9
Improve log timestamp precision
...
Because I want to know how long certain sub-second things take.
2021-04-06 16:22:40 +02:00
Johan Walles
54935615ed
Switch highlighting engine to Chroma
...
Which is linked into here, so no need for users to install any external
tools.
Chroma home page: https://github.com/alecthomas/chroma
2021-01-09 17:18:10 +01:00
Johan Walles
570d780bc2
NewReaderFromStream(): Make name mandatory
...
This makes the API somewhat simpler to use. To support not providing any
name we still allow the empty string as the name, and document that
thoroughly.
2020-12-30 19:00:03 +01:00
Johan Walles
2b18347022
Make a lot fewer functions public
2020-12-29 22:57:44 +01:00
Johan Walles
7f7b0107d5
Make the correct reader constructors public
2020-12-29 17:19:56 +01:00
Johan Walles
1ac14b1c23
Fix private-functions naming
...
It's start-with-lowercase, not start-with-underscore.
2020-12-29 17:08:54 +01:00
Johan Walles
2583747590
Bump tcell to v2
...
Should fix 21.
2020-12-06 14:47:10 +01:00
Johan Walles
ad767671eb
Condition some log messages on --debug flag
...
With this change, to get some log messages (about unsupported keys
mostly), you have to pass --debug on the command line.
Fixes #20
2019-12-06 19:36:31 +01:00
Johan Walles
1fa52b9bc7
Use a global logger
...
This saves us from a lot of passing-a-logger-around and makes the code
generally easier to read and to work with.
2019-11-27 18:43:46 +01:00
Johan Walles
d96bb923a1
Print bug reporting info on log messages
...
diff --git moar.go moar.go
index 46b2898..906b310 100644
--- moar.go
+++ moar.go
@@ -58,6 +58,23 @@ func _PrintUsage(output io.Writer) {
}
}
+// PrintProblemsHeader prints bug reporting information to stderr
+func PrintProblemsHeader() {
+ fmt.Fprintln(os.Stderr, "Please post the following report at <https://github.com/walles/moar/issues >,")
+ fmt.Fprintln(os.Stderr, "or e-mail it to johan.walles@gmail.com.")
+ fmt.Fprintln(os.Stderr)
+ fmt.Fprintln(os.Stderr, "Version:", versionString)
+ fmt.Fprintln(os.Stderr, "LANG :", os.Getenv("LANG"))
+ fmt.Fprintln(os.Stderr, "TERM :", os.Getenv("TERM"))
+ fmt.Fprintln(os.Stderr)
+ fmt.Fprintln(os.Stderr, "GOOS :", runtime.GOOS)
+ fmt.Fprintln(os.Stderr, "GOARCH :", runtime.GOARCH)
+ fmt.Fprintln(os.Stderr, "Compiler:", runtime.Compiler)
+ fmt.Fprintln(os.Stderr, "NumCPU :", runtime.NumCPU())
+
+ fmt.Fprintln(os.Stderr)
+}
+
func main() {
// FIXME: If we get a CTRL-C, get terminal back into a useful state before terminating
@@ -67,21 +84,7 @@ func main() {
return
}
- // On any panic or warnings, also print system info and how to report bugs
- fmt.Fprintln(os.Stderr, "Please post the following crash report at <https://github.com/walles/moar/issues >,")
- fmt.Fprintln(os.Stderr, "or e-mail it to johan.walles@gmail.com.")
- fmt.Fprintln(os.Stderr)
- fmt.Fprintln(os.Stderr, "Version:", versionString)
- fmt.Fprintln(os.Stderr, "LANG :", os.Getenv("LANG"))
- fmt.Fprintln(os.Stderr, "TERM :", os.Getenv("TERM"))
- fmt.Fprintln(os.Stderr)
- fmt.Fprintln(os.Stderr, "GOOS :", runtime.GOOS)
- fmt.Fprintln(os.Stderr, "GOARCH :", runtime.GOARCH)
- fmt.Fprintln(os.Stderr, "Compiler:", runtime.Compiler)
- fmt.Fprintln(os.Stderr, "NumCPU :", runtime.NumCPU())
-
- fmt.Fprintln(os.Stderr)
-
+ PrintProblemsHeader()
panic(err)
}()
@@ -161,6 +164,8 @@ func _StartPaging(reader *m.Reader) {
}
if len(loglines.String()) > 0 {
+ PrintProblemsHeader()
+
// FIXME: Don't print duplicate log messages more than once,
// maybe invent our own logger for this?
fmt.Fprintf(os.Stderr, "%s", loglines.String())
Change-Id: If41c17e98daf9f05909ab7e3c31dc84e946cbbf5
2019-11-19 15:33:00 +01:00
Johan Walles
8ad5329a8d
Fix PAGER= setting detection
2019-07-15 22:47:36 +02:00
Johan Walles
a77d4f058c
Only inform about PAGER= if we're not already it
2019-07-15 22:43:27 +02:00
Johan Walles
5139da5d08
Only inform about highlight if it's not installed
2019-07-15 22:35:19 +02:00
Johan Walles
a2eca47d54
Let --help explain our dependence on highlight
2019-07-15 22:32:27 +02:00
Johan Walles
a856e4d9c8
Explain how to make moar the default pager
2019-07-15 22:27:41 +02:00
Johan Walles
d2e94fd26c
Take control of --help output
2019-07-15 22:14:36 +02:00
Johan Walles
0f0c8a1111
Don't highlight files with unsupported file extensions
2019-07-15 18:46:53 +02:00
Johan Walles
447da01d49
Handle new lines arriving
...
We display the lines, but we also just freeze. Try "./moar.sh moar.sh"
and try to search and you'll see.
2019-07-11 18:52:20 +02:00
Johan Walles
0a6dbbe909
Input now read in the background, but...
...
... the reader still needs to notify the pager when new lines are
available, and the pager must update the display if it would affect the
display, but not too often.
2019-07-09 19:53:04 +02:00
Johan Walles
399d5d6975
WIP: First stab at background reading
...
Try ./moar.sh moar.sh, nothing is shown. Fix stuff.
2019-07-08 18:58:37 +02:00
Johan Walles
31ae7927c7
Print bug reporting instructions on panics
2019-07-08 06:42:48 +02:00
Johan Walles
0fbb2ce8d3
Write version number into executable
2019-07-07 18:35:55 +02:00
Johan Walles
92b0133b25
Add initial option parsing support
2019-07-07 18:18:29 +02:00
Johan Walles
0646c58a5f
Restore screen before printing log messages
2019-06-30 22:11:26 +02:00
Johan Walles
dd0e438f9a
Restore screen before panicking
2019-06-29 22:27:18 +02:00
Johan Walles
656c01456e
Enable entering a search string
2019-06-29 11:20:48 +02:00
Johan Walles
70500056af
Show file name and line numbers
2019-06-21 23:24:53 +02:00
Johan Walles
42c45aedae
Simplify Reader API
2019-06-16 21:54:25 +02:00
Johan Walles
a1cdf0c200
Add logging
2019-06-16 10:02:19 +02:00
Johan Walles
a9b8b5b9d5
Fix displaying UTF-8 runes
...
Before this change we displayed spaces after each UTF-8 rune.
With this change in place the extra spaces are gone.
2019-06-15 08:10:56 +02:00
Johan Walles
6f13bde11e
Show blank screen and wait for user input
2019-06-11 18:29:30 +02:00
Johan Walles
e23eaddabd
Add placeholder code for starting the pager
...
This version doesn't compile and I don't know why.
2019-06-10 21:50:31 +02:00
Johan Walles
35b0e74293
Fix resource leak
2019-06-10 06:54:08 +02:00
Johan Walles
1031450083
Add some more structure
2019-06-09 21:58:12 +02:00
Johan Walles
3f5451b90e
Report missing input file
2019-06-09 21:52:27 +02:00
Johan Walles
c88da93eb6
Support copying from file to redirected stdout
2019-06-09 19:55:49 +02:00
Johan Walles
2225ef826b
Rudimentary command line parsing
2019-06-09 19:40:35 +02:00
Johan Walles
0029c2de0f
Pass one integration test
2019-06-09 19:34:52 +02:00
Johan Walles
61752e8d30
Initial Go setup
2019-06-09 07:47:55 +02:00