Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Powershell Hook语句似乎应该放$PROFILE文件入口处 #99

Closed
LordHumphrey opened this issue Mar 12, 2024 · 5 comments
Closed
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@LordHumphrey
Copy link
Contributor

Version
The version you are currently using
VersionFox version 0.2.4
OS
macOS、Linux、Windows
Windows
Question Description
A clear and concise description of what the question is.
如果将Invoke-Expression "$(vfox activate pwsh)"放在$PROFILE最后,将会导致自定义的pwsh其他插件都失效
image

@LordHumphrey LordHumphrey added the question Further information is requested label Mar 12, 2024
@aooohan
Copy link
Member

aooohan commented Mar 12, 2024

应该是把你自定义的prompt函数覆盖了, 包装一下你初始的prompt函数应该就可以.

function prompt {
$export = &"{{.SelfPath}}" env -s pwsh;
if ($export) {
Invoke-Expression -Command $export;
}
return "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";

有兴趣提个pr修改一下吗 😄

@aooohan aooohan added the bug Something isn't working label Mar 12, 2024
@LordHumphrey
Copy link
Contributor Author

应该是把你自定义的prompt函数覆盖了, 包装一下你初始的prompt函数应该就可以.

function prompt {
$export = &"{{.SelfPath}}" env -s pwsh;
if ($export) {
Invoke-Expression -Command $export;
}
return "PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";

有兴趣提个pr修改一下吗 😄

我试试,现在直接设置原prompt,但是无法将>乘以相应的倍数

@aooohan
Copy link
Member

aooohan commented Mar 12, 2024

直接把原来的return删掉,不用管他, 这样试试哈哈哈

$originalPrompt = prompt
function prompt {
    // logic .....
    &$originalPrompt
}

@LordHumphrey
Copy link
Contributor Author

#101 尝试修复了一下,第一次给开源项目提PR,还请您多多赐教

@aooohan
Copy link
Member

aooohan commented Mar 13, 2024

Fixed by #101

@aooohan aooohan closed this as completed Mar 13, 2024
@aooohan aooohan added this to the 0.2.5 milestone Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants