From 6eabf9aea4b5427165db9e6f34119b3f3ac9d146 Mon Sep 17 00:00:00 2001 From: Alessandro ZANNI Date: Wed, 5 Oct 2016 15:50:27 +0200 Subject: [PATCH] rm module --- pupy/modules/rm.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pupy/modules/rm.py diff --git a/pupy/modules/rm.py b/pupy/modules/rm.py new file mode 100644 index 00000000..9e333ace --- /dev/null +++ b/pupy/modules/rm.py @@ -0,0 +1,18 @@ +# -*- coding: UTF8 -*- +from pupylib.PupyModule import * +from pupylib.utils.rpyc_utils import redirected_stdio + +__class_name__="rm" + +@config(cat="admin") +class rm(PupyModule): + """ remove a file or a directory """ + + def init_argparse(self): + self.arg_parser = PupyArgumentParser(prog="rm", description=self.__doc__) + self.arg_parser.add_argument('path', type=str, action='store') + + def run(self, args): + self.client.load_package("pupyutils.basic_cmds") + with redirected_stdio(self.client.conn): + self.client.conn.modules["pupyutils.basic_cmds"].rm(args.path)