tkellogg / Jump-Location

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

Allow Exclusion of Dirs #15

Open shanselman opened 10 years ago

shanselman commented 10 years ago

Posh-Git (included with GitHub for Windows) runs as your PS console starts up. As such, directories get in the weighting list that have no business being there. See #2 there.

5.3980429   Microsoft.PowerShell.Core\FileSystem::C:\GitHub
5.6408713   Microsoft.PowerShell.Core\FileSystem::C:\Users\Scott\AppData\Local\GitHub\PoshGit_3874a02de8ce2b7d4908a8c0cb302294358b972c
6.9688345   Microsoft.PowerShell.Core\FileSystem::C:\Users\Scott\AppData\Local\GitHub
1.0781461   Microsoft.PowerShell.Core\FileSystem::C:\
0.7656491   Microsoft.PowerShell.Core\FileSystem::C:\users
14.3377587  Microsoft.PowerShell.Core\FileSystem::C:\users\Scott
6.5595108   Microsoft.PowerShell.Core\FileSystem::C:\users\Scott\Desktop
vors commented 10 years ago

Does check that PS is in an interactive mode will solve it?

shanselman commented 10 years ago

Check $MyInvocation perhaps? http://poshoholic.com/2008/03/18/powershell-deep-dive-using-myinvocation-and-invoke-expression-to-support-dot-sourcing-and-direct-invocation-in-shared-powershell-scripts/

vors commented 10 years ago

I think we can implement it with jumpstat -exclude

Simple implementation: assign Double.MinValue to folder weight. Negative folders should be excluded from results lookup (if they are not already).

I'd like to cover following scenarios:

  1. -exclude .\relative-path
  2. -exclude C:\absolute-path
  3. -exclude -recursive $false // by default we exclude whole subtree of dirs, but we should provide an option to exclude folder without subfolders.
  4. -include // to revert exclude
tkellogg commented 10 years ago

Also, -Exclude with no path to exclude the current directory