summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-07-01 00:59:09 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-07-01 00:59:09 +0200
commit10baf592764a6f8208f9291bd6714fecb2df33cd (patch)
tree37165e7b7484cac164af1c9406fca3c86c833f03 /bin
parent07c4e5bdc67d3e9726eee7db96f79e406ee01832 (diff)
bin/envstore: Add save_raw contents to save_store
Diffstat (limited to 'bin')
-rwxr-xr-xbin/envstore13
1 files changed, 5 insertions, 8 deletions
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)