forked from ggreer/the_silver_searcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
max_count.t
34 lines (27 loc) · 913 Bytes
/
max_count.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Setup:
$ . $TESTDIR/setup.sh
$ printf "blah\n" > blah.txt
$ printf "blah2\n" >> blah.txt
$ printf "blah2\n" > blah2.txt
$ printf "blah2\n" >> blah2.txt
$ printf "blah2\n" >> blah2.txt
$ printf "blah2\n" >> blah2.txt
$ printf "blah2\n" >> blah2.txt
$ printf "blah2\n" >> blah2.txt
$ printf "blah2\n" >> blah2.txt
$ printf "blah2\n" >> blah2.txt
$ printf "blah2\n" >> blah2.txt
$ printf "blah2\n" >> blah2.txt # 10 lines
Max match of 1:
$ ag --max-count 1 blah blah.txt
ERR: Too many matches in blah.txt. Skipping the rest of this file.
1:blah
Max match of 10, one file:
$ ag --count --max-count 10 blah blah2.txt
ERR: Too many matches in blah2.txt. Skipping the rest of this file.
10
Max match of 10, multiple files:
$ ag --count --max-count 10 blah blah.txt blah2.txt
ERR: Too many matches in blah2.txt. Skipping the rest of this file.
blah.txt:2
blah2.txt:10