Avoid awk on macOS

I was hoping they'd have gawk installed, but I guess not.
This commit is contained in:
Robbert van der Helm
2022-02-16 13:34:20 +01:00
parent 9b41017f36
commit c5c966c0cc
2 changed files with 16 additions and 1 deletions

View File

@@ -37,6 +37,9 @@ fn main() -> Result<()> {
bundle(&package, other_args)
}
// This is only meant to be used by the CI, since using awk for this can be a bit spotty on
// macOS
"known-packages" => list_known_packages(),
_ => bail!("Unknown command '{command}'\n\n{USAGE_STRING}"),
}
}
@@ -124,6 +127,18 @@ fn bundle(package: &str, mut args: Vec<String>) -> Result<()> {
Ok(())
}
/// This lists the packages configured in `bundler.toml`. This is only used as part of the CI when
/// bundling plugins.
fn list_known_packages() -> Result<()> {
if let Some(config) = load_bundler_config()? {
for package in config.keys() {
println!("{package}");
}
}
Ok(())
}
/// Load the `bundler.toml` file, if it exists. If it does exist but it cannot be parsed, then this
/// will return an error.
fn load_bundler_config() -> Result<Option<BundlerConfig>> {