From a647b0c5b780cb2302d84f2c2c75544b8c6e95df Mon Sep 17 00:00:00 2001 From: dece Date: Thu, 19 May 2022 13:26:12 +0200 Subject: [PATCH] py-pdf-docs: tiny script to open Python PDF docs --- py-pdf-docs.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 py-pdf-docs.sh diff --git a/py-pdf-docs.sh b/py-pdf-docs.sh new file mode 100755 index 0000000..4a6ddcc --- /dev/null +++ b/py-pdf-docs.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Open Python PDF docs. + +if [ ! -v PYTHON_DOCS_PATH ]; then + echo "You need to define PYTHON_DOCS_PATH." + exit +fi + +if [[ -n "$1" ]]; then + filename="$(find "$PYTHON_DOCS_PATH" -type f -name "*$1*" | head -n 1)" +else + filename="$PYTHON_DOCS_PATH/library.pdf" +fi + +nohup open "$filename" > /dev/null 2>&1