Publish `phraze` on crates.io
eaon opened this issue · 4 comments
Publishing phraze
on crates.io would be nice for folks like me who install some of the smaller helper tools they use with cargo install --locked
. The name is still available too!
Oh, I hadn't even thought about what Phraze's API is like for use as a Rust library. In general, I'm hesitant to go take up finite namespace unless and until the project is relatively popular -- a lil anxiety of mine.
I do know that Cargo has a neat trick where you can point straight to a GitHub URL in dependencies:
[dependencies]
phraze = { git = "https://github.com/sts10/phraze" }
Here's what the API looks like, in the src/main.rs
of a new project:
use phraze::fetch_list;
use phraze::generate_a_passphrase;
fn main() {
// Use a built-in word list
let passphrase = generate_a_passphrase(6, "-", false, fetch_list(phraze::ListChoice::Long));
println!("Passphrase from Orchard Street Long List is {}", passphrase);
// use a custom word list
let word_list = [
"divine",
"genre",
"impact",
"inferior",
"inside",
"literally",
"patron",
"prolific",
"promotes",
"repaired",
"ribs",
"saved",
];
let passphrase = generate_a_passphrase(6, "-", false, &word_list);
println!("Passphrase from custom list is {}", passphrase);
}
It's not as unusable as I might have guessed? Definitely open to suggestions...
Oh I didn't mean to use it as a library, I meant to use it as a cli tool that automatically gets installed into a directory that's already in my $PATH
. For example, cargo install --locked eza
installs the most recent version of eza that's published on crates.io into ~/.cargo/bin/eza
on my machine.
Oh! Well you can already do cargo install --git https://github.com/sts10/phraze --locked --branch main
. This installs Phraze to ~/.cargo/bin/phraze
, same as if you were grabbing it from crates.io.
But, yes, I'm considering publishing Phraze to crates.io... if nothing else to get more eyes on it and its code...
https://crates.io/crates/phraze 🎉 Thanks @sts10!