From 1c4f8e83d79d052d1e4408d635daf80b3e81d62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 30 Sep 2020 16:11:44 +0100 Subject: [PATCH] tvx/extract-many: add batch id, change generated filename. --- cmd/tvx/extract_many.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/tvx/extract_many.go b/cmd/tvx/extract_many.go index d7a25c10c..9679a1dbd 100644 --- a/cmd/tvx/extract_many.go +++ b/cmd/tvx/extract_many.go @@ -20,8 +20,9 @@ import ( ) var extractManyFlags struct { - in string - outdir string + in string + outdir string + batchId string } var extractManyCmd = &cli.Command{ @@ -37,11 +38,17 @@ var extractManyCmd = &cli.Command{ The first row MUST be a header row. At the bare minimum, those seven fields must appear, in the order specified. Extra fields are accepted, but always - after these compulsory six. + after these compulsory seven. `, Action: runExtractMany, Flags: []cli.Flag{ &repoFlag, + &cli.StringFlag{ + Name: "batch-id", + Usage: "batch id; a four-digit left-zero-padded sequential number (e.g. 0041)", + Required: true, + Destination: &extractManyFlags.batchId, + }, &cli.StringFlag{ Name: "in", Usage: "path to input file (csv)", @@ -164,7 +171,7 @@ func runExtractMany(c *cli.Context) error { actorcodename := strings.ReplaceAll(actorcode, "/", "_") // Compute the ID of the vector. - id := fmt.Sprintf("extracted-msg-%s-%s-%s-%s", actorcodename, methodname, exitcodename, seq) + id := fmt.Sprintf("ext-%s-%s-%s-%s-%s", extractManyFlags.batchId, actorcodename, methodname, exitcodename, seq) // Vector filename, using a base of outdir. file := filepath.Join(outdir, actorcodename, methodname, exitcodename, id) + ".json"