Skip to content

Commit 583a012

Browse files
wesmclaude
andcommitted
Fix list-accounts on fresh install and display-name on existing token
Add InitSchema call in list-accounts so a fresh install gets "No accounts found" instead of "no such table: sources". Apply --display-name on the early-return path in add-account when a token already exists, so the flag isn't silently ignored. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e3a2a99 commit 583a012

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

cmd/msgvault/cmd/addaccount.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,15 @@ Examples:
6262
if oauthMgr.HasToken(email) {
6363
// Still create the source record - needed for headless setup
6464
// where token was copied but account not yet registered
65-
_, err = s.GetOrCreateSource("gmail", email)
65+
source, err := s.GetOrCreateSource("gmail", email)
6666
if err != nil {
6767
return fmt.Errorf("create source: %w", err)
6868
}
69+
if accountDisplayName != "" {
70+
if err := s.UpdateSourceDisplayName(source.ID, accountDisplayName); err != nil {
71+
return fmt.Errorf("set display name: %w", err)
72+
}
73+
}
6974
fmt.Printf("Account %s is ready.\n", email)
7075
fmt.Println("You can now run: msgvault sync-full", email)
7176
return nil

cmd/msgvault/cmd/list_accounts.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Examples:
3131
}
3232
defer s.Close()
3333

34+
if err := s.InitSchema(); err != nil {
35+
return fmt.Errorf("init schema: %w", err)
36+
}
37+
3438
sources, err := s.ListSources("")
3539
if err != nil {
3640
return fmt.Errorf("list accounts: %w", err)

0 commit comments

Comments
 (0)