Exemple #1
0
    def do_cat(self, line):
        parser = argparse.ArgumentParser(prog="cat", add_help=False)
        parser.add_argument('files', type=str, nargs='+')
        args = parser.parse_args(line.split())

        for f in args.files:
            write_stdout(self._fs.cat(f))
Exemple #2
0
    def do_tail(self, line):
        parser = argparse.ArgumentParser(prog="tail", add_help=False)
        parser.add_argument('files', type=str, nargs='+')
        parser.add_argument('-c', '--bytes', type=int, default=1024)
        args = parser.parse_args(line.split())

        for f in args.files:
            write_stdout(self._fs.tail(f, size=args.bytes))
    def do_head(self, line):
        parser = argparse.ArgumentParser(prog="head", add_help=False)
        parser.add_argument('files', type=str, nargs='+')
        parser.add_argument('-c', '--bytes', type=int, default=1024)
        try: args = parser.parse_args(line.split())
        except: pass

        for f in args.files:
            write_stdout(self._fs.head(f, size=args.bytes))