Skip to content

Commit

Permalink
cli: add missing 'prepend' flag to multi-obj copy/transform
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishek Gaikwad <[email protected]>
  • Loading branch information
gaikwadabhishek committed Oct 25, 2024
1 parent d9fd420 commit 475c487
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cmd/cli/cli/bucket_hdlr.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const copyBucketUsage = "copy entire bucket or selected objects (to select, use
indent1 + "\t- 'ais cp s3://abc gs://xyz --all'\t- copy Cloud bucket to another Cloud;\n" +
indent1 + "\t- 'ais cp s3://abc ais://nnn --latest'\t- copy Cloud bucket, and make sure that already present in-cluster copies are updated to the latest (remote) versions;\n" +
indent1 + "\t- 'ais cp s3://abc ais://nnn --sync'\t- same as above, but in addition delete in-cluster copies that do not exist (any longer) in the remote source\n" +
indent1 + "with template, prefix, and/or progress bar:\n" +
indent1 + "\t\t with template, prefix, and/or progress bar;\n" +
indent1 + "\t- 'ais cp s3://abc ais://nnn --prepend backup/'\t- copy objects into 'backup/' virtual subdirectory in destination bucket;\n" +
indent1 + "\t- 'ais cp ais://nnn/111 ais://mmm'\t- copy a single object (assuming, prefix '111' corresponds to a single object);\n" +
indent1 + "\t- 'ais cp gs://webdataset-coco ais:/dst --template d-tokens/shard-{000000..000999}.tar.lz4'\t- copy up to 1000 objects that share the specified prefix;\n" +
indent1 + "\t- 'ais cp gs://webdataset-coco ais:/dst --prefix d-tokens/ --progress --all'\t- show progress while copying virtual subdirectory 'd-tokens'"
Expand Down
8 changes: 5 additions & 3 deletions cmd/cli/cli/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,9 +993,11 @@ var (
}
copyPrependFlag = cli.StringFlag{
Name: "prepend",
Usage: "prefix to prepend to every copied object name, e.g.:\n" +
indent4 + "\t--prepend=abc\t- prefix all copied object names with \"abc\"\n" +
indent4 + "\t--prepend=abc/\t- copy objects into a virtual directory \"abc\" (note trailing filepath separator)",
Usage: "prefix to prepend to every object name during operation (copy or transform), e.g.:\n" +
indent4 + "\t--prepend=abc\t- prefix all object names with \"abc\"\n" +
indent4 + "\t--prepend=abc/\t- use \"abc\" as a virtual directory (note trailing filepath separator)\n" +
indent4 + "\t\t- during 'copy', this flag applies to copied objects\n" +
indent4 + "\t\t- during 'transform', this flag applies to transformed objects",
}

// ETL
Expand Down
1 change: 1 addition & 0 deletions cmd/cli/cli/multiobj.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func runTCO(c *cli.Context, bckFrom, bckTo cmn.Bck, listObjs, tmplObjs, etlName
msg.LatestVer = flagIsSet(c, latestVerFlag)
msg.Sync = flagIsSet(c, syncFlag)
msg.ContinueOnError = flagIsSet(c, continueOnErrorFlag)
msg.Prepend = parseStrFlag(c, copyPrependFlag)
if flagIsSet(c, numListRangeWorkersFlag) {
msg.NumWorkers = parseIntFlag(c, numListRangeWorkersFlag)
}
Expand Down

0 comments on commit 475c487

Please sign in to comment.