Skip to content

Commit

Permalink
cli docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Dec 6, 2019
1 parent 3a613e3 commit 556ade5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ for id, site in data.items():

More information on IterTable's gis support is available [here][gis].

### Command-Line Interface

IterTable provides a simple CLI for rendering the content of a file or Iter class. This can be useful for e.g. inspecting a file or for integrating a shell automation workflow. The default output is CSV, but can be changed to JSON by setting `-f json`.

```bash
python3 -m itertable example.json # JSON to CSV
python3 -m itertable -f json example.csv # CSV to JSON
python3 -m itertable example.xlsx "start_row=5"
python3 -m itertable http://example.com/example.csv
python3 -m itertable itertable.CsvNetIter "url=http://example.com/example.csv"
```

### Extending IterTable

It is straightforward to [extend IterTable][custom] to support arbitrary formats. Each provided class is composed of a [BaseIter][base] class and mixin classes ([loaders], [parsers], and [mappers]) that handle the various steps of the process.
Expand Down
11 changes: 6 additions & 5 deletions itertable/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ def cat(source, source_options, format):
Examples:
\b
itcat example.json
itcat example.xlsx "start_row=5"
itcat http://example.com/example.csv
itcat itertable.CsvNetIter "url=http://example.com/example.csv"
"""
python3 -m itertable example.json # JSON to CSV
python3 -m itertable -f json example.csv # CSV to JSON
python3 -m itertable example.xlsx "start_row=5"
python3 -m itertable http://example.com/example.csv
python3 -m itertable itertable.CsvNetIter "url=http://example.com/example.csv"
""" # noqa

# Parse option string
options = {}
Expand Down

0 comments on commit 556ade5

Please sign in to comment.