summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-06-22 21:45:38 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-06-22 21:45:38 +0200
commitbbe5ff9f864e38c3029643cce4d0c8cbefdb504b (patch)
tree7c0c53e3b09cea45c44ad174e8c6bf38827b4968 /bin
parent4b5bb0c7142074ecf5633bd3da69419d6e82106e (diff)
bin/envstore: Added save_raw to be sourced from .zshrc
Diffstat (limited to 'bin')
-rwxr-xr-xbin/envstore9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/envstore b/bin/envstore
index 3e3b0f4..5341731 100755
--- a/bin/envstore
+++ b/bin/envstore
@@ -45,12 +45,19 @@ 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:
usage()
store_filename = "/tmp/envstore-" + str(os.getuid())
+raw_filename = "/tmp/envstore-raw-" + str(os.getuid())
try:
store_file = open(store_filename)
@@ -77,6 +84,7 @@ elif command == "save":
store[key] = value
save_store()
+ save_raw()
elif command == "rm":
key = get_key()
@@ -87,6 +95,7 @@ elif command == "rm":
sys.exit(4)
save_store()
+ save_raw()
elif command == "clear":
os.remove(store_filename)
else: