Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

stgarf/paperless-cli

paperless-cli

license Build Status

badge Stargazers over time

Table of Contents

Description

A CLI tool written in Go to interface with a Paperless instance.

Installation and usage

Prerequisites

You should have a working Go environment and have $GOPATH/bin in your $PATH.

Precompiled binary

You can get a precompiled binary from the releases page (soon).

Self-compiled binary

To download source, compile, and install, run:

$ go get -u github.com/stgarf/paperless-cli
$ $GOPATH/src/github.com/stgarf/paperless-cli/build.sh

The source code will be located in $GOPATH/src/github.com/stgarf/paperless-cli.

A newly compiled binary will be in $GOPATH/src/github.com/stgarf/paperless-cli/bin/

You can place the binary in you $PATH for easy usage. e.g.

$ cp $GOPATH/src/github.com/stgarf/paperless-cli/bin/paperless-cli $GOPATH/bin

$ which paperless-cli should return the path to the newly installed binary.

Usage

Check paperless-cli version

$ paperless-cli version
paperless-cli v0.6.0 built on 2019-03-10T16:28:33Z from git:c8dd2e7-clean (master) by user@chrx

Setting up a config

You can set up a basic YAML-based configuration to be read by placing it in $HOME/.paperless-cli.yaml.

A base config can be autogenerated with paperless-cli config create.

Here's an example configuration:

# A basic paperless-cli configuration file.

# The hostname of the Paperless instance.
hostname: localhost
# Connect via HTTP or HTTPS.
use_https: false
# Port the Paperless instance is listening on.
port: 8000
# Path to the API root.
root: /api
# Username to auth to Paperless instance.
username: myUsername
# Username to auth to Paperless instance.
password: mYpa$$w0rd.is.h0p3fully.s3cur3!!1

Development

Prerequisites

You should have a working Go environment and have $GOPATH/bin in your $PATH.

Get the code

To download the source code, run:

$ go get -du github.com/stgarf/paperless-cli

The source code will be located in $GOPATH/src/github.com/stgarf/paperless-cli.

Running the tests

$ go test

Really though, there are none and need to be written.

Built With

  • cobra - A Commander for modern Go CLI interactions
  • logrus - Structured, pluggable logging for Go
  • gjson - Get JSON values quickly - JSON Parser for Go
  • viper - Go configuration with fangs
  • go-fqdn - Simple wrapper around net and os golang standard libraries providing Fully Qualified Domain Name of the machine
  • go-homedir - Go library for detecting and expanding the user's home directory without cgo
  • govvv - "go build" wrapper to add version info to Golang applications

Contributing

Please read CONTRIBUTING.md for details on the code of conduct, and the process for submitting pull requests to the project.

Versioning

We use SemVer for versioning, roughly. For the versions available, see the tags on this repository.

Authors

  • Steve Garf - Initial CLI work - stgarf
  • Zibby Mofrad - Document Download option - zibby

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache License - see the LICENSE file for details.

Acknowledgments

  • Daniel Quinn for starting Paperless and the awesome community of people maintaining Paperless
  • Seth Junot for rubber duck debugging - xSetech
  • Hat tip to anyone whose code was imported!