Skip to content

Commit 8e0a425

Browse files
committed
update README with help from autogenerated usage
1 parent c3fa402 commit 8e0a425

1 file changed

Lines changed: 154 additions & 1 deletion

File tree

README.md

Lines changed: 154 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,155 @@
11
# nu_plugin_dbus
2-
Nushell plugin for interacting with D-Bus
2+
3+
Commands for interacting with D-Bus
4+
5+
Search terms: dbus
6+
7+
Usage:
8+
> dbus
9+
10+
Subcommands:
11+
dbus call - Call a method and get its response
12+
dbus get - Get a D-Bus property
13+
dbus get-all - Get all D-Bus property for the given objects
14+
dbus set - Get all D-Bus property for the given objects
15+
16+
Flags:
17+
-h, --help - Display the help message for this command
18+
19+
## `dbus call`
20+
21+
Call a method and get its response
22+
23+
Returns an array if the method call returns more than one value.
24+
25+
Search terms: dbus
26+
27+
Usage:
28+
> dbus call {flags} <object> <interface> <method> ...(args)
29+
30+
Flags:
31+
-h, --help - Display the help message for this command
32+
--session - Send to the session message bus (default)
33+
--system - Send to the system message bus
34+
--started - Send to the bus that started this process, if applicable
35+
--bus <String> - Send to the bus server at the given address
36+
--peer <String> - Send to a non-bus D-Bus server at the given address. Will not call the Hello method on initialization.
37+
--timeout <Duration> - How long to wait for a response
38+
--signature <String> - Signature of the arguments to send, in D-Bus format.
39+
If not provided, they will be determined from introspection.
40+
If --no-introspect is specified and this is not provided, they will be guessed (poorly)
41+
--no-flatten - Always return a list of all return values
42+
--no-introspect - Don't use introspection to determine the correct argument signature
43+
--dest (required parameter) <String> - The name of the connection to send the method to
44+
45+
Parameters:
46+
object <string>: The path to the object to call the method on
47+
interface <string>: The name of the interface the method belongs to
48+
method <string>: The name of the method to send
49+
...args <any>: Arguments to send with the method call
50+
51+
Examples:
52+
Ping the D-Bus server itself
53+
> dbus call --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.Peer Ping
54+
55+
Show a notification on the desktop for 5 seconds
56+
> dbus call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications Notify "Floppy disks" 0 "media-floppy" "Rarely seen" "But sometimes still used" [] {} 5000
57+
58+
## `dbus get`
59+
60+
Get a D-Bus property
61+
62+
Search terms: dbus
63+
64+
Usage:
65+
> dbus get {flags} <object> <interface> <property>
66+
67+
Flags:
68+
-h, --help - Display the help message for this command
69+
--session - Send to the session message bus (default)
70+
--system - Send to the system message bus
71+
--started - Send to the bus that started this process, if applicable
72+
--bus <String> - Send to the bus server at the given address
73+
--peer <String> - Send to a non-bus D-Bus server at the given address. Will not call the Hello method on initialization.
74+
--timeout <Duration> - How long to wait for a response
75+
--dest (required parameter) <String> - The name of the connection to read the property from
76+
77+
Parameters:
78+
object <string>: The path to the object to read the property from
79+
interface <string>: The name of the interface the property belongs to
80+
property <string>: The name of the property to read
81+
82+
Examples:
83+
Get the currently playing song in Spotify
84+
> dbus get --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Metadata
85+
╭──────────────┬───────────────────────────────────────────────────────╮
86+
│ xesam:title │ Birdie │
87+
│ xesam:artist │ [list 1 item] │
88+
│ xesam:album │ Love Your Love │
89+
│ xesam:url │ https://open.spotify.com/track/51748BvzeeMs4PIdPuyZmv │
90+
╰──────────────┴───────────────────────────────────────────────────────╯
91+
92+
## `dbus get-all`
93+
94+
Get all D-Bus property for the given objects
95+
96+
Search terms: dbus
97+
98+
Usage:
99+
> dbus get-all {flags} <object> <interface>
100+
101+
Flags:
102+
-h, --help - Display the help message for this command
103+
--session - Send to the session message bus (default)
104+
--system - Send to the system message bus
105+
--started - Send to the bus that started this process, if applicable
106+
--bus <String> - Send to the bus server at the given address
107+
--peer <String> - Send to a non-bus D-Bus server at the given address. Will not call the Hello method on initialization.
108+
--timeout <Duration> - How long to wait for a response
109+
--dest (required parameter) <String> - The name of the connection to read the property from
110+
111+
Parameters:
112+
object <string>: The path to the object to read the property from
113+
interface <string>: The name of the interface the property belongs to
114+
115+
Examples:
116+
Get the current player state of Spotify
117+
> dbus get-all --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player
118+
╭────────────────┬────────╮
119+
│ CanPlay │ true │
120+
│ Volume │ 0.43 │
121+
│ PlaybackStatus │ Paused │
122+
╰────────────────┴────────╯
123+
124+
## `dbus set`
125+
126+
Get all D-Bus property for the given objects
127+
128+
Search terms: dbus
129+
130+
Usage:
131+
> dbus set {flags} <object> <interface> <property> <value>
132+
133+
Flags:
134+
-h, --help - Display the help message for this command
135+
--session - Send to the session message bus (default)
136+
--system - Send to the system message bus
137+
--started - Send to the bus that started this process, if applicable
138+
--bus <String> - Send to the bus server at the given address
139+
--peer <String> - Send to a non-bus D-Bus server at the given address. Will not call the Hello method on initialization.
140+
--timeout <Duration> - How long to wait for a response
141+
--signature <String> - Signature of the value to set, in D-Bus format.
142+
If not provided, it will be determined from introspection.
143+
If --no-introspect is specified and this is not provided, it will be guessed (poorly)
144+
--dest (required parameter) <String> - The name of the connection to write the property on
145+
146+
Parameters:
147+
object <string>: The path to the object to write the property on
148+
interface <string>: The name of the interface the property belongs to
149+
property <string>: The name of the property to write
150+
value <any>: The value to write to the property
151+
152+
Examples:
153+
Set the volume of Spotify to 50%
154+
> dbus set --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Volume 0.5
155+

0 commit comments

Comments
 (0)