Compare commits
No commits in common. "2a16d6fe19139ff6a2e156302ab48762e432c9bf" and "7764173b97296abb8aaa6272e1a4a3ad0a843d60" have entirely different histories.
2a16d6fe19
...
7764173b97
2 changed files with 0 additions and 39 deletions
30
README.md
30
README.md
|
@ -7,33 +7,3 @@ SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
# paperless-client
|
# paperless-client
|
||||||
|
|
||||||
![pre-commit enabled](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)
|
![pre-commit enabled](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)
|
||||||
|
|
||||||
This simple client is a wrapper around the paperless-ng API. It allows you to
|
|
||||||
upload documents to your paperless-ng instance. By design it doesn't use
|
|
||||||
anything besides curl, so that it can be used in a wide range of environments,
|
|
||||||
like Alpine Linux or OpenWRT.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```text
|
|
||||||
curl -ROLf1 https://git.schmidl.dev/schtobia/paperless-client/raw/branch/master/paperless.sh
|
|
||||||
chmod +x paperless.sh
|
|
||||||
echo BASEURL=<your paperless-ng instance> > .env
|
|
||||||
echo TOKEN=<your paperless-ng token> >> .env
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```text
|
|
||||||
paperless.sh get_tasks | put_document <file>
|
|
||||||
|
|
||||||
commands:
|
|
||||||
get_tasks Get the list of tasks. This is not formatted, i.e. you'll
|
|
||||||
have to pipe it yourself through a formatter.
|
|
||||||
put_document Uploads the document under <file> to your paperless
|
|
||||||
instance.
|
|
||||||
|
|
||||||
return values:
|
|
||||||
If everything went alright, paperless.sh returns 0. Every other return
|
|
||||||
value indicates an error.
|
|
||||||
```
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
VERSION="1.0.0"
|
|
||||||
|
|
||||||
# load_env loads the .env file and checks if the necessary parameters are present.
|
|
||||||
load_env () {
|
load_env () {
|
||||||
[ ! -r "./.env" ] && { echo "env file not readable, please make sure a .env is present." >&2; exit 1; }
|
[ ! -r "./.env" ] && { echo "env file not readable, please make sure a .env is present." >&2; exit 1; }
|
||||||
. "./.env"
|
. "./.env"
|
||||||
|
@ -13,7 +10,6 @@ load_env () {
|
||||||
[ -z "$BASE_URL" ] && { echo "Parameter BASE_URL is not present in env file, please fill it with the URL of your paperless server." >&2; exit 1; }
|
[ -z "$BASE_URL" ] && { echo "Parameter BASE_URL is not present in env file, please fill it with the URL of your paperless server." >&2; exit 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
# print_usage prints the usage of the script.
|
|
||||||
print_usage () {
|
print_usage () {
|
||||||
cat << END_OF_COMMENT
|
cat << END_OF_COMMENT
|
||||||
$(basename "$0") get_tasks | put_document <file>
|
$(basename "$0") get_tasks | put_document <file>
|
||||||
|
@ -33,11 +29,6 @@ END_OF_COMMENT
|
||||||
|
|
||||||
AUTH_PARM="Authorization: Token $TOKEN"
|
AUTH_PARM="Authorization: Token $TOKEN"
|
||||||
|
|
||||||
|
|
||||||
echo "$(basename "$0") v${VERSION}"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
[ "$#" -lt 1 ] && { print_usage; exit 1; }
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
get_tasks)
|
get_tasks)
|
||||||
load_env
|
load_env
|
||||||
|
|
Loading…
Reference in a new issue