radian-software / pass-ln

🔑 Pass extension for creating symbolic links.
MIT License
13 stars 2 forks source link

`pass mv` breaks links #3

Open rylancates opened 2 years ago

rylancates commented 2 years ago

When moving an existing entry that has links, links are broken and need to be manually repaired. pass is also not aware of the entries at all

raxod502 commented 2 years ago

Ah. Yes, that would be the case, since it's an inherent property of how symlinks work. pass mv could be adjusted to automatically update links that are pointing at the moved entry, but I suspect it might not be implemented upstream. We can add a pass mvln command in this plugin that would implement the same interface as pass mv but also scan the store for links that might be broken. What do you think of that?

rylancates commented 2 years ago

Ah, yeah I made this comment without having done enough research to know feasibility of plugging into the mv command. mvln would be a solid option IMO

raxod502 commented 2 years ago

Yep - this is the implementation in Pass:

case "$1" in
    init) shift;            cmd_init "$@" ;;
    help|--help) shift;     cmd_usage "$@" ;;
    version|--version) shift;   cmd_version "$@" ;;
    show|ls|list) shift;        cmd_show "$@" ;;
    find|search) shift;     cmd_find "$@" ;;
    grep) shift;            cmd_grep "$@" ;;
    insert|add) shift;      cmd_insert "$@" ;;
    edit) shift;            cmd_edit "$@" ;;
    generate) shift;        cmd_generate "$@" ;;
    delete|rm|remove) shift;    cmd_delete "$@" ;;
    rename|mv) shift;       cmd_copy_move "move" "$@" ;;
    copy|cp) shift;         cmd_copy_move "copy" "$@" ;;
    git) shift;         cmd_git "$@" ;;
    *)              cmd_extension_or_show "$@" ;;
esac
exit 0

So, a plugin can't override a core command (probably a good thing for security).