chshersh / zbg

✨ Zero Bullshit Git
Mozilla Public License 2.0
187 stars 11 forks source link

Use pure function instead of calling 'basename' #10

Closed chshersh closed 11 months ago

chshersh commented 1 year ago

Currently, zbg calls a separate process basename to extract the branch name.

https://github.com/chshersh/zbg/blob/7b448631f76e014f70347dcd88fa1514e9d52657/lib/git.ml#L13-L14

However, this is unnecessary as it could be implemented as a pure function (maybe a filepath library already has it?).

The plan:

anuragsoni commented 1 year ago

I stumbled upon this repo from the OCaml reddit! Since you are using Core already you might be able to replace your use of basename process execution by using the basename function in Core's Filename library.

https://ocaml.org/p/core/latest/doc/Core/Filename/index.html#val-basename

chshersh commented 1 year ago

Wow, @anuragsoni, that's super neat! Didn't know about this function 👀 Feel free to open a PR if you feel like it 🤗

chshersh commented 11 months ago

Closed by: