[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:

35 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?

3 Likes

I wouldn’t call it fostering collaboration. First of all it cements it’s own inevitability. Fostering IMO would require federation, but that’s nothing thought of (yet). I for my (irrelevant) part have mere mirrors at github á la POSSE - IndieWeb.

1 Like

You missed important parts of that:

As for the evidence, check out Contributors to ocaml/ocaml · GitHub

I think it’s rather easy to guess when OCaml moved to GitHub.

1 Like

@yawaramin, @lindig you talk about popularity. I about dependency. Fostering isn’t just letting graze.

With due respect of your noble intentions, it really troubles me, to see multi-billion dollar monopolies gnaw away from individuals. In this case Microsoft from Drew. With your rather forceful assistence. Drew is an entity, I, as another individual, can relate to. github is just a huge pile of some billion dollars. Those don’t care about anything but more of them. I’m careful not to rely on such. So is youtube-dl and e.g. people from Iran, I guess.

That aside, I think it’s abusive to scare people about hosting. Kindly asking them to mirror is ok, asking to move is embarrassing. Issues and PRs may occur wherever they do. Especially with small projects no deal, is it?

And let me add a personal thing: One reason why OCaml is appealing to me, is that it’s (mostly) GAFAM-free, as I understand it. Why should I use OCaml? - #6 by mro

1 Like

I think all those consideration are extremely out-of-topic, and I suggest you get back to the fantastic package that @etc developed. :slight_smile:

5 Likes

I completely agree that “fostering collaboration” should not reduce individual liberty. I cherish the liberty within the Ocaml world (program as you want, use the libraries you want, build as you want, use the hosting platform you want, …). I know, it has a cost such as friendliness for newbies. As an old Ocaml developer (since 1993), some recent evolution make me unease (opam, dune, use of github, …). I appreciate the power they bring but they seem to come at the price that whenever you want to do something your way, the response is often “do not do it that way but you should use/do …”. Perhaps it is only a question of tone…