gen-flags: Args.required reads are flags too (edit --ops, privacy-manifest --ios, apple listing --version were refused as unknown options); play games client listAll (no false flags)

This commit is contained in:
CRTkafa 2026-10-21 05:28:02 +07:00
parent d427b5c4a4
commit 567d6ca181
3 changed files with 15 additions and 19 deletions

View file

@ -41,7 +41,7 @@ export function gamesConfigClient(root: string) {
return (t ? JSON.parse(t) : {}) as T;
}
}
async function list(kind: 'achievements' | 'leaderboards', appId: string): Promise<PlayExisting[]> {
async function listAll(kind: 'achievements' | 'leaderboards', appId: string): Promise<PlayExisting[]> {
const out: PlayExisting[] = [];
let page: string | undefined;
do {
@ -51,13 +51,13 @@ export function gamesConfigClient(root: string) {
} while (page);
return out;
}
return { call, list };
return { call, listAll };
}
export const playDefaultLocale = (config: Ctx['loaded']['config']): string => config.play?.defaultLanguage ?? 'en-US';
export async function readPlayGames(c: ReturnType<typeof gamesConfigClient>, appId: string): Promise<{ leaderboards: PlayExisting[]; achievements: PlayExisting[] }> {
return { leaderboards: await c.list('leaderboards', appId), achievements: await c.list('achievements', appId) };
return { leaderboards: await c.listAll('leaderboards', appId), achievements: await c.listAll('achievements', appId) };
}
const pending = (plan: ItemPlan[]) => plan.filter(p => p.action !== 'keep');
@ -92,7 +92,7 @@ export async function run(ctx: Ctx): Promise<void> {
if (p.action === 'create') {
const r = await createOnce({ what: `${p.kind} ${p.id}`, tag: TAG,
create: async () => (await c.call<PlayExisting>('POST', `/applications/${appId}/${kind}`, p.attributes)).id,
find: async () => (await c.list(kind, appId)).find(x => x.draft?.name?.translations.some(t => t.locale === locale && t.value === name))?.id ?? null });
find: async () => (await c.listAll(kind, appId)).find(x => x.draft?.name?.translations.some(t => t.locale === locale && t.value === name))?.id ?? null });
log(TAG, `${p.kind} ${p.id}: created as ${r.value} (set playId: "${r.value}" in the config to match it by id)`);
} else {
await c.call('PUT', `/${kind}/${encodeURIComponent(p.storeId!)}`, p.attributes);