tkellogg / Jump-Location

Powershell `cd` that reads your mind
MIT License
467 stars 26 forks source link

Add "jumpstat -scan path" to recursively populate subfolders to DB with 0 weight #22

Closed joj closed 9 years ago

joj commented 9 years ago

Obviously a request and not a bug :) I have a very complex project structure and I'm usually going around in the console just to look at files. It could be awesome if I could "j [somepartofthesubfoldername]" and that will go directly to the first subfolder it finds. "j x" already goes back for me (the main folder starts with x), so that works great.

vors commented 9 years ago

@joj I think these two intentions (go to sub-folder in the folder and Jump-Location scenario) are different. So it make sense to have a separate command for it, to keep behavior of 'j' straightforward. Now you can type "cd *x + TAB" and get described behavior.

joj commented 9 years ago

Absolutely agreed. Closing. It's just that I wish I could use j always, and it feels like I need to manually cd to any directory that I will go to with j later, and that feels like a lot of ramp up.

chinhdo commented 9 years ago

I am thinking of adding an auto-discovery option where it will automatically scan and add immediate ancestors as well as child folders of the target folder into the list of known folders. The auto-discovered folders would initially have jumpstat of 0. To prevent taking up too much time scanning large directories, the scanning can be limited to only scanning the first x sub-folders.

Another way to is provide an alternate way to teach it about folders without actually going to each one. Perhaps an optional parameter "scan" to scan the folder recursively.

Or, just manually edit Jump-Location.txt stats file yourself. For example, to teach Jump-Location about all sub-folders under c:\Code recursively, just run this:

Get-ChildItem c:\Code -Recurse | ?{ $.PSIsContainer } | % {"0`tMicrosoft.PowerShell.Core\FileSystem::$($.FullName)"} | Out-file -append -encoding ASCII ~/jump-location.txt

vors commented 9 years ago

That's an interesting scenario. There is jumpstat command, which currently can 1) list statistic from file 2) clean up, removing non-existing folders (after rename, move)

I think that it's appropriate to add 3) scan sub-folders and add them to file

joj commented 9 years ago

jumpstat will perfectly solve my scenario, even automating it "manually" by going directly to the data file.

vors commented 9 years ago

Renamed and reopen.

chinhdo commented 9 years ago

I can work on jumpstat -scan if someone wants to assign this to me.

vors commented 9 years ago

For some reason github doesn't allow me assign it to you: image Try subscribe to notifications for this issue, if you are not.

vors commented 9 years ago

Another possibility is @tkellogg didn't grant me control over that :)

chinhdo commented 9 years ago

Thanks vors. I already subscribed to this issue. Hi @tkellogg: Please let us know.

tkellogg commented 9 years ago

@chinhdo Thanks for pointing this out. I made you a collaborator so you can have issues assigned to you. Naturally, this one is assigned to you now :)

chinhdo commented 9 years ago

Cool, thanks @tkellogg .

chinhdo commented 9 years ago

This has been added in Pull Request https://github.com/tkellogg/Jump-Location/pull/25

vors commented 9 years ago

@chinhdo implementation of -scan add all subfolders of already visited locations. Since, C:\, D:\ and so on are most likely already added to db, running 'jumpstat -scan' equals to adding all your files to db.

When formulate requirements, I didn't share my vision of desired behavior, sorry. But I'd like to do it now: jumpstat -scan path // add all subfolders of path with 0 weight

You will still be able to add everything, calling -scan on your top level drive letters. But respecting the path parameter gives users much better flexibility in their scenarios.

vors commented 9 years ago

46