mirror of
https://github.com/awfixers-stuff/src.git
synced 2026-03-26 20:46:00 +00:00
create src
This commit is contained in:
12
src-credentials/examples/invoke-git-credential.rs
Normal file
12
src-credentials/examples/invoke-git-credential.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
/// Invokes `git credential` with the passed url as argument and prints obtained credentials.
|
||||
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let out = gix_credentials::builtin(gix_credentials::helper::Action::get_for_url(
|
||||
std::env::args()
|
||||
.nth(1)
|
||||
.ok_or("First argument must be the URL to obtain credentials for")?,
|
||||
))?
|
||||
.ok_or("Did not obtain credentials")?;
|
||||
let ctx: gix_credentials::protocol::Context = (&out.next).try_into()?;
|
||||
ctx.write_to(std::io::stdout())?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user