m-cli
m-cli copied to clipboard
Airdrop status outputs an error first use
When getting Airdrop status for the first time:
./m airdrop status
2021-05-06 16:19:04.741 defaults[85572:47467663]
The domain/default pair of (com.apple.NetworkBrowser, DisableAirDrop) does not exist
Based on https://github.com/SummitRoute/osxlockdown/issues/50 this is expected, but it'd be nice to deal with.
One way to approach this would be to first check that the domain in question actually exists.
For example:
defaults read com.apple.NetworkBrowser
# yields the full configuration object
# exit value is 0
So, if that exits with 0 and defaults read com.apple.NetworkBrowser DisableAirDrop
exits with 1, perhaps we should assume that the property DisableAirDrop
just hasn't been set yet (which is the case in your example).
ie:
m airdrop status
# outputs "not previously set"
How to go about it really depends on how robust m-cli
should be. The above is a basic heuristic. Another reason for failure might be that it is both true that the property is not set in the plist AND it's an unreferenced property (IE, it's a property that isn't used by any program, which would be the case for misspelled properties).
Personally, I would go with the simple solution for now
EDIT: grammar