blob: 04c099fa1522610840a911d7be9fc2d47f894544 (
about) (
plain) (
blame)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#
msgid ""
msgstr ""
msgid ""
"title: Grep online repositories\n"
"date: 2020-08-28\n"
"layout: post\n"
"lang: en\n"
"ref: grep-online-repositories"
msgstr ""
msgid ""
"I often find interesting source code repositories online that I want to grep"
" for some pattern but I can't, because either:"
msgstr ""
msgid ""
"the repository is on [cgit](https://git.zx2c4.com/cgit/) or a similar code "
"repository that doesn't allow search in files, or;"
msgstr ""
msgid ""
"the search function is really bad, and doesn't allow me to use regular "
"expressions for searching patterns in the code."
msgstr ""
msgid ""
"Here's a simple script that allows you to overcome that problem easily:"
msgstr ""
msgid ""
"It is a wrapper around `git grep` that downloads the repository when "
"missing. Save in a file called `git-search`, make the file executable and "
"add it to your path."
msgstr ""
msgid "Overview:"
msgstr ""
msgid "*lines 1~2*:"
msgstr ""
msgid ""
"Bash shebang and the `set -eu` options to exit on error or undefined "
"variables."
msgstr ""
msgid "*lines 4~30*:"
msgstr ""
msgid "Usage text to be printed when providing less arguments than expected."
msgstr ""
msgid "*line 33*:"
msgstr ""
msgid "Extract the repository name from the URL, removing trailing slashes."
msgstr ""
msgid "*lines 34~37*:"
msgstr ""
msgid "Download the repository when missing and go to the folder."
msgstr ""
msgid "*line 39*:"
msgstr ""
msgid "Make the variable `$@` contain the rest of the unused arguments."
msgstr ""
msgid "*line 40*:"
msgstr ""
msgid "Perform `git grep`, forwarding the remaining arguments from `$@`."
msgstr ""
msgid "Example output:"
msgstr ""
msgid ""
"Subsequent greps on the same repository are faster because no download is "
"needed."
msgstr ""
msgid "When no argument is provided, it prints the usage text:"
msgstr ""
|