mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
cmds.posix.CmdCopy: Support platform macros
Expand platform macros (as in %{codename}) in the src and dst command
arguments. Expansion can be turned off by -F --fixed-strings.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
ef21dc1b1e
commit
b72c417510
1 changed files with 8 additions and 1 deletions
|
|
@ -22,6 +22,13 @@ class CmdCopy(Cmd): # export
|
|||
parser.add_argument('-o', '--owner', default=None, help='Destination file owner')
|
||||
parser.add_argument('-g', '--group', default=None, help='Destination file group')
|
||||
parser.add_argument('-m', '--mode', default=None, help='Destination file mode')
|
||||
parser.add_argument('-F', '--fixed-strings', action='store_true',
|
||||
help='Don\'t expand platform info macros in <src> and <dst>')
|
||||
|
||||
async def _run(self, args: Namespace) -> None:
|
||||
await copy(args.src, args.dst, owner=args.owner, group=args.group, mode=args.mode)
|
||||
def __expand(url: str) -> str:
|
||||
if args.fixed_strings:
|
||||
return url
|
||||
return self.app.distro_info(url)
|
||||
await copy(__expand(args.src), __expand(args.dst),
|
||||
owner=args.owner, group=args.group, mode=args.mode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue