From 32daa2f0cfe17c38f7e93050ce2c58487f235a6a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 12 2011 19:42:49 +0000 Subject: Take --name and --email arguments into account --- diff --git a/r2spec/r2spec_obj.py b/r2spec/r2spec_obj.py index a9d44c4..140f434 100644 --- a/r2spec/r2spec_obj.py +++ b/r2spec/r2spec_obj.py @@ -121,6 +121,16 @@ class Settings(object): with open(configfile, 'w') as conf: parser.write(conf) + def set(self, key, value): + """ Set the value to the given key in the settings. + + :arg key, name of the parameter to set from the settings. + :arg value, value of the parameter to set from the settings. + """ + if not key in self._dict.keys(): + raise KeyError(key) + self._dict[key] = value + def get(self, key): """ Return the associated with the given key in the settings. @@ -166,7 +176,12 @@ class R2spec(object): spec file according to the argument given. """ settings = Settings() - print settings.get('packager') + + if args.name: + settings.set('packager', args.name) + if args.email: + settings.set('email', args.email) + if args.package: pack = RPackage(args.package) pack.search_package_in_repo()