Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add option to suppress line numbers output #148

Merged
merged 1 commit into from

2 participants

@rev112

What about adding option (like '--no-numbers' ) to disable line numbers output?

For example, you want to search for something in the form of "double ag":
$ ag | ag

But if 'smth2' is a number, it may collide with line numbers from first 'ag' output.

P.S. sorry for issue and pull request mess

@ggreer
Owner


Looks good to me.

@ggreer ggreer merged commit 55028b4 into ggreer:master
@rev112 rev112 deleted the rev112:no_numbers_option branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 10, 2013
  1. @rev112
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 0 deletions.
  1. +1 −0  ag.bashcomp.sh
  2. +6 −0 doc/ag.1
  3. +2 −0  doc/ag.1.md
  4. +5 −0 src/options.c
View
1  ag.bashcomp.sh
@@ -43,6 +43,7 @@ _ag() {
--line-numbers
--literal
--max-count
+ --no-numbers
--path-to-agignore
--print-long-lines
--search-binary
View
6 doc/ag.1
@@ -139,6 +139,12 @@ Recursively search for PATTERN in PATH\. Like grep or ack, but faster\.
\~\~\~\~ Skip the rest of a file after NUM matches\. Default is 10,000\.
.
.P
+\fB\-\-no\-numbers\fR:
+.
+.br
+\~\~\~\~ Don\'t show line numbers
+.
+.P
\fB\-p \-\-path\-to\-agignore STRING\fR:
.
.br
View
2  doc/ag.1.md
@@ -53,6 +53,8 @@ Recursively search for PATTERN in PATH. Like grep or ack, but faster.
Only print filenames that don't contain matches.
* `-m --max-count NUM`:
Skip the rest of a file after NUM matches. Default is 10,000.
+ * `--no-numbers`:
+ Don't show line numbers
* `-p --path-to-agignore STRING`:
Provide a path to a specific .agignore file.
* `--pager COMMAND`:
View
5 src/options.c
@@ -58,6 +58,7 @@ Search options:\n\
-L --files-without-matches\n\
Only print filenames that don't contain matches\n\
-m --max-count NUM Skip the rest of a file after NUM matches (Default: 10,000)\n\
+--no-numbers Don't show line numbers\n\
-p --path-to-agignore STRING\n\
Use .agignore file at STRING\n\
--print-long-lines Print matches on very long lines (Default: >2k characters)\n\
@@ -175,6 +176,7 @@ void parse_options(int argc, char **argv, char **base_paths[], char **paths[]) {
{ "literal", no_argument, NULL, 'Q' },
{ "match", no_argument, &useless, 0 },
{ "max-count", required_argument, NULL, 'm' },
+ { "no-numbers", no_argument, NULL, 0 },
{ "no-recurse", no_argument, NULL, 'n' },
{ "nobreak", no_argument, &opts.print_break, 0 },
{ "nocolor", no_argument, &opts.color, 0 },
@@ -329,6 +331,9 @@ void parse_options(int argc, char **argv, char **base_paths[], char **paths[]) {
} else if (strcmp(longopts[opt_index].name, "depth") == 0) {
opts.max_search_depth = atoi(optarg);
break;
+ } else if (strcmp(longopts[opt_index].name, "no-numbers") == 0) {
+ opts.print_line_numbers = FALSE;
+ break;
} else if (strcmp(longopts[opt_index].name, "ignore-dir") == 0) {
add_ignore_pattern(root_ignores, optarg);
break;
Something went wrong with that request. Please try again.