I have recently had to wrap a few commandline tools to better integrate with my workflows and built a package which hopes to solve a few common patterns during interface design and decrease the need for package builders to reinvent the wheel when it comes to supporting commandline arguments. Package link here
The package makes it easy to build vectors like:
c("--flag1", "value1", "--flag2", "value2") for passing to
processx. Further, I’ve built macros that make it easy to grab the command path from environment variables,
options, or user-input paths and check that the tool is installed at that location. This significantly reduces the boilerplate code for error-handling when having to deal with a non-R tool. Finally, it adds some helpers for allowing all commandline flags to be supported (via
...) without having to hand-code each flag as a function argument, essentially allowing lazy evaluation of command-line flags. This is supported by tools for parsing
--help text to provide the user with helpful suggestions in case they misspell or use an invalid flag in their function call.
Overall it is in a pretty stable state. I originally named the project
dotargs (Dot Arguments) because its scope was initially for solving a much smaller problem (passing flags to
...), and now I think it needs a rename before submission to CRAN.
I know this may help solve a much broader scope of problems than those handled by Ropensci, but I think the scientific community often faces a problem of having to utilize multiple environments in order to use the best tool for the job during data analysis. This package is designed to be helpful to package builders who want to write fully-supported wrappers, but also easy for scientists to use who just want to get things done a little faster by not leaving R.
I’m at the point where some additional eyes on the project would be really helpful. As a bonus, votes for new names would be so greatly appreciated.
Some alternative names that others have suggested to me:
- cmdbuild (or other variations of “command builder”)
Thoughts/comments/etc. all greatly appreciated.
Package link (again)