

def RunCommand(self):
    'Command entry point for the cat command.'
    show_header = False
    request_range = None
    start_byte = 0
    end_byte = None
    if self.sub_opts:
        for (o, a) in self.sub_opts:
            if (o == '-h'):
                show_header = True
            elif (o == '-r'):
                request_range = a.strip()
                range_matcher = re.compile('^(?P<start>[0-9]+)-(?P<end>[0-9]*)$|^(?P<endslice>-[0-9]+)$')
                range_match = range_matcher.match(request_range)
                if (not range_match):
                    raise CommandException(('Invalid range (%s)' % request_range))
                if range_match.group('start'):
                    start_byte = long(range_match.group('start'))
                if range_match.group('end'):
                    end_byte = long(range_match.group('end'))
                if range_match.group('endslice'):
                    start_byte = long(range_match.group('endslice'))
            else:
                self.RaiseInvalidArgumentException()
    return CatHelper(self).CatUrlStrings(self.args, show_header=show_header, start_byte=start_byte, end_byte=end_byte)

dataset/ETHPy150Open GoogleCloudPlatform/gsutil/gslib/commands/cat.py CatCommand.RunCommand/original