mattly / bork

the Bash-Operated Reconciling Kludge
Other
218 stars 27 forks source link

defaults type doesn't handle dictionaries #36

Closed mrmemes-eth closed 8 years ago

mrmemes-eth commented 10 years ago

I'd like to assert that this has been configured:

defaults write com.runningwithcrayons.Alfred-Preferences hotkey.default -dict key -int 49 mod -int 1048576 string Space

So I tried converting it to:

ok defaults com.runningwithcrayons.Alfred-Preferences hotkey.default dictionary key -int 49 mod -int 1048576 string Space

and

ok defaults com.runningwithcrayons.Alfred-Preferences hotkey.default dictionary "{ key = 49; mod = 1048576; string = Space; }"

And both result in (something close to):

checking: defaults com.runningwithcrayons.Alfred-Preferences hotkey.default dictionmismatch (upgradable): defaults com.runningwithcrayons.Alfred-Preferences hotkey.default dictionary { key = 49; mod = 1048576; string = Space; }
expected value: {
received value: {
    key = 49;
    mod = 524288;
    string = Space;
}
2014-07-17 15:41:05.862 defaults[2600:507] Unexpected argument {; leaving defaults unchanged.
* failure

I'm content to just set the value as a one-off after a did_install check, but wanted to bring it to your attention.

mattly commented 8 years ago

man, defaults having dicts seems to against the whole namespaced preference thing. Why have a dict when you could do hotkey.default.key ? ugh.

I'm going to dig into defaults a bit for array/dict types and see if there's a sane strategy to be found here.

mrmemes-eth commented 8 years ago

fwiw, I've made it a couple of years without the feature, so probably not too big of a deal ;)

mattly commented 8 years ago

I made some notes at the top of the defaults type script on how to format the arguments. I've got a plan for better documentation.