I have a part of my filesystem with many directories that all have child
trees with similar structures. For example:
/home/jaguilar/p4_clients/c1
-- /source
-- /include
/home/jaguilar/p4_clients/c2
-- /source
-- /include
When I'm in c1/source or c2/source in fish, the prompt looks like this:
/h/j/p/c/source jagui...@salem>
>From here it's impossible to tell whether I'm in c1 or c2 without doing pwd.
It is also impossible to tell by doing ls, since the directory structures
below c1 and c2 will be very similar, with only the changes I'm currently
working on but a source tree that is by and large the same.
I was thinking of trying to change Fish to check whether other directories
in your tree can be distinguished from the one you're currently in. I really
like the prompt as it is, but I think that for a use case like mine it might
be useful to have it say something like this:
/h/j/p/c1/source jagui...@salem>
Notice how the ambiguity has been removed.
There are two basic ways I can think of to do this. Both involve walking up
the directory tree in a manner I would probably cache. Walking up from the
deepest level, you look for directories with the same first letter. What you
do with anything you find is how the methods differ.
In the simpler heuristic, you just print the directory name at each level
where there is ambiguity. Unfortunately this might lead to a lot of
unnecessary letters being printed. There are a number of possible
mitigations:
* Only print enough letters to disambiguate.
* Only print if there are a lot of directories at the ambiguous level with
small edit distances (indicating that they might have similar purposes so
that the user would wish to know which specifically they are in).
* Maintain a blacklist of directories to never expand. For example: /usr/*,
/var/*, etc.
The more expensive method I mentioned is to walk into directories with which
the current is ambiguous and see if their structure is similar. At that
point if it is not you could decide not to print, assuming that the user
will know if they are in a directory that has a very different purpose than
the one with the similar name.
Do any of you guys out there think that this is the type of change that
would be likely to be accepted if I write it?
-- James
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users