nixpkgs-track 0.6.0

Track where Nixpkgs pull requests have reached.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::process::Command;

use crate::cli::Cli;

pub fn get_github_token(args: &Cli) -> Option<String> {
	args.token.clone().or_else(|| {
		Command::new("gh")
			.args(["auth", "token"])
			.output()
			.ok()
			.filter(|output| output.status.success())
			.and_then(|output| String::from_utf8(output.stdout).ok())
			.map(|s| s.trim().to_string())
	})
}