Nushell plugin for interacting with D-Bus
at main 36 lines 810 B view raw
1use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand}; 2use nu_protocol::{LabeledError, Signature, Value}; 3 4use crate::DbusSignatureUtilExt; 5 6pub struct Main; 7 8impl SimplePluginCommand for Main { 9 type Plugin = crate::NuPluginDbus; 10 11 fn name(&self) -> &str { 12 "dbus" 13 } 14 15 fn signature(&self) -> Signature { 16 Signature::build(self.name()).dbus_command() 17 } 18 19 fn description(&self) -> &str { 20 "Commands for interacting with D-Bus" 21 } 22 23 fn search_terms(&self) -> Vec<&str> { 24 vec!["dbus"] 25 } 26 27 fn run( 28 &self, 29 _plugin: &Self::Plugin, 30 engine: &EngineInterface, 31 call: &EvaluatedCall, 32 _input: &Value, 33 ) -> Result<Value, LabeledError> { 34 Ok(Value::string(engine.get_help()?, call.head)) 35 } 36}