diff options
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') |
