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. |
Answered by
tertsdiepraam
Mar 22, 2024
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. |
1 reply
Answer selected by
linrongbin16
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, in two ways. It's possible to call the
uumainmethod 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.