@@ -385,13 +385,28 @@ def save(self) -> None:
385385 f .write ("\n " )
386386
387387 # Write all provider sections (empty if not configured)
388+ # Use known default URLs for providers
388389 known_providers = ['github' , 'gitlab' , 'gitea' , 'sourcehut' ]
389390 for provider_section in known_providers :
390391 f .write (f"[{ provider_section } ]\n " )
391- for key in ['username' , 'url' , 'token' ]:
392- value = self .config .get (provider_section , key ,
393- fallback = '' ) if self .config .has_section (provider_section ) else ''
394- f .write (f"{ key } = { value } \n " )
392+ has_section = self .config .has_section (provider_section )
393+
394+ # Username
395+ username = self .config .get (provider_section , 'username' ,
396+ fallback = '' ) if has_section else ''
397+ f .write (f"username = { username } \n " )
398+
399+ # URL - use default if not set
400+ url = self .config .get (provider_section , 'url' ,
401+ fallback = '' ) if has_section else ''
402+ if not url :
403+ url = PROVIDER_DEFAULT_URLS .get (provider_section , '' )
404+ f .write (f"url = { url } \n " )
405+
406+ # Token
407+ token = self .config .get (provider_section , 'token' ,
408+ fallback = '' ) if has_section else ''
409+ f .write (f"token = { token } \n " )
395410 f .write ("\n " )
396411
397412 if 'COLORS' in self .config ._sections :
0 commit comments