@@ -347,6 +347,9 @@ enum Feature {
|
||||
Get {
|
||||
/// Feature ID or name (su_compat, kernel_umount)
|
||||
id: String,
|
||||
/// Read from config file
|
||||
#[arg(long, default_value_t = false)]
|
||||
config: bool,
|
||||
},
|
||||
|
||||
/// Set feature value
|
||||
@@ -620,7 +623,13 @@ pub fn run() -> Result<()> {
|
||||
},
|
||||
|
||||
Commands::Feature { command } => match command {
|
||||
Feature::Get { id } => crate::feature::get_feature(&id),
|
||||
Feature::Get { id, config } => {
|
||||
if config {
|
||||
crate::feature::get_feature_config(&id)
|
||||
} else {
|
||||
crate::feature::get_feature(&id)
|
||||
}
|
||||
}
|
||||
Feature::Set { id, value } => crate::feature::set_feature(&id, value),
|
||||
Feature::List => {
|
||||
crate::feature::list_features();
|
||||
|
||||
@@ -198,6 +198,28 @@ pub fn get_feature(id: &str) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn get_feature_config(id: &str) -> Result<()> {
|
||||
let feature_id = parse_feature_id(id)?;
|
||||
|
||||
let features = load_binary_config()?;
|
||||
let id_u32 = feature_id as u32;
|
||||
|
||||
println!("Feature: {} ({})", feature_id.name(), id_u32);
|
||||
println!("Description: {}", feature_id.description());
|
||||
|
||||
if let Some(value) = features.get(&id_u32) {
|
||||
println!("Value: {value}");
|
||||
println!(
|
||||
"Status: {}",
|
||||
if *value != 0 { "enabled" } else { "disabled" }
|
||||
);
|
||||
} else {
|
||||
println!("Not set in config");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_feature(id: &str, value: u64) -> Result<()> {
|
||||
let feature_id = parse_feature_id(id)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user