From 6f49278e755eae59e83bd1517d4145d9d974c141 Mon Sep 17 00:00:00 2001 From: mik-tf Date: Thu, 3 Oct 2024 11:17:58 -0400 Subject: [PATCH] updated credential docker --- flist.v | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/flist.v b/flist.v index 49755c2..865251d 100644 --- a/flist.v +++ b/flist.v @@ -124,6 +124,20 @@ fn logout() { } fn get_docker_credential() !string { + // Try to get the Docker credential automatically + credential := get_docker_credential_auto() or { + // If automatic retrieval fails, prompt the user for input + println(term.yellow('\nCouldn\'t find your Docker username automatically.')) + username := os.input('Please enter your Docker username and press ENTER: ') + if username.trim_space() == '' { + return error('No Docker username provided') + } + return username.trim_space() + } + return credential +} + +fn get_docker_credential_auto() !string { // Read the Docker config file config_path := os.join_path(os.home_dir(), '.docker', 'config.json') config_content := os.read_file(config_path) or {