diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-06-22 21:45:38 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-06-22 21:45:38 +0200 |
commit | bbe5ff9f864e38c3029643cce4d0c8cbefdb504b (patch) | |
tree | 7c0c53e3b09cea45c44ad174e8c6bf38827b4968 /bin | |
parent | 4b5bb0c7142074ecf5633bd3da69419d6e82106e (diff) |
bin/envstore: Added save_raw to be sourced from .zshrc
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/envstore | 9 |
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: |