dotly icon indicating copy to clipboard operation
dotly copied to clipboard

Override a script provided by dotly with a customized version

Open fragonib opened this issue 1 year ago • 3 comments

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"
  • Is this by design?
  • Is it reasonable for you to swap the folder priority?
  script_exist "$DOTLY_PATH" "$context" "$script" && script_path="$DOTLY_PATH"
  script_exist "$DOTFILES_PATH" "$context" "$script" && script_path="$DOTFILES_PATH"

fragonib avatar Jun 04 '23 16:06 fragonib

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.

gtrabanco avatar Jun 04 '23 20:06 gtrabanco

Thank you @gtrabanco

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

fragonib avatar Jun 05 '23 09:06 fragonib

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 🤣

gtrabanco avatar Jun 05 '23 10:06 gtrabanco