Is there a way to use coreutils as a library? #6103
-
Hi, I am thinking is there a way to use coreutils as a library? Because I am trying to develop a binary command, for all major platforms: MacOS,Linux and Windows. In Windows, it's such a common requirements that we create directory(mkdir), create symlink(ln), etc. I want to embed coreutils, so I don't have to re-implement these things again, or invoke a child-process to do it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, in two ways. It's possible to call the The second way is to do some argument parsing yourself and then call the util. This is how nushell uses coreutils. We have only exposed the API for that in a few utils though. |
Beta Was this translation helpful? Give feedback.
Yes, in two ways. It's possible to call the
uumain
method which will just run the util. This is what the multicall binary uses as well. However, note that we might change that API without warning.The second way is to do some argument parsing yourself and then call the util. This is how nushell uses coreutils. We have only exposed the API for that in a few utils though.