mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Allow invoking the xtask library with custom args
Useful when providing a cargo sub command.
This commit is contained in:
@@ -43,9 +43,16 @@ pub enum CompilationTarget {
|
|||||||
|
|
||||||
/// The main xtask entry point function. See the readme for instructions on how to use this.
|
/// The main xtask entry point function. See the readme for instructions on how to use this.
|
||||||
pub fn main() -> Result<()> {
|
pub fn main() -> Result<()> {
|
||||||
|
let args = std::env::args().skip(1);
|
||||||
|
main_with_args(args)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The main xtask entry point function, but with custom command line arguments. `args` should not
|
||||||
|
/// contain the command name, so you should always skip at least one argument from
|
||||||
|
/// `std::env::args()` before passing it to this function.
|
||||||
|
pub fn main_with_args(mut args: impl Iterator<Item = String>) -> Result<()> {
|
||||||
chdir_workspace_root()?;
|
chdir_workspace_root()?;
|
||||||
|
|
||||||
let mut args = std::env::args().skip(1);
|
|
||||||
let command = args
|
let command = args
|
||||||
.next()
|
.next()
|
||||||
.context(format!("Missing command name\n\n{USAGE_STRING}"))?;
|
.context(format!("Missing command name\n\n{USAGE_STRING}"))?;
|
||||||
|
|||||||
Reference in New Issue
Block a user