Updates web-search and welcome-banner

This commit is contained in:
Alicia Sykes 2022-08-06 20:25:55 +01:00
parent 300f426b15
commit 20467f3a8c
3 changed files with 77 additions and 55 deletions

View File

@ -91,6 +91,9 @@ ws_reddit() {
ws_maps() {
ws_make_search 'https://www.google.com/maps/search/' $@
}
ws_grepapp() {
ws_make_search 'https://grep.app/search?q=' $@
}
# Lists availible search options
web_search() {
@ -106,6 +109,7 @@ web_search() {
[[ $@ == "reddit"* ]] && ws_reddit "${@/reddit/}" && return
[[ $@ == "maps"* ]] && ws_maps "${@/maps/}" && return
[[ $@ == "google"* ]] && ws_google "${@/google/}" && return
[[ $@ == "grepapp"* ]] && ws_grepapp "${@/grepapp/}" && return
fi
# Otherwise show menu input for search engines
choices=(
@ -124,6 +128,7 @@ web_search() {
wolframalpha) ws_wolframalpha $@; return;;
reddit) ws_reddit $@; return;;
maps) ws_maps $@; return;;
grepapp) ws_grepapp $@; return;;
help) show_ws_help;;
quit) break ;;
*)
@ -144,6 +149,7 @@ alias wswa='ws_wolframalpha'
alias wsrdt='ws_reddit'
alias wsmap='ws_maps'
alias wsggl='ws_google'
alias wsgra='ws_grepapp'
# Set ws alias, only if not used by another program
if ! hash ws 2> /dev/null; then
@ -177,6 +183,7 @@ show_ws_help() {
echo -e ' \033[0;35mReddit: \x1b[2m$ ws reddit or ($ wsrdt)\e[0m'
echo -e ' \033[0;35mMaps: \x1b[2m$ ws maps or ($ wsmap)\e[0m'
echo -e ' \033[0;35mGoogle: \x1b[2m$ ws google or ($ wsggl)\e[0m'
echo -e ' \033[0;35mGoogle: \x1b[2m$ ws grepapp or ($ wsgra)\e[0m'
echo -e '\e[0m'
}

View File

@ -1,8 +1,9 @@
#!/bin/bash
# Welcome script, prints time-based greeting and system info
# Welcome script, prints personalised, time-based greeting and system info
# Licensed under MIT, (C) Alicia Sykes 2021: https://aliciasykes.com
function welcome() {
# Determine greeting based on the time of day
h=`date +%H`
if [ $h -lt 04 ] || [[ $h -gt 22 ]]; then greeting="Good Night"
@ -57,4 +58,17 @@ echo -en "$COLOR_S🌐 IP: "
curl -s -m $timeout "https://ipinfo.io/ip"
echo -en " (${ip_address} on ${ip_interface})\033[0m\n"
}
# Determine if file is being run directly or sourced
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] ||
[[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" &&
printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] ||
[[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)) && sourced=1 || sourced=0
# If script being called directly run immediatley
if [ $sourced -eq 0 ]; then
welcome $@
fi
# EOF

View File

@ -13,6 +13,7 @@ if !filereadable(expand(vim_plug_location))
echom "Vim Plug not found, downloading to '" . vim_plug_location . "'"
execute '!curl -o ' . vim_plug_location . ' --create-dirs' .
\ ' https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
echom "Next, run :PlugInstall to install all plugins"
endif
" If Plugins directory not yet exist, create it