From a197888c216c6b00746b5bd734180dda6f0f6578 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Tue, 19 Nov 2024 14:26:25 -0500 Subject: [PATCH] Add help flag for flexible-event script (#1470) --- ts/src/flexible-event/main.ts | 100 ++++++++++++++++++++-------------- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/ts/src/flexible-event/main.ts b/ts/src/flexible-event/main.ts index 1ac12fbd41..9cbc3df330 100644 --- a/ts/src/flexible-event/main.ts +++ b/ts/src/flexible-event/main.ts @@ -26,50 +26,68 @@ interface Arguments { windows?: Wrapped buckets?: Wrapped json_file?: string + help: boolean } -const options = parse({ - max_event_level_reports: { - alias: 'm', - type: Number, - defaultValue: 20, +const options = parse( + { + max_event_level_reports: { + alias: 'm', + type: Number, + defaultValue: 20, + }, + attribution_scope_limit: { + alias: 'a', + type: Number, + optional: true, + }, + max_event_states: { + alias: 's', + type: Number, + optional: true, + }, + epsilon: { + alias: 'e', + type: Number, + defaultValue: 14, + }, + source_type: { + alias: 't', + type: parseSourceType, + defaultValue: SourceType.navigation, + }, + windows: { + alias: 'w', + type: commaSeparatedInts, + optional: true, + }, + buckets: { + alias: 'b', + type: commaSeparatedInts, + optional: true, + }, + json_file: { + alias: 'f', + type: String, + optional: true, + }, + help: { + alias: 'h', + type: Boolean, + description: 'Prints this usage guide.', + }, }, - attribution_scope_limit: { - alias: 'a', - type: Number, - optional: true, - }, - max_event_states: { - alias: 's', - type: Number, - optional: true, - }, - epsilon: { - alias: 'e', - type: Number, - defaultValue: 14, - }, - source_type: { - alias: 't', - type: parseSourceType, - defaultValue: SourceType.navigation, - }, - windows: { - alias: 'w', - type: commaSeparatedInts, - optional: true, - }, - buckets: { - alias: 'b', - type: commaSeparatedInts, - optional: true, - }, - json_file: { - alias: 'f', - type: String, - optional: true, - }, -}) + { + helpArg: 'help', + headerContentSections: [ + { + header: 'Attribution Reporting Flexible Event', + content: + 'Computes privacy-related information for an attribution source.', + }, + ], + } +) function logIssue(prefix: string, i: Issue): void { console.log(