Browse Source

make additional options configurable with file (#36)

Signed-off-by: R4SAS <r4sas@i2pmail.org>
gha
R4SAS 2 years ago
parent
commit
3965efef89
Signed by untrusted user: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 50
      README.md
  2. 22
      README.rst
  3. 9
      pbincli/cli.py

50
README.md

@ -2,13 +2,11 @@
[![GitHub tag](https://img.shields.io/github/tag/r4sas/PBinCLI.svg)](https://github.com/r4sas/PBinCLI/tags/) [![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&amp;utm_medium=referral&amp;utm_content=r4sas/PBinCLI&amp;utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/4f24f43356a84621bbd9078c4b3f1b70)](https://www.codacy.com/gh/r4sas/PBinCLI/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=r4sas/PBinCLI&amp;utm_campaign=Badge_Grade)
PBinCLI # PBinCLI
=====
PBinCLI is command line client for [PrivateBin](https://github.com/PrivateBin/PrivateBin/) written on Python 3. PBinCLI is command line client for [PrivateBin](https://github.com/PrivateBin/PrivateBin/) written on Python 3.
Installing # Installing
=====
Installation inside `virtualenv`: Installation inside `virtualenv`:
```bash ```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 *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. 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) 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 ```ini
server=https://paste.i2pd.xyz/ server=https://paste.i2pd.xyz/
proxy=http://127.0.0.1:3128 proxy=http://127.0.0.1:3128
``` ```
All possible options for configuration file ## All possible options for configuration file
-----
| Option | Default | Possible value | | Option | Default | Possible value |
|----------------------|-------------------------|----------------| |----------------------|-------------------------|----------------|
| server | https://paste.i2pd.xyz/ | Domain ending with slash | | server | https://paste.i2pd.xyz/ | Domain ending with slash |
| mirrors | None | Domains separated with comma, like `http://privatebin.ygg/,http://privatebin.i2p/` | | mirrors | None | Domains separated with comma, like `http://privatebin.ygg/,http://privatebin.i2p/` |
| proxy | None | Proxy address starting with scheme `http://` or `socks5://` | | 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 | False | True / False |
| short_api | None | `tinyurl`, `clckru`, `isgd`, `vgd`, `cuttly`, `yourls`, `custom` | | 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_user | None | Used only in `yourls` |
| short_pass | None | Used only in `yourls` | | short_pass | None | Used only in `yourls` |
| short_token | None | Used only in `yourls` | | short_token | None | Used only in `yourls` |
| no_check_certificate | False | True / False | | no_check_certificate | False | True / False |
| no_insecure_warning | 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: Tool available by command `pbincli`, help for every command can be called with `-h` option:
```bash ```bash
pbincli {send|get|delete} -h pbincli {send|get|delete} -h
``` ```
Sending ## Sending
-----
* Sending text: * Sending text:
```bash ```bash
@ -91,10 +89,11 @@ pbincli send -f info.pdf -t "I'm sending my document."
pbincli send -q -f info.pdf 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. 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/ 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: To delete paste from server, use `delete` command with required `-p` and `-t` options:
```bash ```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. 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. 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: Change settings to use server `http://privatebin.i2p/` and proxy `http://127.0.0.1:4444`. Here's example for configuration file:
```ini ```ini
@ -128,8 +124,7 @@ server=http://privatebin.i2p/
proxy=http://127.0.0.1:4444 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: Example of alias to send paste from `stdin` direclty to I2P service:
```bash ```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. 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. 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.

22
README.rst

@ -74,6 +74,18 @@ All possible options for configuration file
* - proxy * - proxy
- None - None
- Proxy address starting with scheme ``http://`` or ``socks5://`` - 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 * - short
- False - False
- True / False - True / False
@ -82,7 +94,7 @@ All possible options for configuration file
- ``tinyurl``\ , ``clckru``\ , ``isgd``\ , ``vgd``\ , ``cuttly``\ , ``yourls``\ , ``custom`` - ``tinyurl``\ , ``clckru``\ , ``isgd``\ , ``vgd``\ , ``cuttly``\ , ``yourls``\ , ``custom``
* - short_url * - short_url
- None - 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 * - short_user
- None - None
- Used only in ``yourls`` - Used only in ``yourls``
@ -98,6 +110,9 @@ All possible options for configuration file
* - no_insecure_warning * - no_insecure_warning
- False - False
- True / False - True / False
* - compression
- zlib
- zlib / none
Usage Usage
@ -143,7 +158,10 @@ Sending
pbincli send -q -f info.pdf 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 Receiving
--------- ---------

9
pbincli/cli.py

@ -105,8 +105,12 @@ def main():
CONFIG = { CONFIG = {
'server': 'https://paste.i2pd.xyz/', 'server': 'https://paste.i2pd.xyz/',
'mirrors': None, # real example for paste.i2pd.xyz: 'http://privatebin.ygg/,http://privatebin.i2p/' 'mirrors': None,
'proxy': None, 'proxy': None,
'expire': None,
'burn': False,
'discus': False,
'format': None,
'short': False, 'short': False,
'short_api': None, 'short_api': None,
'short_url': None, 'short_url': None,
@ -114,7 +118,8 @@ def main():
'short_pass': None, 'short_pass': None,
'short_token': None, 'short_token': None,
'no_check_certificate': False, 'no_check_certificate': False,
'no_insecure_warning': False 'no_insecure_warning': False,
'compression': None
} }
# Configuration preference order: # Configuration preference order:

Loading…
Cancel
Save