Function gix_credentials::program::main

source ยท
pub fn main<CredentialsFn, E>(
    args: impl IntoIterator<Item = OsString>,
    stdin: impl Read,
    stdout: impl Write,
    credentials: CredentialsFn,
) -> Result<(), Error>
where CredentialsFn: FnOnce(Action, Context) -> Result<Option<Context>, E>, E: Error + Send + Sync + 'static,
Expand description

Invoke a custom credentials helper which receives program args, with the first argument being the action to perform (as opposed to the program name). Then read context information from stdin and if the action is Action::Get, then write the result to stdout. credentials is the API version of such call, whereOk(Some(context)) returns credentials, and Ok(None) indicates no credentials could be found for url, which is always set when called.

Call this function from a programs main, passing std::env::args_os(), stdin() and stdout accordingly, along with your own helper implementation.