~xdavidwu/himitsu-docker

82a31bee030e8954fe854e2a3b5269e65ef05d07 — xdavidwu 2 years ago 6746cc5
implement erase
2 files changed, 21 insertions(+), 0 deletions(-)

A cmd/docker-credential-himitsu/erase.ha
M cmd/docker-credential-himitsu/main.ha
A cmd/docker-credential-himitsu/erase.ha => cmd/docker-credential-himitsu/erase.ha +19 -0
@@ 0,0 1,19 @@
use bufio;
use himitsu::client;
use himitsu::query;
use os;
use strings;

fn erase() void = {
	const hi = client::connect()!;
	const url = strings::fromutf8(bufio::scanline(os::stdin)! as []u8);
	const query = query::query {
		items = [
			query::pair { key = "proto", value = "docker", private = false, optional = false},
			query::pair { key = "host", value = url, private = false, optional = false},
			query::pair { key = "username", value = "", private = false, optional = false},
			query::pair { key = "secret", value = "", private = true, optional = false},
		],
	};
	client::query(hi, client::operation::DEL, &query, 0)!;
};

M cmd/docker-credential-himitsu/main.ha => cmd/docker-credential-himitsu/main.ha +2 -0
@@ 7,6 7,8 @@ export fn main() void = {
		store();
	case "get" =>
		get();
	case "erase" =>
		erase();
	case "list" =>
		list();
	case =>