An exampleâŚ
Say I have a Content Manager
I use the sidebar to execute the command content_mgr_create_my_file
it creates MyFile.txt
but after file creation I need to setup history management
History Management
upon creation of MyFile.txt, I want to create a history folder that will capture the evolution of MyFile.txt
so the first idea was to just call a function in the content_mgr_create_my_file that would create this folder. simple enough⌠def create_history_folder()
But the idea was to keep the logical concerns separate. content manager manages content. history manager manages history.
So, the idea was to keep history functionality out of content creation functionality. Thus, I wanted to create another command history_mgr_create_datastore, which would handle the creation of the datastore folder. I was aiming for separation of concerns and bite-sized reusable commands. commands I could call from other commandsâŚ
so within my content_mgr_create_my_file command I would subsequently call a line of code likeâŚ
result = sublime.active_window().run_command(âhistory_mgr_create_datastoreâ)
THAT command creates my history folder for the content⌠but if something went terribly wrong during folder creation⌠I could try except and catch a failure and return that failure to handle appropriatelyâŚ
Basically I was really hoping for clean organization of separation of concerns.
Hope the example helped. I tried to make it simple.