1
0

feat: fix exec runner issue

This commit is contained in:
2026-05-08 14:14:55 +08:00
parent ec5c78e8ce
commit d4b52efee0
3 changed files with 16 additions and 9 deletions

View File

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

View File

@@ -29,7 +29,10 @@ type Result<T> = std::result::Result<T, Error>;
// region: Utilities Functions
fn stringified_exts_to_indices(program: &wfassoc::Program, exts: Vec<String>) -> Result<Vec<usize>> {
fn stringified_exts_to_indices(
program: &wfassoc::Program,
exts: Vec<String>,
) -> Result<Vec<usize>> {
todo!()
}
@@ -45,17 +48,21 @@ fn run_unregister(mut program: wfassoc::Program, scope: wfassoc::Scope) -> Resul
Ok(program.unregister(scope)?)
}
fn run_status(program: wfassoc::Program, view: wfassoc::View) -> Result<()> {
if program.is_registered(view)? {
fn run_status(program: wfassoc::Program, scope: wfassoc::Scope) -> Result<()> {
if program.is_registered(scope)? {
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<()> {
fn run_ext_link(
mut program: wfassoc::Program,
scope: wfassoc::Scope,
exts: Vec<String>,
) -> Result<()> {
let exts = stringified_exts_to_indices(&program, exts)?;
for index in exts {
program.link_ext(scope, index)?;
@@ -64,7 +71,7 @@ fn run_ext_link(program: wfassoc::Program, scope: wfassoc::Scope, exts: Vec<Stri
}
fn run_ext_unlink(
program: wfassoc::Program,
mut program: wfassoc::Program,
scope: wfassoc::Scope,
exts: Vec<String>,
) -> Result<()> {

View File

@@ -601,7 +601,7 @@ impl Program {
}
}
pub fn ext_status(
pub fn query_ext(
&self,
view: View,
index: usize,