more zsh functions
This commit is contained in:
parent
5ef441d20d
commit
936ceae300
4 changed files with 64 additions and 0 deletions
4
home/private_dot_config/zsh/functions/allexts
Normal file
4
home/private_dot_config/zsh/functions/allexts
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/zsh
|
||||
##? Show all extensions in current folder structure.
|
||||
|
||||
find . -not \( -path '*/.git/*' -prune \) -type f -name '*.*' | sed 's|.*\.|\.|' | sort | uniq -c
|
5
home/private_dot_config/zsh/functions/noext
Normal file
5
home/private_dot_config/zsh/functions/noext
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/zsh
|
||||
##? noext - Find files with no file extension
|
||||
|
||||
# for fun, rename with: noext -exec mv '{}' '{}.sql' \;
|
||||
find . -not \( -path '*/.git/*' -prune \) -type f ! -name '*.*'
|
52
home/private_dot_config/zsh/functions/showcolors
Normal file
52
home/private_dot_config/zsh/functions/showcolors
Normal file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/zsh
|
||||
##? showcolors - display colors and color codes
|
||||
##?
|
||||
##? usage: showcolors
|
||||
|
||||
# function showcolors {
|
||||
local normal=$(tput sgr0)
|
||||
typeset -A colors=(
|
||||
0 black
|
||||
1 red
|
||||
2 green
|
||||
3 yellow
|
||||
4 blue
|
||||
5 magenta
|
||||
6 cyan
|
||||
7 white
|
||||
8 brblack
|
||||
9 brred
|
||||
10 brgreen
|
||||
11 bryellow
|
||||
12 brblue
|
||||
13 brmagenta
|
||||
14 brcyan
|
||||
15 brwhite
|
||||
)
|
||||
|
||||
typeset -A effects=(
|
||||
bold bold
|
||||
dim dim
|
||||
italic sitm
|
||||
reverse rev
|
||||
standout smso
|
||||
underline smul
|
||||
)
|
||||
|
||||
local id
|
||||
for id in ${(kno)colors}; do
|
||||
color=$colors[$id]
|
||||
printf "%5s %-25s %5s %-25s %-10s\n" $(tput setaf $id) "foreground ${color}" $(tput sgr0) "tput setaf $id" ${$(tput setaf $id):q}
|
||||
done
|
||||
for id in ${(kno)colors}; do
|
||||
color=$colors[$id]
|
||||
printf "%5s %-30s %11s %-25s %-10s\n" $(tput setab $id) "$(tput setaf 7)background $(tput setaf 0)${color}" $(tput sgr0) "tput setab $id" ${$(tput setab $id):q}
|
||||
done
|
||||
|
||||
local name code
|
||||
for name in ${(kno)effects}; do
|
||||
code=$effects[$name]
|
||||
printf "%5s %-24s %5s %-25s %-10s\n" $(tput $code) "effect ${name}" $(tput sgr0) "tput $code" ${$(tput $code):q}
|
||||
done
|
||||
printf "%1s %-25s %-25s\n" "" "normal" "tput sgr0"
|
||||
# }
|
3
home/private_dot_config/zsh/functions/weather
Normal file
3
home/private_dot_config/zsh/functions/weather
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/zsh
|
||||
# What is the weather?
|
||||
curl "http://wttr.in/$1"
|
Loading…
Reference in a new issue