change upload function

This commit is contained in:
Alessandro ZANNI 2016-10-14 18:07:14 +02:00
parent 89aa935320
commit d013ee7b57
1 changed files with 3 additions and 1 deletions

View File

@ -15,5 +15,7 @@ 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):
upload(self.client.conn, args.local_file, self.client.conn.modules['os.path'].expandvars(args.remote_file)) 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)) self.success("file local:%s uploaded to remote:%s"%(args.local_file, args.remote_file))