Comments (7)
For some reason Install-Module
and Update-Module
was stuck on 1.0.0
, I used -RequiredVersion 1.1.0
and now it works! My prompt is no longer affected by z
. Thanks!
from zlocation.
That usually indicates there is an error during the prompt command execution.
You can execute run & $Function:prompt
to see the real error, that would help.
from zlocation.
Here's the errors I'm getting :
PS>& $Function:prompt
The property 'ErrorCount' cannot be found on this object. Verify that the property exists and can be set.
At line:4 char:9
+ $sl.ErrorCount = $global:error.Count
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Test-IsVanillaWindow : The term 'Test-IsVanillaWindow' 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:7 char:12
+ if(Test-IsVanillaWindow) {
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Test-IsVanillaWindow:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Reset-CursorPosition : The term 'Reset-CursorPosition' 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:13 char:9
+ Reset-CursorPosition
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Reset-CursorPosition:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Write-Theme : The term 'Write-Theme' 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:14 char:9
+ Write-Theme -lastCommandFailed $lastCommandFailed
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Write-Theme:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
These are related to my custom prompt that uses the oh-my-posh module. It's as if running z
drops that module.
from zlocation.
I think it's likely the same problem as #59 (comment) : oh-my-posh likely calls the private APIs and assumes that prompt is executed in the module scope (which allows to call them without exposing).
from zlocation.
@anthony-brien What do you get from the output of:
Get-Command prompt | % Definition
Also, it sure looks similar to the posh-git issue where we couldn't access internal functions but the change I made fixed that for posh-git without having to make those internal functions public. Hmm...
from zlocation.
I also use posh-git, so it might be the same issue indeed.
When I run Get-Command prompt | % Definition
before invoking z
:
$lastCommandFailed = $global:error.Count -gt $sl.ErrorCount
$sl.ErrorCount = $global:error.Count
#Start the vanilla posh-git when in a vanilla window, else: go nuts
if(Test-IsVanillaWindow) {
Write-Host -Object ($pwd.ProviderPath) -NoNewline
Write-VcsStatus
return '> '
}
Reset-CursorPosition
Write-Theme -lastCommandFailed $lastCommandFailed
return ' '
and after invoking z
:
Update-ZLocation $pwd
$lastCommandFailed = $global:error.Count -gt $sl.ErrorCount
$sl.ErrorCount = $global:error.Count
#Start the vanilla posh-git when in a vanilla window, else: go nuts
if(Test-IsVanillaWindow) {
Write-Host -Object ($pwd.ProviderPath) -NoNewline
Write-VcsStatus
return '> '
}
Reset-CursorPosition
Write-Theme -lastCommandFailed $lastCommandFailed
return ' '
from zlocation.
Hmm, it doesn't look you've upgraded to 1.1.0
. If you had, then your prompt should look like this:
Update-ZLocation $pwd
ZLocationOrigPrompt
Can you Update-Module ZLocation
, reload PowerShell and see how it behaves?
from zlocation.
Related Issues (20)
- It would be great to see a list of most recent HOT 2
- [Feature Request] Allow installation via Chocolatey
- Set-ZLocation and Update-ZLocation break for PS 7 if the user has defined an alias for 'find' HOT 1
- How to exclude a directory from tracking? HOT 1
- Exception calling "Add" with "2" argument(s) - issue after updating powershell to 7.1 HOT 2
- [Feature Request] z partial/path/to/dir? HOT 1
- Doesn't work with posh-git's error reporting (DollarQuestion) HOT 3
- how can I unsinstall it?thanks. HOT 1
- Database has duplicate entries differing in case only
- Cannot z to network drives HOT 1
- Invoke-ZLocation doesn't work with oh-my-posh + posh-git + ZLocation HOT 2
- Question: possible to prefer child directories? HOT 1
- [Feature request] only display directories with tab completion HOT 5
- Duplicate Unc Paths in Database Where Only One Is Updated
- ZLocation not working as intended. HOT 6
- profile file flood
- Can't jump a folder with `[` or `]` in it
- Get-FrequentFolders in ssh session is very slow HOT 3
- Unable to uninstall Zlocation HOT 1
- Path resolution is not picking the best option
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 zlocation.