mfhepp / cdf

cdf: Change to favorite directories in Bash
https://mfhepp.github.io/cdf/
MIT License
1 stars 0 forks source link

Feature: Check if link target is broken #4

Open mfhepp opened 5 months ago

mfhepp commented 5 months ago

The symbolic links will break if the link target has been deleted or moved. It would be good to

  1. warn prior to cdf NAME if the target does not exist
  2. offer a safe mechanism to delete just the symbolic link or move it to a trash, so that people do not need to operate with unconstrained rm :-(
  3. add a warning to --list
  4. maybe add a mechanism to remove all broken symbolic links (output should be a list so that one can recreate them manually).

Caveats and considerations:

  1. Link targets may only be broken temporarily, e.f. for mounted volumes, network drives, ...
  2. What will be more intuite?
    • cdf --remove foo
    • addfav --remove foo
    • Consolidate all under the cdf command, like
      • cdf foo
      • cdf --add foo
      • cdf --list
      • cdf --remove foo
      • cdf --remove --broken

AFAIK, there is no easy way to fix broken symbolic links automatically, as OSX Aliases would do.

mfhepp commented 5 months ago

My current preference is to consolidate everything to cdf [options] [NAME].