~xdavidwu/himitsu-docker

ae014f960fffccbc3c5348b1ff0e25e1e598a2d9 — Pinghao Wu 10 months ago 417b08a
update for himitsu 0.5
2 files changed, 6 insertions(+), 12 deletions(-)

M cmd/docker-credential-himitsu/get.ha
M cmd/docker-credential-himitsu/list.ha
M cmd/docker-credential-himitsu/get.ha => cmd/docker-credential-himitsu/get.ha +3 -6
@@ 23,18 23,15 @@ fn get(hi: net::socket) void = {
	const iter = client::query(hi, client::operation::QUERY, &query, client::flags::DECRYPT)!;
	const json = json::newobject();
	defer json::finish(json);
	const res = match (client::next(&iter)!) {
	const query = match (client::next(&iter)!) {
	case void =>
		// see go github.com/docker/docker-credential-helpers/client
		// client.go
		fmt::println("credentials not found in native keychain")!;
		os::exit(255);
	case let s: const str =>
		yield s;
	case let q: query::query =>
		yield q;
	};
	const parts = shlex::split(res)!;
	defer strings::freeall(parts);
	const query = query::parse_items(parts)!;
	defer query::finish(&query);
	let secreti = 0z, usernamei = 0z;
	for (let i = 0z; i < len(query.items); i += 1) {

M cmd/docker-credential-himitsu/list.ha => cmd/docker-credential-himitsu/list.ha +3 -6
@@ 19,15 19,12 @@ fn list(hi: net::socket) void = {
	const json = json::newobject();
	defer json::finish(json);
	for (true) {
		const res = match (client::next(&iter)!) {
		const query = match (client::next(&iter)!) {
		case void =>
			break;
		case let s: const str =>
			yield s;
		case let q: query::query =>
			yield q;
		};
		const parts = shlex::split(res)!;
		defer strings::freeall(parts);
		const query = query::parse_items(parts)!;
		defer query::finish(&query);
		let hosti = 0z, usernamei = 0z;
		for (let i = 0z; i < len(query.items); i += 1) {