Comments (8)
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.
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.
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.
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.
You can test the new functionality with pip install justpath==0.0.14
from justpath.
@vgivanovic do you think I can close the issue now or there is something to be changed?
from justpath.
from justpath.
@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)
- deduplicate directories
- Put up a CI pipeline
- `show --json` may deviate from `show` HOT 12
- add `learn` command
- Add PathVar.from_json()
- feature: check if current directory is on the path
- Missing ANSI Escape sequence to reset color after output? HOT 9
- brew installable on macs HOT 3
- shell equivalents for justpath commands HOT 8
- --tui add experimental text user interface HOT 1
- monday thoughts HOT 3
- split --bare into two flags
- Package not found on conda HOT 2
- separate data model from presentation HOT 2
- ~ may not expand properly HOT 10
- add count using symlinks to --count output
- add Limitations section to docs
- --exclude is not used for --count HOT 3
- add badge for Python Bytes podcast HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from justpath.