#!/bin/sh
-case "$(lang "$file")" in
+case "$(lang "${file:?}")" in
C|JavaScript)
sed 's/^/\/\//g' "$@" ;;
*) sed 's/^/#/g' "$@" ;;
#!/bin/sh
-case "$(lang "$file")" in
+case "$(lang "${file:?}")" in
C|JavaScript)
sed 's/^\/\///g' "$@" ;;
*) sed 's/^#//g' "$@" ;;
orig="$1"
path="${orig%/*}"
file="${orig##*/}"
-[ "$path" == "$file" ] && path="."
+[ "$path" = "$file" ] && path="."
printf "%s" "$(find "$path" -path "$path/$file*" | pick "$path/$file")"
dir='.'
usage(){
- echo "Usage: pfind DIR PATTERN [FLAGS]"
- echo "Usage: pfind PATTERN"
+ echo "Usage: findall DIR PATTERN [FLAGS]"
+ echo "Usage: findall PATTERN"
exit 1
}
#!/bin/sh
-case "$(lang "$file")" in
+case "$(lang "${file:?}")" in
ML|Python|Ruby)
sed 's/^/ /g' "$@" ;;
*) sed 's/^/ /g' "$@" ;;
#!/bin/sh
-case "$(lang "$file")" in
+case "$(lang "${file:?}")" in
ML|Python|Ruby)
sed -E 's/^( ?| ? ?)//g' "$@" ;;
*) sed -E 's/^( ?| ? ? ? ?)//g' "$@" ;;
filename=$(basename -- "$file")
extension="${filename##*.}"
-if [ "$extension" == "c" ]; then
+if [ "$extension" = "c" ]; then
filename="${filename%.*}.h"
-elif [ "$extension" == "h" ]; then
+elif [ "$extension" = "h" ]; then
filename="${filename%.*}.c"
fi
#!/bin/sh
-sed 's_\/\/\(.*\)$_\/*\1 *\/_g'
+sed "s_//\(.*\)\$_/*\1 */_"
#!/bin/sh
path="$PWD"
-while [[ "$path" != "" ]]; do
+while [ "$path" != "" ]; do
find "$path" -maxdepth 1 -mindepth 1 "$@"
path="${path%/*}"
done
fi
export PICKTITLE="Pick File ($PWD)"
-file="$(find $1 -not -path '*/\.*' -type f | sed 's|^\./||' | pick)"
+file="$(find "$1" -not -path '*/\.*' -type f | sed 's|^\./||' | pick)"
[ "" != "$file" ] && edit "$file"
exit 1
}
-if [ "" == "$TAGFILE" ] || [ "" == "$ACTION" ]; then
+if [ "" = "$TAGFILE" ] || [ "" = "$ACTION" ]; then
usage
fi
printtags(){
- cat "$TAGFILE" | grep -v '^!' | cut -f1 | uniq
+ grep -v '^!' < "$TAGFILE" | cut -f1 | uniq
}
print(){
tag="$(printtags | pick "$TAG")"
- [ "" == "$tag" ] && tag="$TAG"
+ [ "" = "$tag" ] && tag="$TAG"
printf "%s" "$tag"
}
fetch(){
- if [ "" == "$TAG" ]; then
+ if [ "" = "$TAG" ]; then
TAG=$(printtags | pick)
- [ "" == "$TAG" ] && exit
+ [ "" = "$TAG" ] && exit
fi
file=$(awk -v TAG="$TAG" '
BEGIN { FS = "[\t]+" }
#!/bin/sh
-chmod +w "$file"
\ No newline at end of file
+chmod +w "${file:?}"
\ No newline at end of file
#!/bin/sh
-chmod +x "$file"
\ No newline at end of file
+chmod +x "${file:?}"
\ No newline at end of file