-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Privatebin CLI | ||
------------ | ||
pbcli is a command line client which allows to upload and download | ||
pastes from privatebin directly from the command line. | ||
pastes from privatebin directly from the command line. | ||
|
||
It is dual licensed under MIT or the [UNLICENSE](https://unlicense.org). | ||
|
||
|
@@ -33,62 +33,74 @@ cargo build --release | |
|
||
### User Guide | ||
|
||
pbcli is simple to use and only involves a few flags. The only | ||
pbcli is simple to use and only involves a few flags. The only | ||
needed argument is either the positional argument `URL` or the option flag | ||
`host`. If both are provided the positional argument URL takes | ||
precedence. To avoid specifying the host / url everytime you can | ||
`host`. If both are provided the positional argument URL takes | ||
precedence. To avoid specifying the host / url everytime you can | ||
take advantage of a config file as described [here](#Configuration-File). | ||
|
||
When posting a paste you can specify `--json` to receive post details. The output | ||
includes the base58 encoded key used to encrypt/decrypt the paste. | ||
Constructed paste url (including key) and delete url (including token) are also provided for convenience. | ||
|
||
Example output: | ||
|
||
```json | ||
{ | ||
"baseurl":"https://privatebin.net/", | ||
"bs58key":"GN3qty1kAFbsGi9FbKKXigXwux1eofhiZQXNVFRMrNQd", | ||
"deletetoken":"8536f6f8310ed4a9aae0e111b1763f5851cdbefe4c35e4b96bd690269635354a", | ||
"deleteurl":"https://privatebin.net/?pasteid=31e2e7b19481fa7d&deletetoken=8536f6f8310ed4a9aae0e111b1763f5851cdbefe4c35e4b96bd690269635354a", | ||
"id":"31e2e7b19481fa7d", | ||
"pasteurl":"https://privatebin.net/?31e2e7b19481fa7d#GN3qty1kAFbsGi9FbKKXigXwux1eofhiZQXNVFRMrNQd", | ||
"status":0, | ||
"url":"/?31e2e7b19481fa7d" | ||
"baseurl": "https://privatebin.net/", | ||
"bs58key": "GN3qty1kAFbsGi9FbKKXigXwux1eofhiZQXNVFRMrNQd", | ||
"deletetoken": "8536f6f8310ed4a9aae0e111b1763f5851cdbefe4c35e4b96bd690269635354a", | ||
"deleteurl": "https://privatebin.net/?pasteid=31e2e7b19481fa7d&deletetoken=8536f6f8310ed4a9aae0e111b1763f5851cdbefe4c35e4b96bd690269635354a", | ||
"id": "31e2e7b19481fa7d", | ||
"pasteurl": "https://privatebin.net/?31e2e7b19481fa7d#GN3qty1kAFbsGi9FbKKXigXwux1eofhiZQXNVFRMrNQd", | ||
"status": 0, | ||
"url": "/?31e2e7b19481fa7d" | ||
} | ||
``` | ||
|
||
--- | ||
|
||
#### Example usages to get a paste: | ||
|
||
``` | ||
pbcli https://privatebin.net/?f37ca34e72e2ef77#G8wFGVnpSb4pogzGbMMcgbDgeYkQ5cfcWkcsVwTQJmzd | ||
``` | ||
|
||
``` | ||
pbcli --host https://privatebin.net/?f37ca34e72e2ef77#G8wFGVnpSb4pogzGbMMcgbDgeYkQ5cfcWkcsVwTQJmzd | ||
``` | ||
|
||
--- | ||
|
||
#### Example usages to post a new poste | ||
|
||
``` | ||
echo 'TestPaste' | pbcli --host https://privatebin.net/ | ||
``` | ||
|
||
``` | ||
echo 'TestPaste' | pbcli https://privatebin.net/ --json | ||
``` | ||
|
||
``` | ||
echo 'TestPaste' | pbcli --host https://privatebin.net/ --expire=1hour | ||
``` | ||
|
||
``` | ||
echo '## Title\nSome Markdown' | pbcli https://privatebin.net/ --format markdown | ||
``` | ||
|
||
``` | ||
echo 'TestPaste' | pbcli --host https://privatebin.net/ --burn | ||
``` | ||
|
||
--- | ||
|
||
#### CLI Help: | ||
``` | ||
pbcli 2.4.0 | ||
|
||
``` | ||
pbcli 2.5.0 | ||
Mydayyy <[email protected]> | ||
pbcli is a command line client which allows to upload and download | ||
pastes from privatebin directly from the command line. | ||
|
@@ -101,61 +113,76 @@ ARGS: | |
<URL> | ||
OPTIONS: | ||
--burn | ||
--discussion | ||
--burn enable burn on read for new paste | ||
--comment make new comment on existing paste | ||
--comment-as <nickname> use this nick for comment | ||
--comment-to <parentid> reply to this parent comment | ||
--debug print debug output to stderr | ||
--discussion enable discussion for new paste | ||
--download <FILE> | ||
--expire <EXPIRE> [default: 1week] | ||
--format <FORMAT> [default: plaintext] [possible values: plaintext, syntax, markdown] | ||
-h, --help Print help information | ||
--host <HOST> | ||
--json | ||
--json richer output: for delete_url, comments, etc | ||
--no-default-config do not look for config in default locations | ||
--oidc-client-id <OIDC_CLIENT_ID> client id to send to the token endpoint | ||
--oidc-password <OIDC_PASSWORD> password to send to the token endpoint | ||
--oidc-token-url <OIDC_TOKEN_URL> oidc token endpoint from which to obtain an access token | ||
--oidc-username <OIDC_USERNAME> username to send to the token endpoint | ||
--overwrite overwrite the file given with --download if it already exists | ||
--password <PASSWORD> | ||
--size-limit <SIZE_LIMIT> Prompt if the paste exceeds the given size. Fail in non-interactive environments | ||
--size-limit <SIZE_LIMIT> Prompt if the paste exceeds the given size. Fail in non-interactive environments. | ||
--upload <FILE> | ||
-V, --version Print version information | ||
``` | ||
|
||
### Configuration File | ||
|
||
pbcli supports a configuration file to fine tune the default behaviour. | ||
You need to set the environment variable `PBCLI_CONFIG_PATH` to a file path. The file | ||
You need to set the environment variable `PBCLI_CONFIG_PATH` to a file path. The file | ||
needs to contain flags you want to pass to pbcli, one per line. | ||
Lines starting with a # are ignored. An useful case for this may be | ||
setting a default instance to use by setting the --host argument. | ||
|
||
Additionally, pbcli will look in a few default directories to find a config. This can be disabled | ||
via the `--no-default-config` argument. The directories it checks are: | ||
|
||
- `$XDG_CONFIG_HOME/pbcli/config` if the XDG variable is set. Otherwise `$HOME/.config/pbcli/config` | ||
- /etc/pbcli/config | ||
|
||
As well as the windows and mac equivalents to those linux paths. Details can be found | ||
here: https://docs.rs/directories/latest/directories/struct.ProjectDirs.html#method.config_local_dir | ||
|
||
The debug mode can be used to troubleshoot config loading issues. It will print the used config as well | ||
as the directories that were searched for a config. | ||
|
||
Instead of typing `echo 'test' | pbcli https://privatebin.net/` you'll only need | ||
to type `echo 'test' | pbcli` | ||
|
||
Example config: | ||
|
||
``` | ||
--host=https://privatebin.net/ | ||
--expire=1month | ||
``` | ||
|
||
|
||
### Uniffi | ||
|
||
This projects offers uniffi bindings. In order to enable them, | ||
build the library with the uniffi feature enabled. | ||
You can learn more about uniffi [here](https://github.com/mozilla/uniffi-rs). | ||
Additionally to see an example integration of pbcli with uniffi | ||
This projects offers uniffi bindings. In order to enable them, | ||
build the library with the uniffi feature enabled. | ||
You can learn more about uniffi [here](https://github.com/mozilla/uniffi-rs). | ||
Additionally to see an example integration of pbcli with uniffi | ||
enabled into an android project you can check out [sharepaste](https://github.com/nain-F49FF806/sharepaste.oo). | ||
|
||
|
||
### Roadmap | ||
|
||
- Descriptive error messages | ||
- Add support for auth mechanism | ||
- Basic auth | ||
- ~~oauth~~ Added in v2.2.0 using Resource Owner Password Credential Grant flow | ||
- Add support for auth mechanism | ||
- Basic auth | ||
- ~~oauth~~ Added in v2.2.0 using Resource Owner Password Credential Grant flow | ||
- ~~Add support for file attachments~~ Added in v2.1.0 | ||
|
||
|
||
### Credits | ||
|
||
- [nain](https://github.com/nain-F49FF806) for the uniffi implementation |