lib.util.copy(): Support FileContext source, file types, and --parents #144

Merged
Jan Lindemann merged 8 commits from jan/feature/20261017-lib-util-copy-support-filecontext-source-file-types-and-parents into master 2026-10-17 11:57:05 +02:00 AGit
2 changed files with 10 additions and 1 deletions
Showing only changes of commit e5656d7d18 - Show all commits

cmds.posix.CmdCopy: Add --parents
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m54s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 5m0s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m50s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m42s
CI / Packaging test (push) Successful in 0s

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 <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.1.0
Jan Lindemann 2026-10-03 21:39:31 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -33,6 +33,11 @@ class CmdCopy(Cmd): # export
action = 'store_true', action = 'store_true',
help = 'Copy directories recursively', 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( parser.add_argument(
'-F', '-F',
'--fixed-strings', '--fixed-strings',
@ -61,4 +66,5 @@ class CmdCopy(Cmd): # export
# -- A mode is given as a string, if at all # -- A mode is given as a string, if at all
mode = int(args.mode, 0) if args.mode is not None else None, mode = int(args.mode, 0) if args.mode is not None else None,
recursive = args.recursive, recursive = args.recursive,
parents = args.parents,
) )

View file

@ -186,7 +186,8 @@ Available subcommands of posix:
copy Copy files copy Copy files
tar Handle tar archives tar Handle tar archives
============= Running: jw-pkg.py -t ../../../.. --log-level info posix copy --help ============= 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 src dst
Copy files Copy files
@ -201,6 +202,8 @@ options:
-g, --group GROUP Destination file group (default: None) -g, --group GROUP Destination file group (default: None)
-m, --mode MODE Destination file mode (default: None) -m, --mode MODE Destination file mode (default: None)
-r, --recursive Copy directories recursively (default: False) -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 <src> and <dst> (default: False) -F, --fixed-strings Don't expand macros in <src> and <dst> (default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info posix tar --help ============= Running: jw-pkg.py -t ../../../.. --log-level info posix tar --help
usage: jw-pkg.py posix tar [-h] ... usage: jw-pkg.py posix tar [-h] ...