A more convenient method for controlling the sourcing order of customized scripts. #2182
Replies: 6 comments
-
Couldn't you achieve the same effect by using a naming convention for the custom scripts, with a number prefix, e.g. like this:
The glob that lists the files ( |
Beta Was this translation helpful? Give feedback.
-
The problem is that the scripts to be sourced are symlinks pointing to somewhere outside of the custom folder. And I have already some other naming specifications for these scripts. In this case, I don't want to change the naming spec for these scripts. Any hints? |
Beta Was this translation helpful? Give feedback.
-
Any I have more scripts in the custom folder which maybe startwith alphabets, in this case, they will be sourced after number-beginning ones. Regards |
Beta Was this translation helpful? Give feedback.
-
For your symlinked custom scripts, you could use a different name for the symlink than for the source script in a different location, e.g. like this: ln -s ~/.bash_it/custom/00_aliases.bash ~/foo/bar/aliases.bash This is the way the Bash-it plugins, aliases and completions are enabled and then loaded. I'm not a fan of introducing more complexity in the way these things are handled. Maybe you can look into renaming/linking your custom scripts to work like that. What are your naming standards for the custom scripts? Maybe there's something there to be reused... |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot. This is more graceful then my idea and still can solve my problem. Thanks for you suggestions. I mainly use some code like the following in the script to obtain the script's pyhisical dirname, basename, and so on:
Regards |
Beta Was this translation helpful? Give feedback.
-
If I want to use this spec for the scripts added by me in the system's So, in this case, the above spec may not ensure the sourcing order. Any hints for this case?
|
Beta Was this translation helpful? Give feedback.
-
Hi,
Currently, the sourcing order of the customized scripts are controlled by the following code snippet in https://github.com/Bash-it/bash-it/blob/master/bash_it.sh:
But this is not so convenient if we wan to have more control on the sourcing order of the customized scripts.
So, I suggest the following codes for doing the job instead of the above ones:
Any comments on this idea? If you agree, I will make a PR.
Regards
Beta Was this translation helpful? Give feedback.
All reactions