From ec6ac542bd916d61b6b9ca6bf599f49f193cb5f3 Mon Sep 17 00:00:00 2001 From: Harrison Howard Date: Fri, 17 May 2024 21:34:41 +1000 Subject: [PATCH] #15 Make username required field and remove default --- src/commands/config.gleam | 11 ++++------- src/util/env.gleam | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/commands/config.gleam b/src/commands/config.gleam index 3a7498b..16df75b 100644 --- a/src/commands/config.gleam +++ b/src/commands/config.gleam @@ -41,10 +41,10 @@ fn do(_input: CommandInput) { current -> " 'current=" <> int.to_string(current) <> "'" } let current_username = - " 'default=me'" + "*" <> case current_base_config.username { - // Default username is me - "me" -> "" + // Empty string is the default therefore don't show it + "" -> "" current -> " 'current=" <> current <> "'" } let current_https = @@ -69,10 +69,7 @@ fn do(_input: CommandInput) { default: Some(current_base_config.port), ) let username = - terminal.prompt( - "Enter your username" <> current_username, - default: Some(current_base_config.username), - ) + terminal.prompt("Enter your username" <> current_username, default: None) let https = terminal.confirm( "Do you use HTTPS?" <> current_https, diff --git a/src/util/env.gleam b/src/util/env.gleam index 6f5e6b7..dfaf267 100644 --- a/src/util/env.gleam +++ b/src/util/env.gleam @@ -59,7 +59,7 @@ pub fn init_config_file() -> Result(Nil, FileError) { case file_exists { True -> Ok(Nil) False -> - // Create the config file (This will an empty config file) + // Create the config file (This will be an empty config file) // To fill this file the user needs to run through the prompt generation simplifile.create_file("./" <> name_of_config_file) }