xch 0.1.0

A CLI utility and rust crate to atomically swap the content of two paths.
docs.rs failed to build xch-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: xch-1.1.0

xch

A Rust library and CLI program to exchange the content of paths.

Current release: 0.1.0

Note: Currently only runs on windows

CLI

The program xch can be used to eXCHange the content of two paths.

Install

cargo install xch

Usage

xch first/path second/path

After the program call, first/path will point to the previous content of second/path and vice versa. This not only works for files but also for directories or one file and a directory.

All changes are made atomically, you can never observe one change without the other (e.g. if first/path points to the old content of second/path, second/path also points to the old content of first/path).

Crate

The functionality is also available as a crate. Add xch = "0.1.0" to your Cargo.toml. Then you need to import the crate to your code

extern crate libxch;

Then you can start exchanging the content of files

if let Err(e) = libxch::xch("file1", "path/to/file2") {
    // Error handling here
}

License

Licensed under MIT license

Future

Here are some missing features that will hopefully be added in the future:

  • Linux support
  • MacOS support
  • *BSD support