diff options
Diffstat (limited to 'po/eo/LC_MESSAGES/_tils/2020-08-28-grep-online-repositories.po')
-rw-r--r-- | po/eo/LC_MESSAGES/_tils/2020-08-28-grep-online-repositories.po | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/po/eo/LC_MESSAGES/_tils/2020-08-28-grep-online-repositories.po b/po/eo/LC_MESSAGES/_tils/2020-08-28-grep-online-repositories.po new file mode 100644 index 0000000..a339bb6 --- /dev/null +++ b/po/eo/LC_MESSAGES/_tils/2020-08-28-grep-online-repositories.po @@ -0,0 +1,184 @@ +# +msgid "" +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 "" + +msgid "" +"#!/usr/bin/env bash\n" +"set -eu\n" +"\n" +"end=\"\\033[0m\"\n" +"red=\"\\033[0;31m\"\n" +"red() { echo -e \"${red}${1}${end}\"; }\n" +"\n" +"usage() {\n" +" red \"Missing argument $1.\\n\"\n" +" cat <<EOF\n" +"Usage:\n" +" $0 <REGEX_PATTERN> <REPOSITORY_URL>\n" +"\n" +" Arguments:\n" +" REGEX_PATTERN Regular expression that \"git grep\" can search\n" +" REPOSITORY_URL URL address that \"git clone\" can download the repository from\n" +"\n" +"Examples:\n" +" Searching \"make get-git\" in cgit repository:\n" +" git search 'make get-git' https://git.zx2c4.com/cgit/\n" +" git search 'make get-git' https://git.zx2c4.com/cgit/ -- \\$(git rev-list --all)\n" +"EOF\n" +" exit 2\n" +"}\n" +"\n" +"\n" +"REGEX_PATTERN=\"${1:-}\"\n" +"REPOSITORY_URL=\"${2:-}\"\n" +"[[ -z \"${REGEX_PATTERN}\" ]] && usage 'REGEX_PATTERN'\n" +"[[ -z \"${REPOSITORY_URL}\" ]] && usage 'REPOSITORY_URL'\n" +"\n" +"mkdir -p /tmp/git-search\n" +"DIRNAME=\"$(echo \"${REPOSITORY_URL%/}\" | rev | cut -d/ -f1 | rev)\"\n" +"if [[ ! -d \"/tmp/git-search/${DIRNAME}\" ]]; then\n" +" git clone \"${REPOSITORY_URL}\" \"/tmp/git-search/${DIRNAME}\"\n" +"fi\n" +"pushd \"/tmp/git-search/${DIRNAME}\"\n" +"\n" +"shift 3 || shift 2 # when \"--\" is missing\n" +"git grep \"${REGEX_PATTERN}\" \"${@}\"\n" +msgstr "" + +msgid "" +"$ git search 'make get-git' https://git.zx2c4.com/cgit/\n" +"Clonage dans '/tmp/git-search/cgit'...\n" +"remote: Enumerating objects: 542, done.\n" +"remote: Counting objects: 100% (542/542), done.\n" +"remote: Compressing objects: 100% (101/101), done.\n" +"warning: object 51dd1eff1edc663674df9ab85d2786a40f7ae3a5: gitmodulesParse: could not parse gitmodules blob\n" +"remote: Total 7063 (delta 496), reused 446 (delta 441), pack-reused 6521\n" +"Réception d'objets: 100% (7063/7063), 8.69 Mio | 5.39 Mio/s, fait.\n" +"Résolution des deltas: 100% (5047/5047), fait.\n" +"/tmp/git-search/cgit ~/dev/libre/songbooks/docs\n" +"README: $ make get-git\n" +"\n" +"$ git search 'make get-git' https://git.zx2c4.com/cgit/\n" +"/tmp/git-search/cgit ~/dev/libre/songbooks/docs\n" +"README: $ make get-git\n" +msgstr "" + +msgid "" +"$ git search\n" +"Missing argument REGEX_PATTERN.\n" +"\n" +"Usage:\n" +" /home/andreh/dev/libre/dotfiles/scripts/ad-hoc/git-search <REGEX_PATTERN> <REPOSITORY_URL>\n" +"\n" +" Arguments:\n" +" REGEX_PATTERN Regular expression that \"git grep\" can search\n" +" REPOSITORY_URL URL address that \"git clone\" can download the repository from\n" +"\n" +"Examples:\n" +" Searching \"make get-git\" in cgit repository:\n" +" git search 'make get-git' https://git.zx2c4.com/cgit/\n" +" git search 'make get-git' https://git.zx2c4.com/cgit/ -- $(git rev-list --all)\n" +msgstr "" + +msgid "title: Grep online repositories" +msgstr "" + +msgid "date: 2020-08-28" +msgstr "" + +msgid "layout: post" +msgstr "" + +msgid "lang: en" +msgstr "" + +msgid "ref: grep-online-repositories" +msgstr "" + +msgid "eu_categories: git" +msgstr "" + +#~ msgid "" +#~ "title: Grep online repositories\n" +#~ "date: 2020-08-28\n" +#~ "layout: post\n" +#~ "lang: en\n" +#~ "ref: grep-online-repositories" +#~ msgstr "" |