Skip to content

Commit c058174

Browse files
authored
Initial creation of global_vars extension (#137)
1 parent 3ea841a commit c058174

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

global_vars/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Git Resource
2+
3+
Author: [Bob Jackman](https://github.com/kogi)
4+
5+
An extension for reading/writing global variable values
6+
7+
## Usage
8+
9+
```python
10+
set_global('foo', some_value)
11+
print(get_global('foo'))
12+
unset_global('foo')
13+
```

global_vars/Tiltfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def get_global(name):
2+
return os.getenv(_get_env_name(name))
3+
4+
def set_global(name, value):
5+
os.putenv(_get_env_name(name), value)
6+
7+
def unset_global(name):
8+
os.unsetenv(_get_env_name(name))
9+
10+
def _get_env_name(name):
11+
return 'TILT_GLOBAL_VAR_%s' % name.upper()

0 commit comments

Comments
 (0)