echo "Bandit report:" >> code_report.txt
bandit -r "$appdir" >> "$__dir"/code_report.txt
}
function publish () {
assert_env
if ! command -v twine &>/dev/null ; then
echo "Unable to find the 'twine' command."
echo "Install from PyPI, using 'pip install twine'."
exit 1
fi
if ! pip show wheel &>/dev/null ; then
echo "Unable to find the 'wheel' command."
echo "Install from PyPI, using 'pip install wheel'."
exit 1
fi
clean
log "building package"
Python3 setup.py sdist bdist_wheel
log "uploading to PyPi"
python3 -m twine upload dist/*
log "cleaning..."
clean
echo "You probably want to also tag the version now:"
echo "git tag -a ${VERSION} -m 'version ${VERSION}'"
echo "git push --tags"
}
function build () {
echo "build task not implemented"
}
function tester () {
echo "not implemented"
assert_env
# pytest ...
}
function buildprod {
echo "build task not implemented"
assert_env
# this runs in parallel
format & deps & tester &
wait
echo "not implemented"
# shiv ...
}
function run {
echo "running app with uvicorn"
assert_env
uvicorn --workers 2 app.main:app --reload --reload-dir "$appdir"
}
function default {
# start
clean
}
function tasks {
echo "$0 <task> <args>"
echo "Tasks:"
compgen -A function | cat -n
}
# Help message (extracted from script headers)
usage() { grep '^#/' "$0" | cut --characters=4-; exit 0; }
REGEX='(^|W)(-h|--help)($|W)'
[[ "$*" =~ $REGEX ]] && usage || true
TIMEFORMAT="Task completed in %3lR"
time ${@:-default}
?
【分享一个日常使用的一段shell脚本】
推荐阅读
- 脸瘦了是什么原因
- 生活小窍门美白
- 误闯红灯后,只要一个小动作,不用被扣6分
- 正确使用碳粉正确有效地使用碳粉
- |浙江台州一钓鱼爱好者,夜钓一个月,妻子家中偷腥八次
- 2020年12月4日是第几个宪法日?
- 表达爱一个人很深的句子有哪些?
- 生活中常见的日本豆腐主要原料是什么?
- 2021夏至日出时间和日落时间分别是多少?
- rp是什么意思?
