diff options
| author | kkard2 <[email protected]> | 2023-07-11 09:10:19 +0200 |
|---|---|---|
| committer | kkard2 <[email protected]> | 2023-07-11 09:10:19 +0200 |
| commit | fa11cfc70e98574930f73884957891db44471af8 (patch) | |
| tree | 6326a609d57dccb6c1b735a23c17912f759f968e /espanso/update_from_assets.py | |
| parent | efa0d2fbaf917bf3cd2efd54166caa56d5fb30dc (diff) | |
| parent | f8d9727953637e992e220c91f0bba3ae78d9a567 (diff) | |
Merge branch 'main' of github.com:kkard2/.dotfiles
Diffstat (limited to 'espanso/update_from_assets.py')
| -rw-r--r-- | espanso/update_from_assets.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/espanso/update_from_assets.py b/espanso/update_from_assets.py new file mode 100644 index 0000000..e2b76d5 --- /dev/null +++ b/espanso/update_from_assets.py @@ -0,0 +1,20 @@ +import os + + +def generate(path, output_file, prefix): + files = [ + f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) + ] + + with open(output_file, 'w') as f: + f.write('matches:\n') + + for file in files: + path_wo_ext = os.path.splitext(file)[0] + f.write(' - trigger: ;;' + prefix + path_wo_ext + '\n') + f.write( + ' image_path: $CONFIG/' + path + '/' + file + '\n') + + +if __name__ == '__main__': + generate('assets/img', 'match/img.yml', 'i') |
