-
Notifications
You must be signed in to change notification settings - Fork 0
π Tips
yukihirop edited this page Jan 23, 2021
·
5 revisions
It is recommended to use alias after disabling the -n (--count) option of googler.
e.g.)
function gfzs_google_fuzzy_search(){
FLAG_N=0
FLAG_S=0
GFZS_SCORE=30
googler_input=()
for OPT in "$@"
do
case $OPT in
-n | --count)
FLAG_N=1
;;
-s | --score)
FLAG_S=1
GFZS_SCORE=$2
shift
;;
*)
googler_input+=($1)
;;
esac
if [ $# -ne 0 ]; then shift; fi
done
if [ "$FLAG_N" -eq 1 ]; then
echo "Can't use -n(--count) option"
else
local res
if [ "$FLAG_S" -eq 1 ]; then
res=$(googler --json $googler_input | gfzs -s $GFZS_SCORE)
else
res=$(googler --json $googler_input | gfzs)
fi
if [ "$res" != "" ]; then
echo $res
fi
fi
}
alias ggr=gfzs_google_fuzzy_search
$ ggr python scipy -s 60