development_dockername #5

Merged
mik-tf merged 3 commits from development_dockername into main 2024-10-03 15:29:06 +00:00
Showing only changes of commit 6f49278e75 - Show all commits

14
flist.v
View File

@ -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 {