1
1
mirror of https://github.com/walles/moar.git synced 2024-09-11 12:15:43 +03:00
Commit Graph

75 Commits

Author SHA1 Message Date
Johan Walles
e21005d498 Improve comments 2023-03-02 07:22:32 +01:00
Johan Walles
e17e6bdac2 Make command line error messages more visible
Before this change I felt they just disappeared in the clutter from the
help text.
2023-03-02 07:17:05 +01:00
Johan Walles
5432ff567a Fix speling error 2023-03-02 07:06:10 +01:00
Johan Walles
b4541db00f Handle the scroll-sideways hints 2023-03-02 07:03:39 +01:00
Johan Walles
65ba59d136 Fix unprintable parsing 2023-03-02 06:56:52 +01:00
Johan Walles
b4eb15a53f Fix statusbar style printing 2023-03-02 06:50:45 +01:00
Johan Walles
c127d47b69 Handle style option better 2023-03-01 21:38:49 +01:00
Johan Walles
285aff2afc Do our own help printing 2023-03-01 07:36:49 +01:00
Johan Walles
c730afce46 Nicer code but worse feedback on option parse failures 2023-03-01 07:25:01 +01:00
Johan Walles
144ae466b3 Simplify some code 2023-01-02 23:07:04 +01:00
Johan Walles
2b77cf7605 Bump Chroma to add new styles
Relates to #112.
2022-12-29 08:28:27 +01:00
Johan Walles
b149b09905 Add --follow command line parameter
Ref: https://github.com/walles/moar/issues/108#issuecomment-1328724290
2022-11-28 19:09:17 +01:00
Johan Walles
a30a31bb2b Try supporting Clear-to-EOL
This should be about right, but the tests are still failing.
2022-10-27 16:51:17 +02:00
Johan Walles
257b9e7bf5 Clarify we want UTF-8 input
Fixes #101.
2022-08-07 19:26:51 +02:00
Johan Walles
0cd33532f9 Fix scroll hint options parsing 2022-08-07 17:57:13 +02:00
Johan Walles
1e192779f7 Add scroll hint options
Broken, unsure why. Tried it without any options and got error messages.
2022-08-07 17:43:29 +02:00
Johan Walles
2a4336f6db Add --no-statusbar to hide the status bar
Fixes #93.
2022-07-20 22:16:33 +02:00
Johan Walles
0ec6e58b23 Link to source code from --help output
Relates to #87.
2022-07-19 17:07:11 +02:00
Johan Walles
9551a536e8 Tune PAGER= hint in moar --help output 2022-04-20 07:09:42 +02:00
Johan Walles
e7b6c088a5 Suggest "moar" if we're in the $PATH, otherwise an absolute path 2022-04-18 19:05:49 +02:00
Johan Walles
7ad2bad619 Compare absolute PATH paths 2022-04-18 18:49:25 +02:00
Johan Walles
90633263c0 s/filepath.Abs/exec.LookPath/ 2022-04-18 18:41:48 +02:00
Johan Walles
faa833fe4e Use 256 colors only on xterm-256color
Fixes #86.
2022-04-01 20:24:00 +02:00
Johan Walles
388de91d3a Add option for how to render unprintable characters
Fixes #83.
2022-02-27 09:39:16 +01:00
Johan Walles
f0f4d703a0 Add --statusbar= command line option
Supports "plain", "inverse" or "bold", defaulting to "inverse".

Resolves #81.
2022-02-18 19:09:05 +01:00
Johan Walles
b96c88c4d1 Support retaining screen contents after exit
Fixes #76.
2021-11-09 18:56:02 +01:00
Johan Walles
a710033d6f Mention transparent decompression in --help message 2021-07-01 19:21:42 +02:00
Johan Walles
2a435c091b Print MOAR environment value in --help 2021-06-04 06:15:09 +02:00
Johan Walles
4552bfd79c Add command line switch for hiding line numbers 2021-06-03 21:49:02 +02:00
Johan Walles
0f43cf1ea3 Make line wrapping controllable from the command line 2021-05-22 15:56:55 +02:00
Johan Walles
edacfeec31 Read config from MOAR environment variable
Together with c95e1645 this fixes #60.
2021-05-13 19:00:53 +02:00
Johan Walles
c95e164595 Enable picking style and formatter from command line
Related to #60.
2021-05-13 07:37:34 +02:00
Johan Walles
54942cf12e Less compatibility improvement
If we get both a filename and a pipe, prefer the filename.

For example, this will show the contents of /etc/passwd:

$ echo hello | moar /etc/passwd

Before this change, it displayed "hello" on a page.
2021-04-20 09:18:02 +02:00
Johan Walles
730ed46f4f Fix errcheck reported problems 2021-04-20 08:43:37 +02:00
Johan Walles
f8e658f0e3 Fix staticcheck reported errors 2021-04-20 06:46:14 +02:00
Johan Walles
90e374601d Use our new tcell replacement 2021-04-17 22:29:41 +02:00
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