1
0

feat: update highlevel

This commit is contained in:
2026-04-22 14:53:22 +08:00
parent fc2097560c
commit fed02ad9bc
3 changed files with 48 additions and 13 deletions

View File

@@ -82,9 +82,9 @@ pub enum CliCommands {
#[command(name = "status")]
#[command(about = "Fetch the status of registration with given manifest and scope.")]
Status {
/// The scope where fetch info.
#[arg(short = 't', long = "target", value_name = "TARGET", required = true, value_enum, default_value_t = RegScope::User)]
target: RegScope,
/// The view where fetch info.
#[arg(short = 't', long = "target", value_name = "TARGET", required = true, value_enum, default_value_t = RegView::User)]
target: RegView,
},
#[command(name = "ext")]
#[command(about = "File extension related operations according to given program manifest.")]

View File

@@ -8,15 +8,18 @@ use thiserror::Error as TeError;
/// Error occurs in this module.
#[derive(Debug, TeError)]
pub enum Error {
/// Error when parsing manifest TOML file.
/// Error when parsing Manifest TOML file.
#[error("{0}")]
ParseManifest(#[from] manifest::ParseManifestError),
/// Error when parsing manifest into schema.
/// Error when parsing Manifest into Schema.
#[error("{0}")]
ParseSchema(#[from] manifest::ParseSchemaError),
/// Error when parsing schema into program.
/// Error when parsing Schema into Program.
#[error("{0}")]
ParseProgram(#[from] wfassoc::highlevel::ParseProgramError),
/// Error when operating Program.
#[error("{0}")]
Program(#[from] wfassoc::highlevel::ProgramError),
}
/// Result type used in this module.
@@ -34,16 +37,22 @@ fn stringified_exts_to_indices(program: &wfassoc::Program, exts: Vec<String>) ->
// region: Respective Runners
fn run_register(program: wfassoc::Program, scope: wfassoc::Scope) -> Result<()> {
todo!()
fn run_register(mut program: wfassoc::Program, scope: wfassoc::Scope) -> Result<()> {
Ok(program.register(scope)?)
}
fn run_unregister(program: wfassoc::Program, scope: wfassoc::Scope) -> Result<()> {
todo!()
fn run_unregister(mut program: wfassoc::Program, scope: wfassoc::Scope) -> Result<()> {
Ok(program.unregister(scope)?)
}
fn run_status(program: wfassoc::Program, scope: wfassoc::Scope) -> Result<()> {
todo!()
fn run_status(program: wfassoc::Program, view: wfassoc::View) -> Result<()> {
if program.is_registered(view)? {
println!("Application is installed.");
} else {
println!("Application is not installed.");
}
Ok(())
}
fn run_ext_link(program: wfassoc::Program, scope: wfassoc::Scope, exts: Vec<String>) -> Result<()> {