chore: Use grep -E / grep -F instead of egrep / fgrep (#2164)
Ensures that the -E or -F option, when used, is the first option * i.e. grep -oE => grep -E -o Updates _bash-it-grep to invoke grep with just the provided arguments * This function was (and still is) unused, but decided this new functionality was actually more useful Introduces _bash-it-fgrep to invoke grep -F Removes type -P egrep from the _bash-it-*grep functions For usages that were already going to be modified, use -F if appropriate * Does not touch grep usages that may have benefited from -F, but were not otherwise considered for this PR Adds shellcheck header to modified .bash files that didn't already have it
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
#
|
||||
# Bash completion support for Fabric (http://fabfile.org/)
|
||||
#
|
||||
@@ -91,7 +91,7 @@ function __fab_completion() {
|
||||
-*)
|
||||
if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]; then
|
||||
export __FAB_COMPLETION_LONG_OPT=$(
|
||||
fab --help | egrep -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
|
||||
fab --help | grep -E -o "\-\-[A-Za-z_\-]+\=?" | sort -u)
|
||||
fi
|
||||
opts="${__FAB_COMPLETION_LONG_OPT}"
|
||||
;;
|
||||
@@ -101,7 +101,7 @@ function __fab_completion() {
|
||||
# -*)
|
||||
# if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]; then
|
||||
# export __FAB_COMPLETION_SHORT_OPT=$(
|
||||
# fab --help | egrep -o "^ +\-[A-Za-z_\]" | sort -u)
|
||||
# fab --help | grep -E -o "^ +\-[A-Za-z_\]" | sort -u)
|
||||
# fi
|
||||
# opts="${__FAB_COMPLETION_SHORT_OPT}"
|
||||
# ;;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Copyright (c) 2017 Eric Wendelin
|
||||
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
@@ -66,7 +68,7 @@ __gradle-generate-script-cache() {
|
||||
|
||||
if [[ ! $(find $cache_dir/$cache_name -mmin -$cache_ttl_mins 2>/dev/null) ]]; then
|
||||
# Cache all Gradle scripts
|
||||
local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | egrep -v "$script_exclude_pattern")
|
||||
local gradle_build_scripts=$(find $project_root_dir -type f -name "*.gradle" -o -name "*.gradle.kts" 2>/dev/null | grep -E -v "$script_exclude_pattern")
|
||||
printf "%s\n" "${gradle_build_scripts[@]}" > $cache_dir/$cache_name
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Bash completion for Makefile
|
||||
# Loosely adapted from http://stackoverflow.com/a/38415982/1472048
|
||||
|
||||
@@ -17,7 +19,7 @@ _makecomplete() {
|
||||
for f in "${files[@]}" ; do
|
||||
while IFS='' read -r line ; do
|
||||
targets+=("$line")
|
||||
done < <(grep -oE '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
|
||||
done < <(grep -E -o '^[a-zA-Z0-9_-]+:([^=]|$)' "$f" | cut -d':' -f1)
|
||||
done
|
||||
|
||||
[ "${#targets[@]}" -eq 0 ] && return 0
|
||||
|
||||
Reference in New Issue
Block a user