def configure(self): ''' Defines the command arguments. ''' datasets = DatabaseRepository.listYears() raw_formats = FormatRepository.listExportableFormatNames() minifiable_formats = FormatRepository.listMinifiableFormatNames() self.addArgument('-d', '--datasets', metavar='DATASET', nargs='*', default=datasets, help=('Datasets to build.\n' 'Defaults to all available: {}' \ .format(', '.join(datasets)))) self.addArgument('-r', '--raw', metavar='FORMAT', nargs='*', default=raw_formats, help=('Raw formats to build the dataset.\n' 'Defaults to all available: {}' \ .format(', '.join(raw_formats)))) self.addArgument('-m', '--min', metavar='FORMAT', nargs='*', default=minifiable_formats, help=('Minifiable formats to build the dataset.\n' 'Defaults to all available: {}' \ .format(', '.join(minifiable_formats))))
def format(self): ''' Returns the file format. Returns: The file format ''' try: return FormatRepository.findByExtension(self.extension) except FormatError: return None
def renderDatasetFormats(self): ''' Renders the available dataset formats. Returns: str: The available dataset formats ''' grouped_formats = FormatRepository.groupExportableFormatsByType() markdown = '' for format_type, formats in grouped_formats: markdown += '\n'.join([ Markdown.header(format_type, depth=4), Markdown.unorderedList([ Markdown.link(_format.info, _format.friendlyName) for _format in formats ]) + '\n' ]) return markdown
def renderDatasetFormats(self): """ Renders the available dataset formats. Returns: str: The available dataset formats """ grouped_formats = FormatRepository.groupExportableFormatsByType() markdown = "" for format_type, formats in grouped_formats: markdown += "\n".join( [ Markdown.header(format_type, depth=4), Markdown.unorderedList([Markdown.link(_format.info, _format.friendlyName) for _format in formats]) + "\n", ] ) return markdown
def configure(self): ''' Defines the command arguments. ''' self.addArgument('-b', '--base', help='Database year to export.') self.addArgument('-f', '--format', metavar='FORMAT', choices=FormatRepository.listExportableFormatNames(), help=('Format to export the database.\n' 'Options: %(choices)s')) self.addArgument('-m', '--minify', dest='minify', action='store_true', help='Minifies output file whenever possible.') self.addArgument('-o', '--out', dest='filename', nargs='?', help=('Specify a file to write the export to.\n' 'If none are specified, %(prog)s writes data to ' 'standard output.'))
def configure(self): ''' Defines the command arguments. ''' self.addArgument('-b', '--base', help='Database year to export.') self.addArgument('-f', '--format', metavar='FORMAT', choices=FormatRepository.listExportableFormatNames(), help=('Format to export the database.\n' 'Options: %(choices)s')) self.addArgument('-m', '--minify', dest='minify', action='store_true', help='Minifies output file whenever possible.') self.addArgument( '-o', '--out', dest='filename', nargs='?', help=('Specify a file to write the export to.\n' 'If none are specified, %(prog)s writes data to ' 'standard output.'))