Add documentation for from-ics and from-vcf (#1509)

This commit is contained in:
Andrew Davis 2020-03-20 21:50:13 -04:00 committed by GitHub
parent 918822ae0d
commit a7ec00a037
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 77 additions and 0 deletions

40
docs/commands/from-ics.md Normal file
View file

@ -0,0 +1,40 @@
# from-ics
Parse text as `.ics` and create table.
Syntax: `from-ics`
## Examples
Suppose calendar.txt is a text file that is formatted like a `.ics` (iCal) file:
```shell
> open calendar.txt
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20171007T200000Z
DTEND:20171007T233000Z
DTSTAMP:20200319T182138Z
SUMMARY:Basketball Game
UID:4l80f6dcovnriq38g57g07btid@google.com
...
```
Pass the output of the `open` command to `from-ics` to get a correctly formatted table:
```shell
> open calendar.txt | from-ics
───┬────────────────┬──────────────────┬────────────────┬────────────────┬────────────────┬────────────────┬────────────────
# │ properties │ events │ alarms │ to-Dos │ journals │ free-busys │ timezones
───┼────────────────┼──────────────────┼────────────────┼────────────────┼────────────────┼────────────────┼────────────────
0 │ [table 0 rows] │ [table 1 row] │ [table 0 rows] │ [table 0 rows] │ [table 0 rows] │ [table 0 rows] │ [table 0 rows]
───┴────────────────┴──────────────────┴────────────────┴────────────────┴────────────────┴────────────────┴────────────────
```
```shell
> open calendar.txt | from-ics | get events | get properties | where name == "SUMMARY"
─────┬─────────┬───────────────────────────────────────┬────────
# │ name │ value │ params
─────┼─────────┼───────────────────────────────────────┼────────
0 │ SUMMARY │ Basketball Game │
```

37
docs/commands/from-vcf.md Normal file
View file

@ -0,0 +1,37 @@
# from-vcf
Parse text as `.vcf` and create table.
Syntax: `from-vcf`
## Examples
Suppose contacts.txt is a text file that is formatted like a `.vcf` (vCard) file:
```shell
> open contacts.txt
BEGIN:VCARD
VERSION:3.0
FN:John Doe
N:Doe;John;;;
EMAIL;TYPE=INTERNET:john.doe99@gmail.com
...
```
Pass the output of the `open` command to `from-vcf` to get a correctly formatted table:
```shell
> open contacts.txt | from-vcf
─────┬─────────────────
# │ properties
─────┼─────────────────
0 │ [table 8 rows]
```
```shell
> open contacts.txt | from-vcf | get properties | where $it.name == "FN" | pick value
─────┬──────────────────────
# │ value
─────┼──────────────────────
0 │ John Doe
```