From e5656d7d18f90fa0f3ae18095aa3fa83a811dd53 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sat, 3 Oct 2026 21:39:31 +0200 Subject: [PATCH] cmds.posix.CmdCopy: Add --parents copy() can now land a single object at its source path, but the copy CLI command exposes no way to ask for it. Add a --parents flag forwarded to copy()'s parents argument. Signed-off-by: Jan Lindemann Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.1.0 --- src/python/jw/pkg/cmds/posix/CmdCopy.py | 6 ++++++ test/integration/jw_pkg/help/test-expected.txt | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/python/jw/pkg/cmds/posix/CmdCopy.py b/src/python/jw/pkg/cmds/posix/CmdCopy.py index aa578b64..96014c79 100644 --- a/src/python/jw/pkg/cmds/posix/CmdCopy.py +++ b/src/python/jw/pkg/cmds/posix/CmdCopy.py @@ -33,6 +33,11 @@ class CmdCopy(Cmd): # export action = 'store_true', help = 'Copy directories recursively', ) + parser.add_argument( + '--parents', + action = 'store_true', + help = 'Land a single object at its source path below the destination root', + ) parser.add_argument( '-F', '--fixed-strings', @@ -61,4 +66,5 @@ class CmdCopy(Cmd): # export # -- A mode is given as a string, if at all mode = int(args.mode, 0) if args.mode is not None else None, recursive = args.recursive, + parents = args.parents, ) diff --git a/test/integration/jw_pkg/help/test-expected.txt b/test/integration/jw_pkg/help/test-expected.txt index 0b0c0b39..9c2e5f12 100644 --- a/test/integration/jw_pkg/help/test-expected.txt +++ b/test/integration/jw_pkg/help/test-expected.txt @@ -186,7 +186,8 @@ Available subcommands of posix: copy Copy files tar Handle tar archives ============= Running: jw-pkg.py -t ../../../.. --log-level info posix copy --help -usage: jw-pkg.py posix copy [-h] [-o OWNER] [-g GROUP] [-m MODE] [-r] [-F] +usage: jw-pkg.py posix copy [-h] [-o OWNER] [-g GROUP] [-m MODE] [-r] + [--parents] [-F] src dst Copy files @@ -201,6 +202,8 @@ options: -g, --group GROUP Destination file group (default: None) -m, --mode MODE Destination file mode (default: None) -r, --recursive Copy directories recursively (default: False) + --parents Land a single object at its source path below the + destination root (default: False) -F, --fixed-strings Don't expand macros in and (default: False) ============= Running: jw-pkg.py -t ../../../.. --log-level info posix tar --help usage: jw-pkg.py posix tar [-h] ...