From 3965efef891a05cf94977dc4971f7d81fb65f773 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Wed, 2 Feb 2022 16:09:25 +0300 Subject: [PATCH] make additional options configurable with file (#36) Signed-off-by: R4SAS --- README.md | 50 ++++++++++++++++++++++---------------------------- README.rst | 22 ++++++++++++++++++++-- pbincli/cli.py | 9 +++++++-- 3 files changed, 49 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 0019594..e706c9f 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,11 @@ [![GitHub tag](https://img.shields.io/github/tag/r4sas/PBinCLI.svg)](https://github.com/r4sas/PBinCLI/tags/) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4f24f43356a84621bbd9078c4b3f1b70)](https://www.codacy.com/gh/r4sas/PBinCLI/dashboard?utm_source=github.com&utm_medium=referral&utm_content=r4sas/PBinCLI&utm_campaign=Badge_Grade) -PBinCLI -===== +# PBinCLI PBinCLI is command line client for [PrivateBin](https://github.com/PrivateBin/PrivateBin/) written on Python 3. -Installing -===== +# Installing Installation inside `virtualenv`: ```bash @@ -24,8 +22,7 @@ pip3 install pbincli *Note*: if you used installation with `virtualenv`, don't forget to activate it before usage: call `. /path/to/venv/bin/activate` in terminal -Configuration -===== +# Configuration By default pbincli configured to use `https://paste.i2pd.xyz/` for sending and receiving pastes. No proxy used by default. @@ -33,41 +30,42 @@ You can create config file to use different settings. Configuration file is searched in `~/.config/pbincli/pbincli.conf`, `%APPDATA%/pbincli/pbincli.conf` (Windows) and `~/Library/Application Support/pbincli/pbincli.conf` (MacOS) -Example contents ------ +## Example contents ```ini server=https://paste.i2pd.xyz/ proxy=http://127.0.0.1:3128 ``` -All possible options for configuration file ------ +## All possible options for configuration file | Option | Default | Possible value | |----------------------|-------------------------|----------------| | server | https://paste.i2pd.xyz/ | Domain ending with slash | | mirrors | None | Domains separated with comma, like `http://privatebin.ygg/,http://privatebin.i2p/` | | proxy | None | Proxy address starting with scheme `http://` or `socks5://` | +| expire | 1day | 5min / 10min / 1hour / 1day / 1week / 1month / 1year / never | +| burn | False | True / False | +| discus | False | True / False | +| format | plaintext | plaintext / syntaxhighlighting / markdown | | short | False | True / False | | short_api | None | `tinyurl`, `clckru`, `isgd`, `vgd`, `cuttly`, `yourls`, `custom` | -| short_url | None | Domain name of shortener service for `yourls`, or sortener URL (with required parameters) for `custom` | +| short_url | None | Domain name of shortener service for `yourls`, or URL (with required parameters) for `custom` | | short_user | None | Used only in `yourls` | | short_pass | None | Used only in `yourls` | | short_token | None | Used only in `yourls` | | no_check_certificate | False | True / False | | no_insecure_warning | False | True / False | +| compression | zlib | zlib / none | -Usage -===== +# Usage Tool available by command `pbincli`, help for every command can be called with `-h` option: ```bash pbincli {send|get|delete} -h ``` -Sending ------ +## Sending * Sending text: ```bash @@ -91,10 +89,11 @@ pbincli send -f info.pdf -t "I'm sending my document." pbincli send -q -f info.pdf ``` -*Note*: It is possible to set-up paste parameters such as burning after reading, expiritaion time, formatting, enabling discussions, and changing compression algorithm. Please refer to `pbincli send -h` output for more information. +### Other options -Receiving ------ +It is possible to set-up paste parameters such as burning after reading, expiritaion time, formatting, enabling discussions, and changing compression algorithm. Please refer to `pbincli send -h` output for more information. + +## Receiving To retrieve paste from server, use `get` command with paste info. @@ -104,8 +103,7 @@ pbincli get xxx#yyy ### receive paste xxx from https://pa pbincli get https://example.com/?xxx#yyy ### receive paste xxx from https://example.com/ ``` -Deletion ------ +## Deletion To delete paste from server, use `delete` command with required `-p` and `-t` options: ```bash @@ -114,13 +112,11 @@ pbincli delete -p xxx -t deletetoken If you need to delete paste on different server that configured, use `-s` option with instance URL. -Additional examples -===== +# Additional examples Here you can find additional examples. -Usage with service available inside I2P ------ +## Usage with service available inside I2P Change settings to use server `http://privatebin.i2p/` and proxy `http://127.0.0.1:4444`. Here's example for configuration file: ```ini @@ -128,8 +124,7 @@ server=http://privatebin.i2p/ proxy=http://127.0.0.1:4444 ``` -Using tool with aliases ------ +## Using tool with aliases Example of alias to send paste from `stdin` direclty to I2P service: ```bash @@ -138,7 +133,6 @@ alias pastei2p="echo 'paste the text to stdin' && pbincli send -s http://private Call it by running `pastei2p` in terminal. -License -===== +# License This project is licensed under the MIT license, which can be found in the file [LICENSE](https://github.com/r4sas/PBinCLI/blob/master/LICENSE) in the root of the project source code. diff --git a/README.rst b/README.rst index c68332a..e8c705e 100644 --- a/README.rst +++ b/README.rst @@ -74,6 +74,18 @@ All possible options for configuration file * - proxy - None - Proxy address starting with scheme ``http://`` or ``socks5://`` + * - expire + - 1day + - 5min / 10min / 1hour / 1day / 1week / 1month / 1year / never + * - burn + - False + - True / False + * - discus + - False + - True / False + * - format + - plaintext + - plaintext / syntaxhighlighting / markdown * - short - False - True / False @@ -82,7 +94,7 @@ All possible options for configuration file - ``tinyurl``\ , ``clckru``\ , ``isgd``\ , ``vgd``\ , ``cuttly``\ , ``yourls``\ , ``custom`` * - short_url - None - - Domain name of shortener service for ``yourls``\ , or sortener URL (with required parameters) for ``custom`` + - Domain name of shortener service for ``yourls``\ , or URL (with required parameters) for ``custom`` * - short_user - None - Used only in ``yourls`` @@ -98,6 +110,9 @@ All possible options for configuration file * - no_insecure_warning - False - True / False + * - compression + - zlib + - zlib / none Usage @@ -143,7 +158,10 @@ Sending pbincli send -q -f info.pdf -*Note*\ : It is possible to set-up paste parameters such as burning after reading, expiritaion time, formatting, enabling discussions, and changing compression algorithm. Please refer to ``pbincli send -h`` output for more information. +Other options +^^^^^^^^^^^^^ + +It is possible to set-up paste parameters such as burning after reading, expiritaion time, formatting, enabling discussions, and changing compression algorithm. Please refer to ``pbincli send -h`` output for more information. Receiving --------- diff --git a/pbincli/cli.py b/pbincli/cli.py index 0492bd0..1f46f6f 100755 --- a/pbincli/cli.py +++ b/pbincli/cli.py @@ -105,8 +105,12 @@ def main(): CONFIG = { 'server': 'https://paste.i2pd.xyz/', - 'mirrors': None, # real example for paste.i2pd.xyz: 'http://privatebin.ygg/,http://privatebin.i2p/' + 'mirrors': None, 'proxy': None, + 'expire': None, + 'burn': False, + 'discus': False, + 'format': None, 'short': False, 'short_api': None, 'short_url': None, @@ -114,7 +118,8 @@ def main(): 'short_pass': None, 'short_token': None, 'no_check_certificate': False, - 'no_insecure_warning': False + 'no_insecure_warning': False, + 'compression': None } # Configuration preference order: