[ANN] Feather: A lightweight shell-scripting library

Hi OCaml people!

I wrote a shell scripting library called Feather. I like idea of writing bash-like code quickly, later being able to intersperse OCaml to add more typeful components as needed. It’s kind of like Shexp but without the monadic interface and with Async support. (Feather_async)

There’s a tutorial and some examples in the link above but here’s a quick taste:

open Feather

let lines = find "." ~name:"*.ml"
  |. tr "/" "\n" 
  |. map_lines ~f:String.capitalize
  |. sort
  |. process "uniq" [ "-c" ]
  |. process "sort" [ "-n" ] 
  |. tail 4
  |> collect_lines
in
String.concat ~sep:", " lines |> print_endline

Let me know if you have any feedback! Hope it ends up being useful, entertaining, or both! :slightly_smiling_face: :camel:

33 Likes

Great example of excellent readme writing. Nice work

1 Like

Very interesting. I wish, though, it would be hosted on GitHub to have a better view into what people are doing with it and to see discussions around pull requests. I respect that you chose a different platform but I believe this limits the potentials for outside contributions.

I am thinking to use it to implement a driver for ffmpeg which is notorious for its complex command line options, which I would be more comfortable assembling in OCaml rather than Bash or Python.

Yeah I was using sourcehut because I like hg, but you make a good point about barriers to contribution. (Especially since the first step to contribute with sourcehut is to set up plain text email…) Anyways, it’s hosted on github now! Thanks for the feedback :slight_smile:

Good luck with your ffmpeg driver! I’ll be happy to respond to any questions or issues you run into if you end up using Feather.

2 Likes

I wish, though, it would be hosted on GitHub to have a better view into what people are doing with it and to see discussions around pull requests. I respect that you chose a different platform but I believe this limits the potentials for outside contributions.

I don’t share your believes :slight_smile:

Since I disabled tracking in my browser GitHub wants me to verify every
login with a verification number sent via email.

For me, sending a patch is so much simpler than making a pull request via
GitHub’s website.

2 Likes

The success of GitHub suggests that it is good at attracting collaboration and contributions. This does not negate your individual preference. There are high-profile profile projects like Xen or Linux that don’t rely on GitHub but I believe there is strong evidence that GitHub fosters collaboration. What other platform or medium has similar reach to suggest that my belief is wrong?

2 Likes