mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
rename frontend to web and update contributing guide (#2509)
* rename frontend to web and update contributing guide * rename this time * fix build * restructure rust code * update documentation * update descriptions * Update CONTRIBUTING.md Co-authored-by: J H <2364004+Blu-J@users.noreply.github.com> --------- Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Co-authored-by: J H <2364004+Blu-J@users.noreply.github.com>
This commit is contained in:
50
core/startos/src/properties.rs
Normal file
50
core/startos/src/properties.rs
Normal file
@@ -0,0 +1,50 @@
|
||||
use clap::ArgMatches;
|
||||
use color_eyre::eyre::eyre;
|
||||
use rpc_toolkit::command;
|
||||
use serde_json::Value;
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::context::RpcContext;
|
||||
use crate::prelude::*;
|
||||
use crate::procedure::ProcedureName;
|
||||
use crate::s9pk::manifest::PackageId;
|
||||
use crate::{Error, ErrorKind};
|
||||
|
||||
pub fn display_properties(response: Value, _: &ArgMatches) {
|
||||
println!("{}", response);
|
||||
}
|
||||
|
||||
#[command(display(display_properties))]
|
||||
pub async fn properties(#[context] ctx: RpcContext, #[arg] id: PackageId) -> Result<Value, Error> {
|
||||
Ok(fetch_properties(ctx, id).await?)
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
pub async fn fetch_properties(ctx: RpcContext, id: PackageId) -> Result<Value, Error> {
|
||||
let peek = ctx.db.peek().await;
|
||||
|
||||
let manifest = peek
|
||||
.as_package_data()
|
||||
.as_idx(&id)
|
||||
.ok_or_else(|| Error::new(eyre!("{} is not installed", id), ErrorKind::NotFound))?
|
||||
.expect_as_installed()?
|
||||
.as_manifest()
|
||||
.de()?;
|
||||
if let Some(props) = manifest.properties {
|
||||
props
|
||||
.execute::<(), Value>(
|
||||
&ctx,
|
||||
&manifest.id,
|
||||
&manifest.version,
|
||||
ProcedureName::Properties,
|
||||
&manifest.volumes,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
.await?
|
||||
.map_err(|(_, e)| Error::new(eyre!("{}", e), ErrorKind::Docker))
|
||||
.and_then(|a| Ok(a))
|
||||
} else {
|
||||
Ok(Value::Null)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user