summaryrefslogtreecommitdiffstats
path: root/vendor/gix-credentials/examples
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
commit018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch)
treea835ebdf2088ef88fa681f8fad45f09922c1ae9a /vendor/gix-credentials/examples
parentAdding debian version 1.75.0+dfsg1-5. (diff)
downloadrustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz
rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-credentials/examples')
-rw-r--r--vendor/gix-credentials/examples/custom-helper.rs24
-rw-r--r--vendor/gix-credentials/examples/git-credential-lite.rs23
-rw-r--r--vendor/gix-credentials/examples/invoke-git-credential.rs14
3 files changed, 0 insertions, 61 deletions
diff --git a/vendor/gix-credentials/examples/custom-helper.rs b/vendor/gix-credentials/examples/custom-helper.rs
deleted file mode 100644
index 9fc0cbf61..000000000
--- a/vendor/gix-credentials/examples/custom-helper.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use gix_credentials::{program, protocol};
-
-/// Run like this `echo url=https://example.com | cargo run --example custom-helper -- get`
-pub fn main() -> Result<(), gix_credentials::program::main::Error> {
- gix_credentials::program::main(
- std::env::args_os().skip(1),
- std::io::stdin(),
- std::io::stdout(),
- |action, context| -> std::io::Result<_> {
- match action {
- program::main::Action::Get => Ok(Some(protocol::Context {
- username: Some("user".into()),
- password: Some("pass".into()),
- ..context
- })),
- program::main::Action::Erase => Err(std::io::Error::new(
- std::io::ErrorKind::Other,
- "Refusing to delete credentials for demo purposes",
- )),
- program::main::Action::Store => Ok(None),
- }
- },
- )
-}
diff --git a/vendor/gix-credentials/examples/git-credential-lite.rs b/vendor/gix-credentials/examples/git-credential-lite.rs
deleted file mode 100644
index c4e40c291..000000000
--- a/vendor/gix-credentials/examples/git-credential-lite.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-use std::convert::TryInto;
-
-/// Run like this `echo url=https://example.com | cargo run --example git-credential-light -- fill`
-pub fn main() -> Result<(), gix_credentials::program::main::Error> {
- gix_credentials::program::main(
- std::env::args_os().skip(1),
- std::io::stdin(),
- std::io::stdout(),
- |action, context| {
- use gix_credentials::program::main::Action::*;
- gix_credentials::helper::Cascade::default()
- .invoke(
- match action {
- Get => gix_credentials::helper::Action::Get(context),
- Erase => gix_credentials::helper::Action::Erase(context.to_bstring()),
- Store => gix_credentials::helper::Action::Store(context.to_bstring()),
- },
- gix_prompt::Options::default().apply_environment(true, true, true),
- )
- .map(|outcome| outcome.and_then(|outcome| (&outcome.next).try_into().ok()))
- },
- )
-}
diff --git a/vendor/gix-credentials/examples/invoke-git-credential.rs b/vendor/gix-credentials/examples/invoke-git-credential.rs
deleted file mode 100644
index cba3f5f70..000000000
--- a/vendor/gix-credentials/examples/invoke-git-credential.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-use std::convert::TryInto;
-
-/// 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(())
-}