~technomancy/fnlfmt

419551b9c197181ab0bc310d9c87f69d05e04b6a — jaawerth 6 months ago 4f933d0
add support for stdin via `fnlfmt -`
2 files changed, 12 insertions(+), 4 deletions(-)

M README.md
M fnlfmt
M README.md => README.md +9 -3
@@ 2,12 2,18 @@

Format your Fennel!

    $ ./fnlfmt mycode.fnl # prints formatted code to standard out

Right now it is strictly for indentation only. It's up to you to keep
your column lengths at 80 or under, so please do that.

For contributions, send patches directly to the maintainer or the
## Usage

    $ ./fnlfmt mycode.fnl # prints formatted code to standard out

    $ cat my-file.fnl | fnlfmt - # pipe fennel to stdin, get formatted stdout

## Contributing

Send patches directly to the maintainer or the
[Fennel mailing list](https://lists.sr.ht/%7Etechnomancy/fennel)

## Known issues

M fnlfmt => fnlfmt +3 -1
@@ 3,7 3,9 @@
(local fmt (require :fnlfmt))

(fn format [filename]
  (let [f (assert (io.open filename :r) "File not found.")
  (let [f (match filename
            :- io.stdin
            _ (assert (io.open filename :r) "File not found."))
        contents (f:read :*all)]
    (f:close)
    (print (fmt.fmt contents))))