adding expandvars function

This commit is contained in:
Alessandro ZANNI 2016-10-15 01:32:38 +02:00
parent d013ee7b57
commit 65e7d7d0a0
1 changed files with 5 additions and 4 deletions

View File

@ -15,7 +15,8 @@ class UploaderScript(PupyModule):
self.arg_parser.add_argument('local_file', metavar='<local_path>', completer=path_completer) self.arg_parser.add_argument('local_file', metavar='<local_path>', completer=path_completer)
self.arg_parser.add_argument('remote_file', metavar='<remote_path>') self.arg_parser.add_argument('remote_file', metavar='<remote_path>')
def run(self, args): def run(self, args):
if args.remote_file.endswith('.'): dst = self.client.conn.modules['os.path'].expandvars(args.remote_file)
args.remote_file = args.remote_file.replace('.', args.local_file.split(os.sep)[-1]) if dst.endswith('.'):
upload(self.client.conn, args.local_file, args.remote_file) dst = dst.replace('.', args.local_file.split(os.sep)[-1])
self.success("file local:%s uploaded to remote:%s"%(args.local_file, args.remote_file)) upload(self.client.conn, args.local_file, dst)
self.success("file local:%s uploaded to remote:%s"%(args.local_file, dst))