pub enum Action {
    Get(Context),
    Store(BString),
    Erase(BString),
}
Expand description

The action to perform by the credentials helper.

Variants§

§

Get(Context)

Provide credentials using the given repository context, which must include the repository url.

§

Store(BString)

Approve the credentials as identified by the previous input provided as BString, containing information from Context.

§

Erase(BString)

Reject the credentials as identified by the previous input provided as BString. containing information from Context.

Implementations§

Send ourselves to the given write which is expected to be credentials-helper compatible

Initialization

Create a Get action with context containing the given URL. Note that this creates an Action suitable for the credential helper cascade only.

Examples found in repository?
examples/invoke-git-credential.rs (lines 5-9)
4
5
6
7
8
9
10
11
12
13
14
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
    let out = git_credentials::builtin(git_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: git_credentials::protocol::Context = (&out.next).try_into()?;
    ctx.write_to(std::io::stdout())?;
    Ok(())
}

Access

Return the payload of store or erase actions.

Return the context of a get operation, or None.

The opposite of payload.

Return the mutable context of a get operation, or None.

Returns true if this action expects output from the helper.

The name of the argument to describe this action. If is_external is true, the target program is a custom credentials helper, not a built-in one.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.