Skip to content
项目

关于

A CLI tool for rustypaste

开发工具

这些数字如何统计

可以做什么

  • use-native-certs: makes the default TLS implementation use the OS' trust store. * (disabled)

实测星标增长

24小时
正在收集历史
7天
正在收集历史
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

A CLI tool for rustypaste.

demo

Installation

crates.io

cargo install rustypaste-cli

Features

  • use-native-certs: makes the default TLS implementation use the OS' trust store. * (disabled)

To enable crate features, use the --features flag as follows:

cargo install rustypaste-cli --features use-native-certs

Arch Linux

pacman -S rustypaste-cli

Alpine Linux

rustypaste-cli is available for Alpine Edge. It can be installed via apk after enabling the testing repository.

apk add rustypaste-cli

Binary releases

See the available binaries on releases page.

Build from source

git clone https://github.com/orhun/rustypaste-cli.git
cd rustypaste-cli/
cargo build --release

Usage

rpaste [options] <file(s)>

-h, --help           prints help information
-v, --version        prints version information
-V, --server-version retrieves the server version
-l, --list           lists files on the server
-d, --delete         delete files from server
-P, --protected      upload a protected file
-o, --oneshot        generates one shot links
-p, --pretty         prettifies the output
-c, --config CONFIG  sets the configuration file
-z, --profile NAME   selects a configuration profile
-s, --server SERVER  sets the address of the rustypaste server
-a, --auth TOKEN     sets the authentication or delete token
-u, --url URL        sets the URL to shorten
-r, --remote URL     sets the remote URL for uploading
-e, --expire TIME    sets the expiration time for the link
-n, --filename NAME  sets and overrides the filename

Set credentials

Either set the credentials on the command line (not recommended):

rpaste -s "https://paste.example.com" -a "<token>"

or specify them in the configuration file as follows:

[server]
auth_token = "<token>"
delete_token = "<delete_token>"

It is also possible to use these tokens from a file:

[server]
auth_token_file = "~/example/auth-token"
delete_token_file = "~/example/delete-token"

The contents should be only the token, all whitespace will be trimmed.

Upload files

rpaste awesome.txt other.txt

Upload from stdin

echo "Hello World" | rpaste -

Shorten URLs

rpaste -u https://example.com/some/long/url

Paste from URL

rpaste -r https://example.com/file.txt

One shot

rpaste -o disappear_after_seen.txt

One shot URL

rpaste -ou https://example.com/some/long/url

Expiration

rpaste -e 10min expires_in_10_minutes.txt
rpaste -e 1hour -u https://example.com/expire/1hour

* Supported units: ns, us, ms, sec, min, hours, days, weeks, months, years

List uploaded files

rpaste -l

* Use -p for table output instead of JSON.

Delete files from server

rpaste -d awesome.UA86.txt other.JSNI.txt

Override the filename

rpaste -n filename-on-server.txt awesome.txt

* rustypaste >=0.15.0 is required for this argument to work, otherwise the filename will not be overridden.

Extras

  • Show a prettier output: rpaste -p [...]
  • Disable colors in the output: NO_COLOR=1 rpaste -p [...]

Configuration

The configuration file can be specified via --config argument and RPASTE_CONFIG environment variable or it can be placed to the following global locations:

  • <config_dir> / rustypaste/config.toml
  • <home_dir> / .rustypaste/config.toml

<config_dir> depends on the platform as shown in the following table:

Platform Value Example
Linux • $XDG_CONFIG_HOME
• $HOME/.config
/home/alice/.config
macOS • $XDG_CONFIG_HOME
• $HOME/.config
• $HOME/Library/Application Support
• /home/alice/.config
• /Users/Alice/Library/Application Support
Windows {FOLDERID_RoamingAppData} C:\Users\Alice\AppData\Roaming

See config.toml for configuration options.

Profiles

To switch servers, put each server’s settings under a named profile. Set default_profile at the top of the file to choose the profile used when -z / --profile is omitted.

default_profile = "work"

[profile.work.server]
address = "https://paste.example.com"
auth_token_file = "~/.config/rustypaste/work-token"

[profile.local.server]
address = "http://localhost:8000"

[profile.local.paste]
oneshot = true

rpaste notes.txt uses work in this example. Run rpaste -z local notes.txt (or rpaste --profile local notes.txt) to upload to the local server instead. Each profile has its own server, paste, and style settings. With no default or explicit profile, rpaste uses the existing top-level sections. Command-line options such as --server and --expire override the selected settings.

Contributing

Pull requests are welcome!

License

All code is licensed under The MIT License.

探索相关项目

加载中…