Giter Club home page Giter Club logo

Comments (8)

epogrebnyak avatar epogrebnyak commented on May 29, 2024

Thanks for the feedback and kind words about the program. I knew symlinks would bite at some point of time, but never had real case to test them.

The difference between --correcr and --purge-invalid is that correct also adds --purge-duplicates, but is not intended to add not any special behaviors, but I should check. Maybe when we purge duplicates, we resolve all the link by accident.

I should think of a good testing setup for simlinks and after there is a test it would be easier to add proper behavior

from justpath.

epogrebnyak avatar epogrebnyak commented on May 29, 2024

For my own navigation: Path.is_symlink() this I can use to indicate a directory is symlink.

Can add --resolve or --follow-simlink flag and set it to false as default. When true the program will resolve all paths.

from justpath.

epogrebnyak avatar epogrebnyak commented on May 29, 2024

This is current behavior:

@epogrebnyak ➜ /workspaces/what-the-path (main) $ justpath --duplicates --includes sbin
35 /usr/sbin (duplicates: 2)
37 /sbin (symlink resolves to /usr/sbin, duplicates: 2)

@epogrebnyak ➜ /workspaces/what-the-path (main) $ justpath --correct --includes sbin
24 /usr/local/sbin 
26 /usr/sbin 

from justpath.

epogrebnyak avatar epogrebnyak commented on May 29, 2024

How about this behavoir?

Always indicate a directory is a symlink:

@epogrebnyak ➜ /workspaces/what-the-path (main) $ justpath --includes sbin 
33 /usr/local/sbin 
35 /usr/sbin 
37 /sbin (symlink resolves to /usr/sbin)

When no extra flag do not resolve symlink:

@epogrebnyak ➜ /workspaces/what-the-path (main) $ justpath --duplicates --includes sbin 

with flag do resolve symlinks:

@epogrebnyak ➜ /workspaces/what-the-path (main) $ justpath --duplicates --includes sbin --follow-symlinks 
35 /usr/sbin (duplicates: 2)
37 /sbin (symlink resolves to /usr/sbin, duplicates: 2)

Resolve and purge duplicates:

@epogrebnyak ➜ /workspaces/what-the-path (main) $ justpath --purge-duplicates --includes sbin --follow-symlinks 
33 /usr/local/sbin 
35 /usr/sbin (duplicates: 2)

@epogrebnyak ➜ /workspaces/what-the-path (main) $ justpath --correct  --includes sbin --follow-symlinks 
33 /usr/local/sbin 
35 /usr/sbin (duplicates: 2)

Do not resole and do not purge if no flag:

@epogrebnyak ➜ /workspaces/what-the-path (main) $ justpath --correct  --includes sbin 
33 /usr/local/sbin 
35 /usr/sbin 
37 /sbin (symlink resolves to /usr/sbin)

from justpath.

epogrebnyak avatar epogrebnyak commented on May 29, 2024

You can test the new functionality with pip install justpath==0.0.14

from justpath.

epogrebnyak avatar epogrebnyak commented on May 29, 2024

@vgivanovic do you think I can close the issue now or there is something to be changed?

from justpath.

vgivanovic avatar vgivanovic commented on May 29, 2024

from justpath.

epogrebnyak avatar epogrebnyak commented on May 29, 2024

@vgivanovic - thanks, closing with finalising example from Codespaces

$ justpath --duplicates --follow-symlinks
 1 /usr/local/rvm/gems/ruby-3.2.2/bin (duplicates: 2)
 3 /usr/local/rvm/rubies/ruby-3.2.2/bin (duplicates: 3)
 5 /home/codespace/.local/bin (duplicates: 2)
 6 /home/codespace/.dotnet (resolves to /usr/local/dotnet/7.0.306, duplicates: 2)
 7 /home/codespace/nvm/current/bin (duplicates: 2)
 8 /home/codespace/.php/current/bin (duplicates: 2)
 9 /home/codespace/.python/current/bin (duplicates: 2)
10 /home/codespace/java/current/bin (duplicates: 2)
11 /home/codespace/.ruby/current/bin (duplicates: 3)
12 /home/codespace/.local/bin (duplicates: 2)
13 /usr/local/python/current/bin (duplicates: 2)
19 /usr/local/sdkman/candidates/java/current/bin (duplicates: 2)
23 /usr/local/rvm/gems/default/bin (duplicates: 2)
25 /usr/local/rvm/rubies/default/bin (duplicates: 3)
27 /usr/local/php/current/bin (duplicates: 2)
30 /usr/local/share/nvm/versions/node/v20.11.0/bin (duplicates: 2)
32 /usr/local/dotnet/current (resolves to /usr/local/dotnet/7.0.306, duplicates: 2)
35 /usr/sbin (duplicates: 2)
36 /usr/bin (duplicates: 2)
37 /sbin (resolves to /usr/sbin, duplicates: 2)
38 /bin (resolves to /usr/bin, duplicates: 2)

from justpath.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.