mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
version 0.1 from current upstream project https://github.com/mbauhardt/oh-my-zsh-bootstrap
This commit is contained in:
parent
c79e5a97a9
commit
a51a305d18
5 changed files with 215 additions and 0 deletions
40
plugins/oh-my-zsh-bootstrap/lib/map.zsh
Normal file
40
plugins/oh-my-zsh-bootstrap/lib/map.zsh
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
mapdir=$ZSH_BOOTSTRAP/data
|
||||
|
||||
_map_init() {
|
||||
mkdir -p $mapdir
|
||||
}
|
||||
|
||||
_map_put() {
|
||||
[[ "$#" != 3 ]] && return 1
|
||||
mapname=$1; key=$2; value=$3
|
||||
[[ -d "${mapdir}/${mapname}" ]] || mkdir "${mapdir}/${mapname}"
|
||||
echo $value >"${mapdir}/${mapname}/${key}"
|
||||
}
|
||||
|
||||
_map_get() {
|
||||
[[ "$#" != 2 ]] && return 1
|
||||
mapname=$1; key=$2
|
||||
cat "${mapdir}/${mapname}/${key}"
|
||||
}
|
||||
|
||||
_map_keys() {
|
||||
[[ "$#" != 1 ]] && return 1
|
||||
mapname=$1
|
||||
for key ($mapdir/$mapname/*); do
|
||||
basename $key
|
||||
done
|
||||
}
|
||||
|
||||
_map_exists() {
|
||||
[[ "$#" != 2 ]] && return 1
|
||||
mapname=$1; key=$2
|
||||
[[ -f "${mapdir}/${mapname}/${key}" ]] && return 0
|
||||
}
|
||||
|
||||
_map_remove() {
|
||||
[[ "$#" != 2 ]] && return 1
|
||||
mapname=$1; key=$2
|
||||
rm "${mapdir}/${mapname}/${key}"
|
||||
}
|
||||
_map_init
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue