···5mod client;
6mod convert;
7mod dbus_type;
089use config::*;
10use client::*;
···1819impl Plugin for NuPluginDbus {
20 fn signature(&self) -> Vec<PluginSignature> {
00021 vec![
22 PluginSignature::build("dbus")
23 .is_dbus_command()
···29 .extra_usage("Returns an array if the method call returns more than one value.")
30 .named("timeout", SyntaxShape::Duration, "How long to wait for a response", None)
31 .named("signature", SyntaxShape::String,
32- "Signature of the arguments to send, in D-Bus format\n\
33- If not provided, they will be guessed automatically (but poorly)", None)
34- .switch("no-flatten", "Always return a list of all return values", None)
0000035 .required_named("dest", SyntaxShape::String,
36 "The name of the connection to send the method to",
37 None)
···49 /org/freedesktop/DBus org.freedesktop.DBus.Peer Ping".into(),
50 description: "Ping the D-Bus server itself".into(),
51 result: None
52- }
000000000000000000000053 ]),
54 ]
55 }
···5mod client;
6mod convert;
7mod dbus_type;
8+mod introspection;
910use config::*;
11use client::*;
···1920impl Plugin for NuPluginDbus {
21 fn signature(&self) -> Vec<PluginSignature> {
22+ macro_rules! str {
23+ ($s:expr) => (Value::string($s, Span::unknown()))
24+ }
25 vec![
26 PluginSignature::build("dbus")
27 .is_dbus_command()
···33 .extra_usage("Returns an array if the method call returns more than one value.")
34 .named("timeout", SyntaxShape::Duration, "How long to wait for a response", None)
35 .named("signature", SyntaxShape::String,
36+ "Signature of the arguments to send, in D-Bus format.\n \
37+ If not provided, they will be determined from introspection.\n \
38+ If --no-introspect is specified and this is not provided, they will \
39+ be guessed (poorly)", None)
40+ .switch("no-flatten",
41+ "Always return a list of all return values", None)
42+ .switch("no-introspect",
43+ "Don't use introspection to determine the correct argument signature", None)
44 .required_named("dest", SyntaxShape::String,
45 "The name of the connection to send the method to",
46 None)
···58 /org/freedesktop/DBus org.freedesktop.DBus.Peer Ping".into(),
59 description: "Ping the D-Bus server itself".into(),
60 result: None
61+ },
62+ PluginExample {
63+ example: "dbus call --dest=org.mpris.MediaPlayer2.spotify \
64+ /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties Get \
65+ org.mpris.MediaPlayer2.Player Metadata".into(),
66+ description: "Get the currently playing song in Spotify".into(),
67+ result: Some(Value::record(nu_protocol::record!(
68+ "xesam:title" => str!("Birdie"),
69+ "xesam:artist" => Value::list(vec![
70+ str!("LOVE PSYCHEDELICO")
71+ ], Span::unknown()),
72+ "xesam:album" => str!("Love Your Love"),
73+ "xesam:url" => str!("https://open.spotify.com/track/51748BvzeeMs4PIdPuyZmv"),
74+ ), Span::unknown()))
75+ },
76+ PluginExample {
77+ example: "dbus call --dest=org.freedesktop.Notifications \
78+ /org/freedesktop/Notifications org.freedesktop.Notifications \
79+ Notify \"Floppy disks\" 0 \"media-floppy\" \"Rarely seen\" \
80+ \"But sometimes still used\" [] {} 5000".into(),
81+ description: "Show a notification on the desktop for 5 seconds".into(),
82+ result: None
83+ },
84 ]),
85 ]
86 }