This is a simple CLI NetworkManager state checker written in D that works over D-Bus. It can print either numerical codes or textual representations of both device and overall connection state.
It can also continuously monitor the state and pass it to an external command when it changes.
I stole the descriptions from python-sdbus-networkmanager.
Usage:
nm-state [switches] <interface>
If <interface> is not provided, nm-state checks overall connection state.
Short switches can be combined, i.e., 'nm-state -wsqe dunstify'
General:
-h, --help print this message
Modes:
-c, --check (default) print current state to the terminal
-w, --watch watch for connection state changes
State representation:
-n, --numeric print numeric state representation
-s, --short (default) print short state description
-l, --long print long state description
Watch mode:
-q, --quiet don't print anything to the terminal
-e, --execute <cmd> pass state to the given command
dub build --build=release