Source code for k1lib.cli.kcsv

# AUTOGENERATED FILE! PLEASE DON'T EDIT
"""All tools related to csv file format. Expected to use behind the "kcsv"
module name, like this::

    from k1lib.imports import *
    kcsv.cat("file.csv") | display()
"""
from k1lib import cli
from k1lib.cli import BaseCli
import csv, os
__all__ = ["cat"]
class _cat(BaseCli):
    def __ror__(self, file):
        file = os.path.expanduser(file)
        with open(file) as f:
            yield from csv.reader(f)
[docs]def cat(file:str=None) -> cli.Table[str]: """Opens a csv file, and turns them into nice row elements""" if file is None: return _cat() return file | _cat()