From 10baf592764a6f8208f9291bd6714fecb2df33cd Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 1 Jul 2008 00:59:09 +0200 Subject: bin/envstore: Add save_raw contents to save_store --- bin/envstore | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/envstore b/bin/envstore index 0743d78..e314a12 100755 --- a/bin/envstore +++ b/bin/envstore @@ -40,6 +40,11 @@ def save_store(): pickle.dump(store, store_file, protocol=-1) store_file.close() + raw_file = open(raw_filename, 'w') + for item, value in store.iteritems(): + print >> raw_file, "export " + item + "=" + value + raw_file.close() + def get_key(): try: return sys.argv[2] @@ -47,12 +52,6 @@ def get_key(): print >> sys.stderr, "Usage: envstore " + command + " VARIABLE" sys.exit(2) -def save_raw(): - raw_file = open(raw_filename, 'w') - for k, v in store.iteritems(): - print >> raw_file, "export " + k + "=" + v - raw_file.close() - try: command = sys.argv[1] except IndexError: @@ -86,7 +85,6 @@ elif command == "save": store[key] = value save_store() - save_raw() elif command == "rm": key = get_key() @@ -97,7 +95,6 @@ elif command == "rm": sys.exit(4) save_store() - save_raw() elif command == "clear": os.remove(store_filename) os.remove(raw_filename) -- cgit v1.2.3