Commit 0bf5a61c4267288cbe2a8128a526aad38e99e734
1 parent
23ddf43369
Removing -q and -m as grep args.
Any instances using -q have been redirected to /dev/null. Any instances using -m1 now use l or are piped into head -n1.
Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff
antigen.zsh
| ... | ... | @@ -271,7 +271,7 @@ antigen-revert () { |
| 271 | 271 | # Source the plugin script. |
| 272 | 272 | # FIXME: I don't know. Looks very very ugly. Needs a better |
| 273 | 273 | # implementation once tests are ready. |
| 274 | - local script_loc="$(ls "$location" | grep -m1 '\.plugin\.zsh$')" | |
| 274 | + local script_loc="$(ls "$location" | grep '\.plugin\.zsh$' | head -n1)" | |
| 275 | 275 | |
| 276 | 276 | if [[ -f $location/$script_loc ]]; then |
| 277 | 277 | # If we have a `*.plugin.zsh`, source it. |
| ... | ... | @@ -288,12 +288,12 @@ antigen-revert () { |
| 288 | 288 | source "$location/init.zsh" |
| 289 | 289 | fi |
| 290 | 290 | |
| 291 | - elif ls "$location" | grep -qm1 '\.zsh$'; then | |
| 291 | + elif ls "$location" | grep -l '\.zsh$' &> /dev/null; then | |
| 292 | 292 | # If there is no `*.plugin.zsh` file, source *all* the `*.zsh` |
| 293 | 293 | # files. |
| 294 | 294 | for script ($location/*.zsh(N)) source "$script" |
| 295 | 295 | |
| 296 | - elif ls "$location" | grep -qm1 '\.sh$'; then | |
| 296 | + elif ls "$location" | grep -l '\.sh$' &> /dev/null; then | |
| 297 | 297 | # If there are no `*.zsh` files either, we look for and source any |
| 298 | 298 | # `*.sh` files instead. |
| 299 | 299 | for script ($location/*.sh(N)) source "$script" |
| ... | ... | @@ -573,7 +573,7 @@ antigen () { |
| 573 | 573 | local name="${${name_spec%\?}%:}" |
| 574 | 574 | local value="$1" |
| 575 | 575 | |
| 576 | - if echo "$code" | grep -qm1 "^local $name="; then | |
| 576 | + if echo "$code" | grep -l "^local $name=" &> /dev/null; then | |
| 577 | 577 | echo "Argument '$name' repeated with the value '$value'". >&2 |
| 578 | 578 | return |
| 579 | 579 | fi |
| ... | ... | @@ -615,13 +615,13 @@ antigen () { |
| 615 | 615 | local value="${arg#*=}" |
| 616 | 616 | fi |
| 617 | 617 | |
| 618 | - if echo "$code" | grep -qm1 "^local $name="; then | |
| 618 | + if echo "$code" | grep -l "^local $name=" &> /dev/null; then | |
| 619 | 619 | echo "Argument '$name' repeated with the value '$value'". >&2 |
| 620 | 620 | return |
| 621 | 621 | fi |
| 622 | 622 | |
| 623 | 623 | # The specification for this argument, used for validations. |
| 624 | - local arg_line="$(echo "$keyword_args" | grep -m1 "^$name:\??\?")" | |
| 624 | + local arg_line="$(echo "$keyword_args" | grep "^$name:\??\?" | head -n1)" | |
| 625 | 625 | |
| 626 | 626 | # Validate argument and value. |
| 627 | 627 | if [[ -z $arg_line ]]; then |
| ... | ... | @@ -629,12 +629,12 @@ antigen () { |
| 629 | 629 | echo "Unknown argument '$name'." >&2 |
| 630 | 630 | return |
| 631 | 631 | |
| 632 | - elif (echo "$arg_line" | grep -qm1 ':') && [[ -z $value ]]; then | |
| 632 | + elif (echo "$arg_line" | grep -l ':' &> /dev/null) && [[ -z $value ]]; then | |
| 633 | 633 | # This argument needs a value, but is not provided. |
| 634 | 634 | echo "Required argument for '$name' not provided." >&2 |
| 635 | 635 | return |
| 636 | 636 | |
| 637 | - elif (echo "$arg_line" | grep -vqm1 ':') && [[ ! -z $value ]]; then | |
| 637 | + elif (echo "$arg_line" | grep -vl ':' &> /dev/null) && [[ ! -z $value ]]; then | |
| 638 | 638 | # This argument doesn't need a value, but is provided. |
| 639 | 639 | echo "No argument required for '$name', but provided '$value'." >&2 |
| 640 | 640 | return |