mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-06 20:58:28 +00:00
Add integration tests
This commit is contained in:
@@ -2,7 +2,7 @@ use std::process::{Command, Stdio};
|
||||
|
||||
use anyhow::{Context, Error};
|
||||
use clap::Parser;
|
||||
use wasmer_registry::{Bindings, WasmerConfig, ProgrammingLanguage};
|
||||
use wasmer_registry::{Bindings, ProgrammingLanguage, WasmerConfig};
|
||||
|
||||
/// Add a WAPM package's bindings to your application.
|
||||
#[derive(Debug, Parser)]
|
||||
|
||||
@@ -33,6 +33,21 @@ pub enum RetrievableConfigField {
|
||||
Cflags,
|
||||
/// `pkg-config`
|
||||
PkgConfig,
|
||||
/// `registry.url`
|
||||
#[clap(name = "registry.url")]
|
||||
RegistryUrl,
|
||||
/// `registry.token`
|
||||
#[clap(name = "registry.token")]
|
||||
RegistryToken,
|
||||
/// `telemetry.enabled`
|
||||
#[clap(name = "telemetry.enabled")]
|
||||
TelemetryEnabled,
|
||||
/// `update-notifications.url`
|
||||
#[clap(name = "update-notifications.enabled")]
|
||||
UpdateNotificationsEnabled,
|
||||
/// `proxy.url`
|
||||
#[clap(name = "proxy.url")]
|
||||
ProxyUrl,
|
||||
}
|
||||
|
||||
/// Setting that can be stored in the wasmer config
|
||||
@@ -157,6 +172,41 @@ impl Config {
|
||||
RetrievableConfigField::Cflags => {
|
||||
println!("{}", cflags);
|
||||
}
|
||||
other => {
|
||||
let config = WasmerConfig::from_file()
|
||||
.map_err(|e| anyhow::anyhow!("could not find config file: {e}"))?;
|
||||
match other {
|
||||
RetrievableConfigField::RegistryUrl => {
|
||||
println!("{}", config.registry.get_current_registry());
|
||||
}
|
||||
RetrievableConfigField::RegistryToken => {
|
||||
if let Some(s) = config.registry.get_login_token_for_registry(
|
||||
&config.registry.get_current_registry(),
|
||||
) {
|
||||
println!("{s}");
|
||||
}
|
||||
}
|
||||
RetrievableConfigField::ProxyUrl => {
|
||||
if let Some(s) = config.proxy.url.as_ref() {
|
||||
println!("{s}");
|
||||
}
|
||||
}
|
||||
RetrievableConfigField::TelemetryEnabled => {
|
||||
println!("{}", config.telemetry.enabled.to_string().replace('\"', ""));
|
||||
}
|
||||
RetrievableConfigField::UpdateNotificationsEnabled => {
|
||||
println!(
|
||||
"{}",
|
||||
config
|
||||
.update_notifications
|
||||
.enabled
|
||||
.to_string()
|
||||
.replace('\"', "")
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
},
|
||||
Set(s) => {
|
||||
let config_file = WasmerConfig::get_file_location()
|
||||
|
||||
Reference in New Issue
Block a user