rename notnotea to notes
parent
6c2f22f756
commit
e5e7276235
|
|
@ -1,12 +1,12 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
notnotea() (
|
notes() (
|
||||||
ids() {
|
ids() {
|
||||||
_recurse_ids "" "$(_tree)"
|
_recurse_ids "" "$(_tree)"
|
||||||
}
|
}
|
||||||
|
|
||||||
_tree() {
|
_tree() {
|
||||||
local cache_key="notnotea cache _tree"
|
local cache_key="notes cache _tree"
|
||||||
if cache get "$cache_key"; then
|
if cache get "$cache_key"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -14,7 +14,7 @@ notnotea() (
|
||||||
}
|
}
|
||||||
|
|
||||||
__tree() {
|
__tree() {
|
||||||
_nncurl $NNOTEA_ADDR/api/v0/tree
|
_nncurl $NOTES_ADDR/api/v0/tree
|
||||||
}
|
}
|
||||||
|
|
||||||
_nncurl() {
|
_nncurl() {
|
||||||
|
|
@ -59,16 +59,8 @@ notnotea() (
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
_tree_ids() {
|
|
||||||
_ncurl $NOTEA_ADDR/api/tree \
|
|
||||||
| jq '.items | to_entries[].value.id' \
|
|
||||||
| grep -v '^null$' \
|
|
||||||
| jq -r . \
|
|
||||||
| grep -v '^root$'
|
|
||||||
}
|
|
||||||
|
|
||||||
get() {
|
get() {
|
||||||
local cache_key="notnotea cache $1"
|
local cache_key="notes cache $1"
|
||||||
if cache get "$cache_key"; then
|
if cache get "$cache_key"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
@ -76,7 +68,7 @@ notnotea() (
|
||||||
}
|
}
|
||||||
|
|
||||||
_get() {
|
_get() {
|
||||||
_nncurl $NNOTEA_ADDR/api/v0/files/$1
|
_nncurl $NOTES_ADDR/api/v0/files/$1
|
||||||
}
|
}
|
||||||
|
|
||||||
put() {
|
put() {
|
||||||
|
|
@ -97,7 +89,7 @@ notnotea() (
|
||||||
-X PUT \
|
-X PUT \
|
||||||
-H "Title: $title" \
|
-H "Title: $title" \
|
||||||
-d @- \
|
-d @- \
|
||||||
$NNOTEA_ADDR/api/v0/files/$id
|
$NOTES_ADDR/api/v0/files/$id
|
||||||
}
|
}
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
|
|
@ -12,7 +12,7 @@ test_ids() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
notnotea eval "$(cat <<EOF
|
notes eval "$(cat <<EOF
|
||||||
_tree() { echo '$two_levels'; true; }
|
_tree() { echo '$two_levels'; true; }
|
||||||
(ids; true) | grep '^id$' > /dev/null || return 101
|
(ids; true) | grep '^id$' > /dev/null || return 101
|
||||||
(ids; true) | grep '^id\/subid$' > /dev/null || return 102
|
(ids; true) | grep '^id\/subid$' > /dev/null || return 102
|
||||||
|
|
@ -35,7 +35,7 @@ test_meta() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
notnotea eval "$(cat <<EOF
|
notes eval "$(cat <<EOF
|
||||||
_tree() { echo '$two_levels'; }
|
_tree() { echo '$two_levels'; }
|
||||||
meta id | jq .Title | grep -q top.level || return 201
|
meta id | jq .Title | grep -q top.level || return 201
|
||||||
meta id/subid | jq .Title | grep -q sub.level || return 202
|
meta id/subid | jq .Title | grep -q sub.level || return 202
|
||||||
|
|
@ -57,7 +57,7 @@ test__is_deleted() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
notnotea eval "$(cat <<EOF
|
notes eval "$(cat <<EOF
|
||||||
_tree() { echo '$two_levels'; }
|
_tree() { echo '$two_levels'; }
|
||||||
_is_deleted id || return 301
|
_is_deleted id || return 301
|
||||||
_is_deleted id/subid || return 302
|
_is_deleted id/subid || return 302
|
||||||
|
|
@ -40,7 +40,7 @@ one_test() (
|
||||||
each() {
|
each() {
|
||||||
export CACHE=$(mktemp -d)
|
export CACHE=$(mktemp -d)
|
||||||
export GITLAB_PAT=gibberish
|
export GITLAB_PAT=gibberish
|
||||||
export NOTEA_ADDR=http://127.0.0.1:61111
|
export NOTES_ADDR=http://127.0.0.1:61111
|
||||||
source ./cache.sh
|
source ./cache.sh
|
||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue