From 65e7d7d0a035e2783e9f5ab4725578f48738784f Mon Sep 17 00:00:00 2001 From: Alessandro ZANNI Date: Sat, 15 Oct 2016 01:32:38 +0200 Subject: [PATCH] adding expandvars function --- pupy/modules/upload.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pupy/modules/upload.py b/pupy/modules/upload.py index 4848d184..8d435ff1 100644 --- a/pupy/modules/upload.py +++ b/pupy/modules/upload.py @@ -15,7 +15,8 @@ class UploaderScript(PupyModule): self.arg_parser.add_argument('local_file', metavar='', completer=path_completer) self.arg_parser.add_argument('remote_file', metavar='') def run(self, args): - if args.remote_file.endswith('.'): - args.remote_file = args.remote_file.replace('.', args.local_file.split(os.sep)[-1]) - upload(self.client.conn, args.local_file, args.remote_file) - self.success("file local:%s uploaded to remote:%s"%(args.local_file, args.remote_file)) + dst = self.client.conn.modules['os.path'].expandvars(args.remote_file) + if dst.endswith('.'): + dst = dst.replace('.', args.local_file.split(os.sep)[-1]) + upload(self.client.conn, args.local_file, dst) + self.success("file local:%s uploaded to remote:%s"%(args.local_file, dst))