CodelyTV / dotly

🌚 Modular and easy to customize dotfiles framework
https://codely.com/cursos
MIT License
1.2k stars 116 forks source link

Override a script provided by dotly with a customized version #238

Open fragonib opened 1 year ago

fragonib commented 1 year ago

Hi! 👋

Thank you for this effort. I think is great!

I'm trying to write a customized version of a dotly provided script using a dotfiles' script replacement that has the very same script name. I want this new version to override the one provided by dotly framework. However bin/dot command always selects the dotly version first.

It doesn't works like that because bin/dot command is pritoritizing $DOTLY_PATH over $DOTFILES_PATH (last present script file wins)

https://github.com/CodelyTV/dotly/blob/ec4be28336a1793e633f43f7a35ab5e222b17ee2/bin/dot#L48

  script_exist "$DOTFILES_PATH" "$context" "$script" && script_path="$DOTFILES_PATH"
  script_exist "$DOTLY_PATH" "$context" "$script" && script_path="$DOTLY_PATH"
  script_exist "$DOTLY_PATH" "$context" "$script" && script_path="$DOTLY_PATH"
  script_exist "$DOTFILES_PATH" "$context" "$script" && script_path="$DOTFILES_PATH"
gtrabanco commented 1 year ago

This is done in my fork, you can see how to do it here: https://github.com/gtrabanco/dotSloth/blob/961d348011957b339d1b9b49a87b89cb5bcb9606/bin/dot#L152

Important if you decide to use my fork! It also changes the way scripts are loaded to avoid load all libraries again it can have different features than Dotly and some scripts can not work.

fragonib commented 1 year ago

Thank you @gtrabanco

I'll have a look at it. How hard do you think the migration is?

gtrabanco commented 1 year ago

Should not be so difficult depending on how many stuff do you have, you can copy your .dotfiles and use the migration script I did and see what will happen 🤣