cyclone-scheme / winds

The package manager for Cyclone Scheme.
28 stars 1 forks source link

csv library - add documentation to wiki #37

Open ghost opened 2 years ago

ghost commented 2 years ago

Thanks for adding my 'csv' library to cyclone/winds. I could not find a way to edit the wiki, so please see below the documentation, in markdown format.

CSV: (import (cyclone csv))

A CSV reader/writer library. RFC4180 compliant - http://tools.ietf.org/html/rfc4180 - but allowing:

The CSV reader/writer uses a standard input or output port. Records are retrieved or written as lists of field values. Fields are always read as strings. Fields are written using display unless they are strings needing quoting, when they are written character by character, or symbols, which are first converted to strings.

make-csv-reader

Creates a csv-reader object:

csv-read

Reads a single record (list of fields) from given reader, or current-input-port if no reader given.

csv-read-all

Reads a list of records (list of fields) from given reader, or current-input-port if no reader given.

> (import (cyclone csv) (scheme file))
> (with-input-from-file "data.csv" (lambda () (csv-read-all)))
(("123" "field 2" "456") ("789" "see, comma" "12"))

make-csv-writer

Creates a csv-writer object:

csv-write

Writes a single record (list of fields) in CSV format:

csv-write-all

Writes a list of records in CSV format:

> (import (cyclone csv) (scheme file))
> (with-output-to-file "data.csv" 
   (lambda () (csv-write-all '((123 "field 2" 456) (789 "see, comma" 012)))))

$ more data.csv
123,field 2,456
789,"see, comma",12
justinethier commented 2 years ago

Thanks @pcl-code, I have added this documentation to https://github.com/cyclone-scheme/winds/wiki/csv

@arthurmaciel I can adjust wiki permissions to allow anyone to make modifications. Do you have any concerns with a permissions change?

arthurmaciel commented 2 years ago

Hi Justin and pcl-code

Thanks for the documentation, pcl-code!

Thanks for adjusting the wiki permissions, Justin!

As soon as I can I'll add the documentation to the package repository itself. I think that is the best way to add official documentation.

Em seg, 23 de mai de 2022 11:17, Justin Ethier @.***> escreveu:

Thanks @pcl-code https://github.com/pcl-code, I have added this documentation to https://github.com/cyclone-scheme/winds/wiki/csv

@arthurmaciel https://github.com/arthurmaciel I can adjust wiki permissions to allow anyone to make modifications. Do you have any concerns with a permissions change?

— Reply to this email directly, view it on GitHub https://github.com/cyclone-scheme/winds/issues/37#issuecomment-1134736759, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACKRPFD6GPFD7EISQWMRLDVLOHOPANCNFSM5WQHTLGQ . You are receiving this because you were mentioned.Message ID: @.***>

justinethier commented 2 years ago

Thanks @arthurmaciel !

Well, I didn't make a permissions change yet but I think I will go ahead and do that later today.

I was trying to remember here. If there is documentation in the winds package, will it automatically update the wiki? I remember discussing this at one point but I don't think we added that automation?

arthurmaciel commented 2 years ago

@justinethier, If you haven't already made the permissions change, please do it. The idea is to have contributions from the community at the bottom of the wiki pages, after the horizontal rule.

About automation, yes - if there is a README.md in the winds package repo, it will be copied to the wiki and the contributions from the community are added to its bottom.

The automation was implemented a long time ago, but after CVE-2022-24765 was announced and some security changes were made to git itself, the third party actions we used to update the wiki stopped working with our current configuration. After banging my head against the wall, I decided to get rid of external code and the automation is back again (as far as I could test).

Sorry for the delay.

justinethier commented 2 years ago

No worries @arthurmaciel - thanks for the update and fixing the automation!

Permissions were changed right after I posted my last comment here. Sorry, I should have followed-up afterwards to confirm. If anyone has any further issues please let me know.