Crates.io | pretty-copy |
lib.rs | pretty-copy |
version | 0.1.2 |
source | src |
created_at | 2024-03-26 18:04:43.484221 |
updated_at | 2024-05-11 20:50:04.31577 |
description | Multi-purpose copying utility which allows to see progress of copying operations |
homepage | |
repository | |
max_upload_size | |
id | 1186765 |
size | 130,980 |
Pretty copy(shortened pcp
) is utility for copying files which aims to provide better UI and more features compared to
standard UNIX cp
utility.
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
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
Currently on other distributions you may download x86_64 binary from releases or build for yourself
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: 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 |
TODO
Use cargo doc
for documentation generation.
The program possess currently 3 dynamical components which have corresponding traits:
Reader
implements reading files(and their metadata)Write
implements writing filesProgressDisplay
implements showing progress to userInstantCopyHelper
which would help to determine whether file can be instantly reflink'dThe 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)