copie

Crates.iocopie
lib.rscopie
version0.2.0
sourcesrc
created_at2021-04-01 03:40:00.438232
updated_at2021-04-01 21:26:30.487518
descriptionCopies file from or to paths specified in environment variables and command-line.
homepagehttps://github.com/JonathanxD/copie
repositoryhttps://github.com/JonathanxD/copie
max_upload_size
id376444
size23,267
Jonathan (JonathanxD)

documentation

https://docs.rs/copie/

README

Doc Crate Github Release License: MIT

copie

copie a simple tool used by Dracon IntelliJ Plugin to copy content of files that should be opened in an editor through $EDITOR or $VISUAL application to a separated file, allowing them to be inspected and modified without sacrificing integration.

How does copie works?

copie works by copying the file specified as first argument into the file specified in COPIE_TO environment variable, however, when COPIE_FROM is specified, the data of the file specified by this environment variable is copied into the file specified as first argument. And when both COPIE_FROM and COPIE_TO environment variables are set, the contents of the file of the first one is copied into the file of the second one.

Since 0.2.0, contents to write in the file could be specified in COPIE_FROM_STRING environment variable.

Usage

Copies from hello to a new file test.

$ touch hello
$ echo 'Hello world' > hello
$ COPIE_TO=test copie hello 

Copies from test to the existing hello.

$ touch hello
$ echo 'Hello world' > hello
$ touch test
$ echo 'Hello world 2' > test
$ COPIE_FROM=test copie hello 

Copies from test into hello.

$ touch hello
$ echo 'Hello world' > hello
$ touch test
$ echo 'Hello world 2' > test
$ COPIE_FROM=test COPIE_TO=hello copie 

Write copie string into hello.

$ COPIE_FROM_STRING=copie COPIE_TO=hello copie 

Write copie string into hello.

$ COPIE_FROM_STRING=copie copie hello

Practical use

copie is used in Dracon IntelliJ Plugin to extract record text and to send change text to pijul, the most common commands are:

Extract Record Change

COPIE_TO=/a/tmp/dir/RANDOM_HASH VISUAL="copie" pijul record

Send Record Change to Pijul Record

COPIE_FROM=/a/tmp/dir/RANDOM_HASH VISUAL="copie" pijul record
Commit count: 10

cargo fmt