Skip to content

A Cargo plugin for managing crates.io credentials with named profiles.

License

Notifications You must be signed in to change notification settings

jsdreim/cargo-user

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cargo-User

Crates.io docs.rs

Installation

With Cargo installed, the following command will build and install cargo-user from crates.io automatically:

cargo install cargo-user

As long as $HOME/.cargo/bin/ is included in $PATH, the subcommand should be available immediately.

Usage

Assuming you have already run cargo login, you should first run cargo user save to save your credentials as a profile. You can then clear your credentials with cargo logout or cargo user clear, log in again with different credentials, and save those too.

cargo user save first
# Saved profile "first".

cargo user clear
# Cleared Cargo credentials.

cargo login
# [...]

cargo user save second
# Saved profile "second".

You can then invoke cargo user current to print the name of the currently loaded profile, cargo user list to view all available profiles, and cargo user load to switch to another.

cargo user list
# first
# second

cargo user current
# second

cargo user load first
# Loaded profile "first".

cargo user current
# first

A complete list of capabilities can be accessed with cargo help user or cargo user --help.

Details

User credentials for publishing to crates.io are saved in $CARGO_HOME/credentials. This plugin saves a copy of that file, with a user-specified name, as a credentials "profile" in $XDG_CONFIG_HOME/cargo-user/profiles/.

For example, a profile named "third", saved with cargo user save third, would be saved at $XDG_CONFIG_HOME/cargo-user/profiles/credentials-third. When that profile is later loaded with cargo user load third, that file is copied back to $CARGO_HOME/credentials, and is immediately accessible to be read by cargo publish.

The exact path to the saved profile directory, or to a specific profile, can be printed with cargo user find.

About

A Cargo plugin for managing crates.io credentials with named profiles.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages