-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
options.h
60 lines (53 loc) · 1.34 KB
/
options.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef OPTIONS_H
#define OPTIONS_H
#include <getopt.h>
#include <pcre.h>
enum case_behavior {
CASE_SENSITIVE,
CASE_INSENSITIVE,
CASE_SENSITIVE_RETRY_INSENSITIVE /* for future use */
};
typedef struct {
int ackmate;
pcre *ackmate_dir_filter;
pcre_extra *ackmate_dir_filter_extra;
int after;
int before;
enum case_behavior casing;
const char *file_search_string;
int match_files;
pcre *file_search_regex;
pcre_extra *file_search_regex_extra;
int color;
int column;
int context;
int follow_symlinks;
int invert_match;
int literal;
int max_matches_per_file;
int max_search_depth;
int print_break;
int print_filename_only;
int print_heading;
int print_line_numbers;
int print_long_lines; /* TODO: support this in print.c */
int recurse_dirs;
int search_all_files;
int search_binary_files;
int search_hidden_files;
int search_stream; /* true if tail -F blah | ag */
int search_unrestricted;
int stats;
char *query;
int query_len;
int paths_len;
int parallel;
int word_regexp;
} cli_options;
/* global options. parse_options gives it sane values, everything else reads from it */
cli_options opts;
void init_options();
void parse_options(int argc, char **argv, char **paths[]);
void cleanup_options();
void usage();
#endif