pattrick

Crates.iopattrick
lib.rspattrick
version0.3.7
sourcesrc
created_at2022-10-11 06:41:24.297651
updated_at2023-12-13 16:09:49.725264
descriptionPattrick is a command line tool for managing Personal Access Tokens (PAT) in Azure DevOps.
homepage
repositoryhttps://github.com/jvanbuel/pattrick
max_upload_size
id685108
size174,142
Jan Vanbuel (jvanbuel)

documentation

README

1673695104691

crates build docs license

Pattrick is a command line tool for managing Personal Access Tokens (PAT) in Azure DevOps.

It allows you to:

  • 🐣 create
  • 📖 list
  • 🔎 show
  • ⚰️ delete

PATs without having to go to the web interface.

Installation

On MacOs, you can install Pattrick with Homebrew:

brew tap jvanbuel/pattrick
brew install pattrick

On Linux, you can install Pattrick by executing the following commands:

curl -L https://github.com/jvanbuel/pattrick/releases/latest/download/pattrick-x86_64-unknown-linux-gnu.tar.gz | tar xvz
chmod +x pattrick
sudo mv pattrick /usr/local/bin/pattrick

Usage

Pattrick looks for Azure CLI credentials to fetch an access token for authentication with Azure DevOps. You can get one locally by logging in to Azure with:

az login

If pattrick cannot find a valid access token, it will try to log you in automatically (by using the az login command under the hood). You can then start using pattrick to manage your PAT tokens:

pattrick create --lifetime 100 --scope packaging

By default, pattrick writes newly created token to stdout. However, you can also tell pattrick to write the token to your .netrc file (useful for e.g. installing Python packages from Azure DevOps Artifacts), or to a local .env file:

pattrick create --out std-out (default) / dot-netrc / dot-env

To get an overview of the other commands and options available, run:

pattrick --help

Usage as standalone library

You can also use Pattrick as a standalone library. This is useful if you want to manage PATS programmatically in your own codebase.

use pattrick::{PatTokenManager, PatTokenListRequest, DisplayFilterOption};
use pattrick::azure::get_ad_token_for_devops;

let pat_manager = PatTokenManager::new(get_ad_token_for_devops(1).await?);

let pat_tokens = pat_manager.list_pat_tokens(
     PatTokenListRequest {
        display_filter_option: DisplayFilterOption::All
     }
 ).await?;

For more information, check out the pattrick documentation at docs.rs

Commit count: 291

cargo fmt