blob: 86a937f83487f9555906758e8784742969f22834 [file]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
version: "3"
env:
KUBECONFIG:
sh: |
if test -e $($OPS -opspath "$OPS_TMP/kubeconfig")
then echo $($OPS -opspath "$OPS_TMP/kubeconfig")
else echo ~/.kube/config
fi
APIHOST:
sh: |
if test -e ~/.wskprops
then source ~/.wskprops; echo $APIHOST
fi
AUTHB64:
sh: |
if test -e ~/.wskprops
then source ~/.wskprops; echo $(base64 -e $AUTH)
fi
tasks:
# read a value, empty is not accepted
readforce:
silent: true
cmds:
- test -n "{{.VAR}}" || die "specify variable VAR="
- test -n "{{.MSG}}" || die "specify message MSG="
- |
input="{{.VAL}}"
length=${#input}
while [ "$length" -eq "0" ]; do
echo "*** Please, specify {{.MSG}} and press enter."
test -n "{{.HINT}}" && echo "{{.HINT}}"
{{if eq OS "windows"}}
input=$(powershell "(Read-Host -Prompt '{{.MSG}}')")
input=${input%?} # For some reason, powershell adds a character (\n?) at the end
{{else}}
read -p "{{.MSG}}: " input
{{end}}
length=${#input}
echo $length
done
config {{.VAR}}="$input"
find:
desc: returns the documents existing into the specified collection
silent: true
cmds:
- bun ferretdb.js find {{._collection_}} {{.__format}}
delete:
desc: remove all the documents inside the specified collection
silent: true
cmds:
- bun ferretdb.js delete {{._collection_}}
submit:
desc: submit a json document containing valid ferretdb/mongodb json commands
silent: true
cmds:
- bun ferretdb.js submit {{._collection_}} {{._jsonfile_}} {{.__format}}
command:
desc: send a command to mongodb
silent: true
cmds:
- bun ferretdb.js command {{._jsonfile_}} {{.__format}}