@bobfrankston/gcards 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gfix.ts +2 -2
- package/glib/gutils.ts +17 -3
- package/package.json +1 -1
package/gfix.ts
CHANGED
|
@@ -1898,12 +1898,12 @@ async function main(): Promise<void> {
|
|
|
1898
1898
|
console.error('Usage: gfix export -u <source> -to <target> <pattern>');
|
|
1899
1899
|
process.exit(1);
|
|
1900
1900
|
}
|
|
1901
|
-
const resolvedSource = resolveUser(user);
|
|
1901
|
+
const resolvedSource = resolveUser(user, true);
|
|
1902
1902
|
await runExport(resolvedSource, targetUser, positionalArgs[0]);
|
|
1903
1903
|
return;
|
|
1904
1904
|
}
|
|
1905
1905
|
|
|
1906
|
-
const resolvedUser = resolveUser(user);
|
|
1906
|
+
const resolvedUser = resolveUser(user, true);
|
|
1907
1907
|
|
|
1908
1908
|
if (processLimit > 0) {
|
|
1909
1909
|
console.log(`[DEBUG] Processing limited to first ${processLimit} contacts\n`);
|
package/glib/gutils.ts
CHANGED
|
@@ -125,9 +125,23 @@ export function resolveUser(cliUser: string, setAsDefault = false): string {
|
|
|
125
125
|
return config.lastUser;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
// 3.
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
// 3. Auto-detect if only one user exists
|
|
129
|
+
const allUsers = getAllUsers();
|
|
130
|
+
if (allUsers.length === 1) {
|
|
131
|
+
const onlyUser = allUsers[0];
|
|
132
|
+
console.log(`Auto-selected only user: ${onlyUser}`);
|
|
133
|
+
config.lastUser = onlyUser;
|
|
134
|
+
saveConfig(config);
|
|
135
|
+
return onlyUser;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// 4. No user - require --user on first use
|
|
139
|
+
if (allUsers.length > 1) {
|
|
140
|
+
console.error(`Multiple users exist: ${allUsers.join(', ')}`);
|
|
141
|
+
console.error('Use -u <name> to select one.');
|
|
142
|
+
} else {
|
|
143
|
+
console.error('No user specified. Use -u <email> on first run (e.g., your Gmail address).');
|
|
144
|
+
}
|
|
131
145
|
process.exit(1);
|
|
132
146
|
}
|
|
133
147
|
|