mirror of
https://github.com/munki/munki.git
synced 2026-02-12 10:10:43 -06:00
Converted '--configure' option as a callback.
--configure as a callback eliminates the need to check if the option has been set to 'True'
This commit is contained in:
@@ -495,7 +495,7 @@ def pref(prefname):
|
||||
return None
|
||||
|
||||
|
||||
def configure():
|
||||
def configure(option, opt, value, parser):
|
||||
"""Configures munkiimport for use"""
|
||||
_prefs = {}
|
||||
for (key, prompt) in [
|
||||
@@ -512,6 +512,7 @@ def configure():
|
||||
FoundationPlist.writePlist(_prefs, PREFSPATH)
|
||||
except FoundationPlist.NSPropertyListWriteException:
|
||||
print >> sys.stderr, 'Could not save configuration to %s' % PREFSPATH
|
||||
exit(0)
|
||||
|
||||
|
||||
PREFSNAME = 'com.googlecode.munki.munkiimport.plist'
|
||||
@@ -541,7 +542,7 @@ def main():
|
||||
|
||||
p = PassThroughOptionParser(usage=usage)
|
||||
|
||||
p.add_option('--configure', action='store_true',
|
||||
p.add_option('--configure', action='callback', callback=configure,
|
||||
help="""Configure munkiimport with details about your
|
||||
munki repo, preferred editor, and the like. Any other
|
||||
options and arguments are ignored.""")
|
||||
@@ -559,15 +560,11 @@ def main():
|
||||
help='Print more output.')
|
||||
|
||||
options, arguments = p.parse_args()
|
||||
|
||||
|
||||
if options.version:
|
||||
print munkicommon.get_version()
|
||||
exit(0)
|
||||
|
||||
if options.configure:
|
||||
configure()
|
||||
exit(0)
|
||||
|
||||
NOINTERACTIVE = options.nointeractive
|
||||
VERBOSE = options.verbose
|
||||
|
||||
|
||||
Reference in New Issue
Block a user