Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major refactor of init.lua with **breaking changes** #96

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

MLFlexer
Copy link
Owner

@MLFlexer MLFlexer commented Jan 29, 2025

Moved fuzzy finder into fuzzy_loader.lua, encryption logic into encryption.lua and reading/writing files into file_io.lua and lastly state management into state_manager.lua. This does however come with breaking changes.

BREAKING CHANGES:

Functions

Functions have been placed into other files which changes the scope, as such they will be renamed with the module/scope as prefix:

- resurrect.fuzzy_load(window, pane, callback, opts)
+ resurrect.fuzzy_loader.fuzzy_load(window, pane, callback, opts)

- resurrect.save_state(state)
+ resurrect.state_manager.save_state(state)

- resurrect.load_state(name, type)
+ resurrect.state_manager.load_state(name, type)

- resurrect.delete_state(name)
+ resurrect.state_manager.delete_state(name)

- resurrect.set_encryption(encryption_opts)
+ resurrect.state_manager.set_encryption(encryption_opts)

- resurrect.periodic_save(opts?)
+ resurrect.state_manager.periodic_save(opts?)

- resurrect.resurrect_on_gui_startup()
+ resurrect.state_manager.resurrect_on_gui_startup()

- resurrect.write_current_state(name, type)
+ resurrect.state_manager.write_current_state(name, type)

- resurrect.set_max_nlines(number)
+ resurrect.state_manager.set_max_nlines(number)

- resurrect.change_state_save_dir(string)
+ resurrect.state_manager.change_state_save_dir(string)

Emits

Emitters have also changed scope and have been renamed appropriately

- resurrect.decrypt.finished(file_path)
- resurrect.decrypt.start(file_path)
- resurrect.encrypt.finished(file_path)
- resurrect.encrypt.start(file_path)
- resurrect.sanitize_json.finished(data)
- resurrect.sanitize_json.start(data)
+ resurrect.file_io.decrypt.finished(file_path)
+ resurrect.file_io.decrypt.start(file_path)
+ resurrect.file_io.encrypt.finished(file_path)
+ resurrect.file_io.encrypt.start(file_path)
+ resurrect.file_io.sanitize_json.finished(data)
+ resurrect.file_io.sanitize_json.start(data)

- resurrect.fuzzy_load.finished(window, pane)
- resurrect.fuzzy_load.start(window, pane)
+ resurrect.fuzzy_loader.fuzzy_load.finished(window, pane)
+ resurrect.fuzzy_loader.fuzzy_load.start(window, pane)

- resurrect.delete_state.finished(file_path)
- resurrect.delete_state.start(file_path)
- resurrect.load_state.finished(name, type)
- resurrect.load_state.start(name, type)
- resurrect.periodic_save(opts)
- resurrect.save_state.finished(file_path, event_type)
- resurrect.save_state.start(file_path, event_type)
+ resurrect.state_manager.delete_state.finished(file_path)
+ resurrect.state_manager.delete_state.start(file_path)
+ resurrect.state_manager.load_state.finished(name, type)
+ resurrect.state_manager.load_state.start(name, type)
+ resurrect.state_manager.periodic_save(opts)
+ resurrect.state_manager.save_state.finished(file_path, event_type)
+ resurrect.state_manager.save_state.start(file_path, event_type)

To fix config on linux, you can run the following in your wezterm config directory:

find ./ -type f -exec sed -i 's/resurrect.fuzzy_load/resurrect.fuzzy_loader.fuzzy_load/g' {} +
find ./ -type f -exec sed -i 's/resurrect.start/resurrect.fuzzy_loader.start/g' {} +
find ./ -type f -exec sed -i 's/resurrect.finished/resurrect.fuzzy_loader.finished/g' {} +
find ./ -type f -exec sed -i 's/resurrect.delete_state/resurrect.state_manager.delete_state/g' {} +
find ./ -type f -exec sed -i 's/resurrect.set_max_nlines/resurrect.state_manager.set_max_nlines/g' {} +
find ./ -type f -exec sed -i 's/resurrect.change_state_save_dir/resurrect.state_manager.change_state_save_dir/g' {} +
find ./ -type f -exec sed -i 's/resurrect.decrypt.finished/resurrect.file_io.decrypt.finished/g' {} +
find ./ -type f -exec sed -i 's/resurrect.decrypt.start/resurrect.file_io.decrypt.start/g' {} +
find ./ -type f -exec sed -i 's/resurrect.encrypt.finished/resurrect.file_io.encrypt.finished/g' {} +
find ./ -type f -exec sed -i 's/resurrect.encrypt.start/resurrect.file_io.encrypt.start/g' {} +
find ./ -type f -exec sed -i 's/resurrect.sanitize_json.finished/resurrect.file_io.sanitize_json.finished/g' {} +
find ./ -type f -exec sed -i 's/resurrect.sanitize_json.start/resurrect.file_io.sanitize_json.start/g' {} +
find ./ -type f -exec sed -i 's/resurrect.fuzzy_load.finished/resurrect.fuzzy_loader.fuzzy_load.finished/g' {} +
find ./ -type f -exec sed -i 's/resurrect.fuzzy_load.start/resurrect.fuzzy_loader.fuzzy_load.start/g' {} +
find ./ -type f -exec sed -i 's/resurrect.load_state/resurrect.state_manager.load_state/g' {} +
find ./ -type f -exec sed -i 's/resurrect.periodic_save/resurrect.state_manager.periodic_save/g' {} +
find ./ -type f -exec sed -i 's/resurrect.set_encryption/resurrect.state_manager.set_encryption/g' {} +
find ./ -type f -exec sed -i 's/resurrect.resurrect_on_gui_startup/resurrect.state_manager.resurrect_on_gui_startup/g' {} +
find ./ -type f -exec sed -i 's/resurrect.save_state/resurrect.state_manager.save_state/g' {} +
find ./ -type f -exec sed -i 's/resurrect.write_current_state/resurrect.state_manager.write_current_state/g' {} +

@MLFlexer MLFlexer linked an issue Jan 29, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor init.lua
1 participant