jacobsalmela / NCutil

Notification Center utility- Add/remove apps, set alert styles, suppress App store notifications
GNU General Public License v2.0
171 stars 18 forks source link

Switch from getopt to optparse; this will allow more robust option parsi... #7

Closed gregneagle closed 9 years ago

gregneagle commented 9 years ago

...ng for future additions.

optparse is a more "modern" option parsing module for Python command-line programs; it adds some nice features we may need as more options are added to this tool.

I also removed the "short option" version for --remove-system-center since I think that's a potentially dangerous option, and I once typed NCutil -s com.foo.app none thinking that -s was short for "--setalertsyle"...

I'd like to suggest a syntax change for a future PR:

currently:

NCutil --alertstyle com.foo.foo banners

What if we flipped the order of the parameters to:

NCutil --alertstyle banners com.foo.foo

This would allow for:

NCutil --alertsyle banners com.foo.foo com.bar.bar com.baz.app

To set the notification style for multiple items at once.

We could do something similar with --insert and --remove:

NCutil.py --remove com.foo.foo com.bar.bar com.baz.app (etc).

jacobsalmela commented 9 years ago

The changes work as expected.

As for your suggestions, I concur with all of them, with one minor modification.

--alertstyle to --alert-style and --getalertstyle to --get-alert-style

so it is more in line with the others and it improves readability

gregneagle commented 9 years ago

No problem - but "--alertstyle" was your original form... :-)

jacobsalmela commented 9 years ago

Haha, I know. But then I remember how much I do not like trying to read the networksetup help: