pretty-copy

Crates.iopretty-copy
lib.rspretty-copy
version0.1.2
sourcesrc
created_at2024-03-26 18:04:43.484221
updated_at2024-05-11 20:50:04.31577
descriptionMulti-purpose copying utility which allows to see progress of copying operations
homepage
repository
max_upload_size
id1186765
size130,980
Anna-Sophie Zaitsewa (0xf104a)

documentation

README

Pretty copy

Pretty copy(shortened pcp) is utility for copying files which aims to provide better UI and more features compared to standard UNIX cp utility.

showcase

Installing

Cargo

You may use cargo to install pretty-copy crate, though in this case binary would be named pretty-copy, not pcp so you would need to alter name manually:

cargo install pretty-copy
cd /path/to/your/cargo/bin
mv pretty-copy pcp

Arch-based

On Arch distributions you may use AUR helper(e.g. yay to install pretty-copy package):

yay -S pretty-copy

or clone this repository and makepkg:

git clone https://github.com/0x50f13/pcp
cd pcp/pkg
makepkg -si

Others

Currently on other distributions you may download x86_64 binary from releases or build for yourself

Build

For building you need Rust and Cargo. To build clone this repository and use cargo:

git clone https://github.com/0x50f13/pcp
cd pcp
cargo build --release

And then copy resulting file to any of directories from your $PATH:

# Here /usr/bin is just an example
cp target/release/pcp /usr/bin

Usage

Usage: pcp [OPTIONS] <SRCS>... <DEST>

Argument/Option Description
<SRCS>... Source file/directories
<DEST> Destination file/directory
-r, --recursive Copy directories recursively
--no-progress Do not show progress
--fail-fast Fail on first error
--max-chunks-number <MAX_CHUNKS_NUMBER> Maximum number of cached chunks of file stored in memory [default: 1024]
-h, --help Print help

Features

Current

  • Copy files with progress
  • Copy directories

Future

  • Copying files via HTTP and HTTPS protocols
  • Metadata copying(e.g. SELinux labels)
  • Copying files/directories via SCP
  • Copying files/directories via FTP and SFTP
  • Reflinking files when supported
  • Writing directly to devfs, so utility may burn file to drive straight away
  • Calculate directory size before copying it
  • Qt or GTK progress window(or Tcl, or maybe even direct rendering with GL?)
  • Optional plugins support

Development

Documentation

Online

TODO

Generation

Use cargo doc for documentation generation.

Short abstract

The program possess currently 3 dynamical components which have corresponding traits:

  • Reader implements reading files(and their metadata)
  • Write implements writing files
  • ProgressDisplay implements showing progress to user
  • Actually one more is planned: InstantCopyHelper which would help to determine whether file can be instantly reflink'd

The general algorithm is that we have two coroutines and channel between them. One coroutine reads file another one writes to it. The coroutine which writes additionally updates progress which is done synchronously(so in future UI thread may be added via mpsc channel)

Commit count: 0

cargo fmt