MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / provider_list_profiles

Function provider_list_profiles

crates/openshell-cli/src/run.rs:5014–5061  ·  view source on GitHub ↗
(server: &str, output: &str, tls: &TlsOptions)

Source from the content-addressed store, hash-verified

5012}
5013
5014pub async fn provider_list_profiles(server: &str, output: &str, tls: &TlsOptions) -> Result<()> {
5015 let mut client = grpc_client(server, tls).await?;
5016 let response = client
5017 .list_provider_profiles(ListProviderProfilesRequest {
5018 limit: 100,
5019 offset: 0,
5020 })
5021 .await
5022 .into_diagnostic()?;
5023 let mut profiles = response.into_inner().profiles;
5024 profiles.sort_by(|left, right| {
5025 left.category
5026 .cmp(&right.category)
5027 .then_with(|| left.id.cmp(&right.id))
5028 });
5029 let dto_profiles = profiles
5030 .iter()
5031 .map(ProviderTypeProfile::from_proto)
5032 .collect::<Vec<_>>();
5033
5034 if crate::output::print_output_direct(
5035 output,
5036 || profiles_to_json(&dto_profiles).into_diagnostic(),
5037 || profiles_to_yaml(&dto_profiles).into_diagnostic(),
5038 )? {
5039 return Ok(());
5040 }
5041
5042 if profiles.is_empty() {
5043 println!("No provider profiles found.");
5044 return Ok(());
5045 }
5046
5047 println!("{}", "Available Provider Profiles:".cyan().bold());
5048 let id_width = provider_profile_id_width(&profiles);
5049 let display_width = provider_profile_display_width(&profiles);
5050 let mut current_category = i32::MIN;
5051 for profile in profiles {
5052 if profile.category != current_category {
5053 current_category = profile.category;
5054 println!();
5055 println!(" {}", display_provider_category(current_category).bold());
5056 }
5057 print_provider_type_row(&profile, id_width, display_width);
5058 }
5059
5060 Ok(())
5061}
5062
5063pub async fn provider_profile_export(
5064 server: &str,

Calls 9

grpc_clientFunction · 0.85
print_output_directFunction · 0.85
profiles_to_jsonFunction · 0.85
profiles_to_yamlFunction · 0.85
print_provider_type_rowFunction · 0.85
is_emptyMethod · 0.45