1
1
mirror of https://github.com/walles/moar.git synced 2024-11-27 01:05:23 +03:00
Commit Graph

49 Commits

Author SHA1 Message Date
Johan Walles
69bef3097c Fix crash on --quit-if-one-screen by dupping stdout 2024-06-24 07:26:42 +02:00
Johan Walles
4939e6a123 Improve marketing value
Ref: https://github.com/walles/moar/issues/103
2024-03-18 19:20:51 +01:00
Johan Walles
f4af673d3c Allow passing through multiple files
With this change in place you can invoke moar like this:

	moar file1 file2 file3 | wc -l

Note that I believe this is a corner case, and I will on purpose leave
this undocumented.

Fixes #187
2024-01-16 16:35:27 +01:00
Johan Walles
b2e223e381 Add a decompressing-while-piping test 2024-01-08 13:44:10 +01:00
Johan Walles
faafc49471 Accept +1234 argument in any place
Fixes the issue reported with PR #158:
https://github.com/walles/moar/pull/158#issue-1918313499
2023-09-29 22:42:41 +02:00
Johan Walles
1209010995 Handle the options test 2023-09-27 20:33:26 +02:00
Johan Walles
7e2d1a97f4 All the other arches are in lowercase 2023-02-22 19:58:29 +01:00
Johan Walles
ce49d99a9a Add Linux/arm32 builds
Fixes #122

Or actually works around rather than fixes. The fix would be to have
moar packaged for Debian.
2023-02-22 19:48:31 +01:00
Johan Walles
053e354623 Fix testing on any os/arch
Fixes #120
2023-01-22 11:36:43 +01:00
Johan Walles
f8e226bbe9 This part is quite slow, add more tracking 2022-12-19 10:08:38 +01:00
Johan Walles
82ac5dd583 Add another progress message
This step sometimes takes some time.
2022-12-19 10:05:07 +01:00
Johan Walles
5571c181b7 Accept not having --version in the OPTIONS section
It's documented separately at the top of the man page.
2022-07-22 11:26:04 +02:00
Johan Walles
9b24499765 Fix test.sh verification
It now handles options containing \- in the man page source.
2022-07-22 09:05:09 +02:00
Johan Walles
51e553cf36 Verify man page options vs --help options 2022-07-22 08:45:27 +02:00
Johan Walles
512d9fe26b Failing test case for #88 2022-04-18 08:42:33 +02:00
Johan Walles
1d002582f0 Move golangci-lint config into a config file 2022-02-13 08:22:57 +01:00
Johan Walles
542d71f5e0 Replace all linting with golangci-lint 2022-02-13 08:16:30 +01:00
Johan Walles
46b84fb392 Add a Windows executable to the release 2021-09-10 06:50:44 +02:00
Johan Walles
78ab63273a Move some test-only code into *_test.go files 2021-05-08 10:32:04 +02:00
Johan Walles
7c553891f7 Fix a progress message 2021-04-27 07:05:52 +02:00
Johan Walles
60b59c2483 Only install linters when needed
This makes most runs of ./test.sh quicker since they don't need to
invoke "go install".
2021-04-23 18:38:40 +02:00
Johan Walles
d51cd89e40 Remove not-needed-any-more check
Since we're getting our linters through "go install".
2021-04-22 19:20:27 +02:00
Johan Walles
0a6db4974b Experiment with go mod tidy and go install
Try to work out #48.
2021-04-22 19:13:12 +02:00
Johan Walles
d24acdbf32 CI logs cosmetics 2021-04-21 08:32:31 +02:00
Johan Walles
34299c42a2 Fix modules modification check 2021-04-21 08:24:55 +02:00
Johan Walles
97f5233080 Verify linters are listed in go.mod 2021-04-21 06:54:49 +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
c93270e8fc Run errcheck from test.sh 2021-04-20 06:59:49 +02:00
Johan Walles
c3936b44f4 Run staticcheck from test.sh 2021-04-20 06:46:14 +02:00
Johan Walles
592d6da1dc Fix a docs error 2021-04-19 15:30:09 +02:00
Johan Walles
ccfe3d3b20 Run "go vet" as part of testing 2021-04-19 15:29:28 +02:00
Johan Walles
d122901ca8 Add gomft -s flag
Adds code simplifications. Recommended online somewhere.
2021-04-19 15:20:33 +02:00
Johan Walles
40c7a473c9 Run all tests in the source tree
Changed from "run all tests in github.com/walles/moar/m"
2021-04-19 08:41:09 +02:00
Johan Walles
ede1a8cbb3 Verify code formatting in ./test.sh 2021-04-19 08:41:09 +02:00
Johan Walles
90e374601d Use our new tcell replacement 2021-04-17 22:29:41 +02: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
08db9e9cd6 Stop creating our own low-numbered colors
Because it didn't work.
2020-12-06 21:37:00 +01:00
Johan Walles
08d3fbfaa8 Add some timeouts
diff --git m/reader.go m/reader.go
index 339de9c..2427094 100644
--- m/reader.go
+++ m/reader.go
@@ -12,6 +12,7 @@ import (
 	"regexp"
 	"strings"
 	"sync"
+	"time"
 )

 // Reader reads a file into an array of strings.
@@ -54,9 +55,18 @@ func _ReadStream(stream io.Reader, reader *Reader, fromFilter *exec.Cmd) {
 			return
 		}

-		// FIXME: Can Wait()ing here stall? Should we release the lock while Wait()ing?
+		// Give the filter a little time to go away
+		timer := time.AfterFunc(2*time.Second, func() {
+			fromFilter.Process.Kill()
+		})
+
 		err := fromFilter.Wait()
+		timer.Stop()
+
 		if reader.err == nil {
+			// NOTE: This could mean that our Wait()ing on the filter above
+			// timed out.
+			//
 			// FIXME: Add filter stderr contents to the error reported here
 			reader.err = err
 		}
diff --git test.sh test.sh
index 677c5db..6d0b6b9 100755
--- test.sh
+++ test.sh
@@ -3,7 +3,7 @@
 set -e -o pipefail

 # Unit tests first
-go test github.com/walles/moar/m
+go test -timeout 20s github.com/walles/moar/m

 # Ensure we can cross compile
 # NOTE: Make sure this list matches the one in release.sh

Change-Id: I3847aaa0942588c2d4129c7b2967d1d10aa95035
2019-11-19 15:08:22 +01:00
Johan Walles
bc4bae3625 Add a script for making new releases 2019-08-04 19:07:14 +02:00
Johan Walles
d2e94fd26c Take control of --help output 2019-07-15 22:14:36 +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
84ae2cb21c Add --version tests
They fail.
2019-07-07 18:23:57 +02:00
Johan Walles
2f5c2da2e3 Case insensitive search on lowercase-only pattern 2019-07-06 22:16:08 +02:00
Johan Walles
da30eaf956 Handle displaying empty files
And introduce a unit test!
2019-06-13 20:04:51 +02:00
Johan Walles
af23822bc2 Put integration tests in tests.sh
This makes the testing code a bit simpler.
2019-06-09 22:03:25 +02:00
Johan Walles
c88da93eb6 Support copying from file to redirected stdout 2019-06-09 19:55:49 +02:00
Johan Walles
680045fbc1 Add initial integration tests 2019-06-09 18:42:25 +02:00