Cleanup invalid shim metadata with `asdf reshim`
Is your feature request related to a problem? Please describe
In recent versions, some unknown plugin interaction caused certain shim metadata to be corrupted; namely, a ghost .. plugin appeared in these shims, which caused the following warning to appear every time they are run:
$ASDF_DIR/lib/utils.bash: line 234: ASDF_.._VERSION: invalid variable name
See #1029
The current workaround is to delete the offending shims, and calling asdf reshim afterwards. Since the number of shims affected is likely to be unknown, it is often better to call rm $ASDF_DIR/shims/* instead.
Describe the proposed solution
Implement a function cleanup_invalid_shim_metadata, to be called inside reshim_command, to remove invalid metadata from shims (only invalid plugins for now).
Instead of checking for valid characters, I propose that any non-installed plugin be deleted from shim metadata instead, so it catches potential future issues.
Describe similar asdf features and why they are not sufficient
asdf reshim does check for obsolete shims, but only on currently existing plugins.
While this usually is not a problem, if this metadata has invalid values (like the above ..), there can be some unexpected behaviours. Fully cleaning any non-installed plugins means that any non-valid value will be removed, as problematic plugin names would be caught and fixed in other parts of asdf or the plugins themselves.
Describe other workarounds you've considered
The ideal solution would be for these "ghost" shims not to appear in the first place, but I lack the knowledge of bash and asdf needed to find where it originated from. Plus, it might happen again.
An alternate option is not to have this built-in into reshim, but as a separate command. The main reason to do this could be speed concerns, but my local prototype of this feature doesn't increase the execution time noticeably.