cmd

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2016 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "0.3.8"

VERSION of csvtk

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "csvtk",
	Short: "Another cross-platform, efficient and practical CSV/TSV toolkit",
	Long: fmt.Sprintf(`Another cross-platform, efficient and practical CSV/TSV toolkit

Version: %s

Author: Wei Shen <shenwei356@gmail.com>

Documents  : http://shenwei356.github.io/csvtk
Source code: https://github.com/shenwei356/csvtk

Attention:

  1. The CSV parser requires all the lines have same number of fields/columns.
     Even lines with spaces will cause error.
  2. By default, csvtk thinks your files have header row, if not, use "-H".
  3. By default, lines starting with '#' will be ignored, if the header row
     starts with '#', please assign "-C" another rare symbol, e.g. '$'.
  4. By default, csvtk handles CSV files, use "-t" for tab-delimited files.
  5. If " exists in tab-delimited files, use "-l".

`, VERSION),
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func NewCSVWriterChanByConfig

func NewCSVWriterChanByConfig(config Config) (chan []string, error)

NewCSVWriterChanByConfig returns a chanel which you can send record to write

Types

type CSVReader

type CSVReader struct {
	Reader *multicorecsv.Reader

	Ch chan CSVRecordsChunk
	// contains filtered or unexported fields
}

CSVReader is

func NewCSVReader

func NewCSVReader(file string, bufferSize int, chunkSize int) (*CSVReader, error)

NewCSVReader is

func (*CSVReader) Run

func (csvReader *CSVReader) Run()

Run begins to read

type CSVRecordsChunk

type CSVRecordsChunk struct {
	ID   uint64
	Data [][]string
	Err  error
}

CSVRecordsChunk is chunk of CSV records

type Config

type Config struct {
	ChunkSize int
	NumCPUs   int

	Delimiter    rune
	OutDelimiter rune
	// QuoteChar   rune
	CommentChar rune
	LazyQuotes  bool

	Tabs        bool
	OutTabs     bool
	NoHeaderRow bool

	OutFile string
}

Config is the struct containing all gloabl flags

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL