#datatype #csv #header #column #write #parameters #generate

nightly app csvgen

small utility to create mock-csvfiles

2 releases

Uses old Rust 2015

0.1.1 May 8, 2018
0.1.0 May 8, 2018

#34 in #datatype

BSD-3-Clause

15KB
261 lines

csvgen

codecov Build Status

a small utility to create mock-csv files with various datatypes.

commandline parameters

All commandline parameters are optional.

  • size: required filesize

    default: 2 MB

  • header: create column headers

    default: string, float, int

  • column-types: pass types for column values

    default: string, float, int

  • filepath: write to provided path

    default: stdout

examples

display help

$ csvgen --help
csvgen 0.1.0
jkm <jkm@bricknet.de>
Generate mock csv-files with various datatypes.

USAGE:
    csvgen [FLAGS] [OPTIONS]

FLAGS:
        --help       Prints help information
    -h, --header     Print column headers.
    -V, --version    Prints version information

OPTIONS:
    -c, --column-types <Column Types>    Specify types for columns.
    -f, --filepath <File path>           Write to file path instead of stdout.
    -s, --size <Size>                    Specify size of output file in MB.

write 1 MB to stdout using default output-format

$ csvgen -s 1 | tail -5
"pass cute",234.63565236879606,-1574574
"modern pleasure found various",-370.60698067726923,172070
"burn vegetable modern various",-257.9846409797992,-155605
"knowing",515.0382860189012,-1358241
"explain thank dress",500.2067882269995,1523743

write default-sized (2 MB), custom-formatted file at specified path and print header-line

$ csvgen -h -c int,string,int,string,int -f /tmp/foo.csv
$ head -5 /tmp/foo.csv
int,string,int,string,int
935304,"knowing explain burn sofa",-219593,"sofa sofa",1119124
-1141850,"dress modern vegetable knowing",-740429,"compare cute agree",861869
-1628699,"dress sofa grateful",-1109470,"agree explain",632448
-684272,"cooing tail",639600,"dress",1110599

Dependencies

~1MB
~13K SLoC