tkellogg / jump-location Goto Github PK
View Code? Open in Web Editor NEWPowershell `cd` that reads your mind
License: MIT License
Powershell `cd` that reads your mind
License: MIT License
I get following error
PS C:\Users\Tommi\Documents> jumpstat
Weight Path
45,3596790 C:\Windows\system32
9,9991467 C:\Users\Tommi
9,3245267 C:
8,8766668 C:\Users\Tommi\Documents\Visual Studio 2013\Projects
8,3064595 C:\Users
5,7843662 C:\Users\Tommi\Documents
1,636198 C:\Users\Tommi\Documents\Visual Studio 2013
PS C:\Users\Tommi\Documents> j Projects
j : A positional parameter cannot be found that accepts argument 'C:\Users\Tommi\Documents\Visual'.
At line:1 char:1
- CategoryInfo : InvalidArgument: (:) [Jump-Location], ParameterBindingException
- FullyQualifiedErrorId : PositionalParameterNotFound,Jump.Location.JumpLocationCommand
Thank you for nice tool, but
C:\Program Files (x86)\IIS Express
this path throw exception -
Version 0.6
Thanks for the great tool! How to fix TypeInitializationException ?
~ $
install-module jump.location
~ $
refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
~ $
import-module jump.location
Set-JumpLocation : The type initializer for 'Jump.Location.SetJumpLocationCommand' threw an exception.
At C:\Program Files\WindowsPowerShell\Modules\jump.location\0.6.0\Load.ps1:36 char:2
+ Set-JumpLocation -Initialize
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], TypeInitializationException
+ FullyQualifiedErrorId : System.TypeInitializationException
~ $
Can it get into http://psget.net/ so it'd be easier to install?
PSVersion : 4.0
Jump.Location : 0.6.0
Set-JumpLocation : The type initializer for 'Jump.Location.SetJumpLocationCommand' threw an exception.
I installed via:
install-module Jump.Location
What have I done wrong?
Thanks --
PSReadLine use worker thread to capture user input. That prevents generation of OnIdle events, because engine is never OnIdle.
Jump-Location subscribe UpdateTime callback to OnIdle events.
Maybe this should be addressed in PSReadLine.
Jump-Location seems to be having problems with PowerShell 5 Production Preview. It is, in some cases, unable to jump given just a number.
PS> mkdir 7\test
PS> cd 7\test
PS> cd ..\..
PS> jumpstat
Weight Path
------ ----
57,1669311 C:\temp
9,3428682 C:\temp\7\test
PS> j 7
j : Could not find find a suitable match for search query '7' in database
At line:1 char:1
+ j 7
+ ~~~
+ CategoryInfo : NotSpecified: (:) [Set-JumpLocation], LocationNotFoundException
+ FullyQualifiedErrorId : Jump.Location.LocationNotFoundException,Jump.Location.SetJumpLocationCommand
It does work again if the folder with the number is in the jumpstats
PS> cd 7
PS> cd ..
PS> jumpstat
Weight Path
------ ----
57,1669311 C:\temp
9,3428682 C:\temp\7\test
1,5918183 C:\temp\7
PS> j 7
I feel that closeness of destination is more impotent then time spend in directory.
Scenario:
I have work under
e:\branch1\source\foo
e:\branch1\source\bar [Big weight]
Now I'm under
e:\branch2\source\foo
and I also have
e:\branch2\source\bar in db
After execute
'j foo' I expect go to e:\branch2\source\bar, not to e:\branch1\source\bar
I should add test for this scenario.
Consider, replace time spended in dir by more sophisticated algorithm: like one that have sublime-text-2 Ctrl+P function.
I have 2 folders C:\Mercurial\Foo
and C:\Mercurial\Foo.Bar
in my jumplist. I am unable to properly jump to the first as everything points to the second. This may be because the second has a higher weight, but I shouldn't have to keep modifying the first ones weight to be higher. How can I jump to C:\Mercurial\Foo
?
Jump commands that I have tried to reach first folder:
j f
j m f
j m fo
What's the rationale for printing the [Jump-location] Database contains XX records
message to stdout when you load the module? I think if the user wants this information they should query for it.
I am running Windows7 but have Powershell version 3 so figured I could get this to work.
When installing via Install-Module, I get the following.
Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.
PS C:\Users\admin> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
3 0 -1 -1
PS C:\Users\admin> Install-Module Jump.Location
PS C:\Users\admin> j
j : The term 'Set-JumpLocation' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ j
+ ~
+ CategoryInfo : ObjectNotFound: (Set-JumpLocation:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
so I tried installing via chocolatey
PS C:\Users\admin> C:\ProgramData\chocolatey\bin\choco install jump-location
Chocolatey v0.10.8
Installing the following packages:
jump-location
By installing you accept licenses for the packages.
Progress: Downloading Jump-Location 0.6.0... 100%
Jump-Location v0.6.0 - Possibly broken
jump-location package files install completed. Performing other installation steps.
The package Jump-Location wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[N]o/[P]rint): Y
Extracting C:\Users\admin\AppData\Local\Temp\chocolatey\Jump-Location\0.6.0\Jump-Location-0.6.0.zip to C:\ProgramData\chocolatey\lib\Jump-Location\tools...
C:\ProgramData\chocolatey\lib\Jump-Location\tools
ERROR: Cannot bind argument to parameter 'Path' because it is an empty string.
The install of jump-location was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\Jump-Location\tools\chocolateyInstall.ps1'.
See log for details.
Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
- jump-location (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\Jump-Location\tools\chocolateyInstall.ps1'.
See log for details.
The patient appears to be more dead than alive.
For my needs the following function placed in the PowerShell profile script is enough:
function j {
Param(
[Parameter(Mandatory=$true, Position=0)][string]$locationName
)
$locations = @{
"one" = "C:\path\to\location-one"
"two" = "C:\path\to\location-two"
"three" = "C:\path\to\location-three"
}
if ($locations.ContainsKey($locationName))
{
Set-Location $locations.$locationName
}
else
{
Write-Host -ForegroundColor Red "Unknown location: $locationName"
}
}
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.
Please consider using an approved verb so we don't have to suffer the module system's warnings. Jump is fine for an alias, but it's not just about that. The verb/noun system breaks down if we don't stay consistent. Yes, strictly speaking "jump" makes more sense to you, but those of us who are using powershell for many years prefer standard verbs and won't go looking for jump. Plus, it makes me itch in an unscratchable place in my brain when I see non-standard verbs.
Suggestions:
Thanks,
Oisin (PowerShell MVP)
I got error message when dealing with directories with space in their names. For example, "C:\Users\xxx\Documents\Visual Studio 2013". The error message: "j : A positional parameter cannot be found that accepts argument 'C:\Users\xxx\Documents\Visual'."
I followed the directions on Github but when I open a new window I get the following error:
Import-Module : Could not load file or assembly
'file:///D:\Downloads\Jump-Location-0.5.1\Jump.Location.dll' or one of its
dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At D:\Downloads\Jump-Location-0.5.1\Load.ps1:14 char:2
+ Import-Module $dllpath -Global -DisableNameChecking
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileLoadExcep
tion
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell
.Commands.ImportModuleCommand
The Downloads folder is not the one that comes out of the box (User specific) but something I created.
Thanks.
I was running an Entity Framework helper command to run all code-first migrations on the database when this happened:
PM> update-database
System.ArgumentNullException: Value cannot be null.
Parameter name: type
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project, Int32 shellVersion)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebSiteProject(Project project)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(Project project)
at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Value cannot be null.
Parameter name: type
I only get this error when I start Visual Studio 2015 and import the Jump.Location
module, removing the import from my profile.ps1
and restarting Visual Studio will fix it.
Preferably this error is fixed, but if it's hard then I would be content with at least a warning that you should only import it in the default console version or ISE.
A bunch of windows programs (and folders) that I navigate to include spaces in their names, which instantly results in Jump-Location failing. Usually with a message like:
Jump-Location : A positional parameter cannot be found that accepts argument
'C:\ProgramData\Microsoft\Windows\Start'.
At line:1 char:1
+ Jump-Location start
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Jump-Location], ParameterBind
ingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Jump.Location.JumpLocat
ionCommand
I'm assuming here that the only way a directory can get a negative weight is by manually editing it, as stated in the wiki. Please tell me if I'm wrong.
Related to #15, the way I'm excluding the poshgit directory is by assigning it a negative weight. I find this absolutely acceptable, more than the plugin trying to guess that I didn't want it to begin with. The problem is that every time I open the shell, the directory gets reevaluated and back in the list. I think if I assigned a negative weight (if that's the only way to get a negative weight) it implies I don't ever want to jump to that folder. It should be kept forever negative, never readded.
I lose history of locations twice (about once a week). I don't have repro. I even haven't close powershell last time I guess. It's very frustrate.
In powershell_ise open another tab cause in lose ability to keep track of you current directory on all tabs.
Repro:
Now it impossible to 'j long', since invalid path is top choice.
When you call 'man j' and 'man jumpstat' your should get help about usage.
Help should include scenarios:
Repro:
Supossed solution:
Escape with single quotes instead of double quotes.
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
The Job that updates time failed and cannot continue, so statistic is not updates anymore.
Exception calling "UpdateTime" with "1" argument(s): "You can't call CloseAndUpdate multiple times"
I'm getting this error after installing Jump-Location:
Set-JumpLocation : The type initializer for 'Jump.Location.SetJumpLocationCommand'
threw an exception.
At C:\Users\mitja.bezensek\Documents\WindowsPowerShell\Modules\Jump.Location\Load.ps1:
36 char:2
+ Set-JumpLocation -Initialize
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], TypeInitializationException
+ FullyQualifiedErrorId : System.TypeInitializationException
I have tried the two suggestions for errors after install but none of those worked for me.
Not sure if it is related but I had Jump-Location installed via chocolatey (v0.5.1) which I uninstalled and then installed the new version (v0.6.0) via the Install-Module.
I have paths like C:\Code\New-Machine
. When I think about this as a jump location, I think "nm", however the path segment approach only sees it registered as "ne" at best.
If I was to take a crack at this, is Record.GetPathSegments
the likely place to start?
I have been using Jump-Location for quite some time now. Today I suddenly started having a problem when opening a powershell window. I'm getting the following error:
Set-JumpLocation : The term 'Set-JumpLocation' is not recognized as the name of a cmdlet, function, script file, or operabl e program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\mitja.bezensek\Documents\WindowsPowerShell\Modules\Jump.Location\Load.ps1:36 char:2
Set-JumpLocation -Initialize
~~~~~~~~~~~~~~~~
- CategoryInfo : ObjectNotFound: (Set-JumpLocation:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
I've reinstalled Jump-Location but the error persists. Any clue what is going on?
Just downloaded this module and happily installed it. But when I want to j
to somewhere, it complains:
j : The term 'Set-JumpLocation' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ j cn
+ ~
+ CategoryInfo : ObjectNotFound: (Set-JumpLocation:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
My powershell version is Core 6.0.1
, I also tried on my native PowerShell, it works well.
After installing Jump.Location (which is neat btw) autocompletion stops working with PoshGit.
If I dont load Jump.Location, autocompletion works again.
If I install jump-location after poshgit, tab key is not working for poshgit.
solvable by changing Powershell_profile.ps1 manually
# Load Jump-Location profile
Import-Module 'C:\Chocolatey\lib\Jump-Location.0.5.1\tools\Jump.Location.psd1'
# Load posh-git example profile
. 'C:\tools\poshgit\dahlbyk-posh-git-95df787\profile.example.ps1'
When typing 'j c' I get the following error:
PS>j c
j : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- CategoryInfo : ObjectNotFound: (x86:String) [Jump-Location], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException,Jump.Location.JumpLocationCommand
unziped => unlocked => installed => after run PS got that:
Import-Module : The 'C:\Users\ME\Documents\Jump-Location-0.5.1\Jump.Location.psd1' module cannot be imported because its manifest contains one or more members that are not valid. The valid manifest members are ('ModuleToProcess', 'NestedModules', 'GUID', 'Author', 'CompanyName', 'Copyright', 'ModuleVersion', 'Description', 'PowerShellVersion', 'PowerShellHostName', 'PowerShellHostVersion', 'CLRVersion', 'DotNetFrameworkVersion', 'ProcessorArchitecture', 'RequiredModules', 'TypesToProcess', 'FormatsToProcess', 'ScriptsToProcess', 'PrivateData', 'RequiredAssemblies', 'ModuleList', 'FileList', 'FunctionsToExport', 'VariablesToExport', 'AliasesToExport', 'CmdletsToExport'). Remove the members that arenot valid ('RootModule'), then try to import the module again.
At C:\Users\ME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:2 char:14
repro:
[assume you have e:\foo\source in db]
j foo source+ => j foo e:\foo\source+
actual:
j : Could not find find a suitable match for search term fnd in database
At line:1 char:1
expected:
work same as just
j foo source+ (cd to e:\foo\source)
Benchmark: http://www.leeholmes.com/blog/2005/12/18/burn-console-optimized-and-ready-for-marshmallows/
Drops from 54 fps to 10 fps
This most likely totally related to using break-point on $pwd for tracking directory changes. We need to find a better way to achieve same thing.
Call to jumpstat should not output anything to console by default.
Consider replace by -Verbose output
Here is sample, where I call jumpstat from $profile to display statistic:
"Number of records: 132" is pretty confusing message, when you don't call jumpstat from interactive session.
cc @LCHarold
repro:
[assume you have 'e:\foo\source', 'e:\bar\source' in db]
j foo source + Tab => j foo e:\foo\source + Tab => j foo e:\bar\source
actual:
both paths appear in auto-complete
expected:
only path that includes 'foo' appear in auto-complete
remark:
same for intellisense in powershell_ise 3.0
repro:
expected:
change directory to C:\AAAAA_2
actual:
directory is not changed, no error message
Is there a chance you could add functionality that would allow a complete replacement of the cd
command, e.g. so I could also jump to local folders and j
would include local folders in the mix with some priorities? The priorities could be defined by a user-defined option:
-1
to ignore local folders completely for people who for some reason differentiate between cd
local folders and j
outside folderscd
command into something quite smart and useful.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.