Giter Club home page Giter Club logo

Comments (3)

HackXIt avatar HackXIt commented on May 11, 2024 1

I've read this a couple of times now trying to find an explanation but to no avail. If the $PROFILE is the one that's being used, this should result in a prompt. Can you check the output of $error?

There indeed is an error coming up, but not one I can figure out:

Usage of C:\Tools\oh-my-posh.exe:
invalid value "-pwd" for flag -error: parse error
    	Override the shell you are working in
  -shell string
    	the path you are working in
  -pwd string
    	Config prints the current settings in json format
  -print-config
    	Error code of previously executed command
  -error int
    	Add the path to a configuration you wish to load
  -config string

To me the -pwd flag looks just fine, it's the same as in the manual and as I stated above.

Using the script you provided works though!

Thanks for the quick reply, sorry for my own late reply.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

I've read this a couple of times now trying to find an explanation but to no avail. If the $PROFILE is the one that's being used, this should result in a prompt. Can you check the output of $error?

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

@HackXIt can you check the new manual installation guide? There was indeed something off, but the new way of creating the prompt works with the following:

[ScriptBlock]$Prompt = {
  $realLASTEXITCODE = $global:LASTEXITCODE
  if ($realLASTEXITCODE -isnot [int]) {
      $realLASTEXITCODE = 0
  }
  $startInfo = New-Object System.Diagnostics.ProcessStartInfo
  $startInfo.FileName = "C:\Tools\oh-my-posh.exe"
  $startInfo.Arguments = "-config C:\Tools\PoshThemes\powerlevel10k_classic.json -pwd $PWD -error $realLASTEXITCODE"
  $startInfo.Environment["TERM"] = "xterm-256color"
  $startInfo.CreateNoWindow = $true
  $startInfo.StandardOutputEncoding = [System.Text.Encoding]::UTF8
  $startInfo.RedirectStandardOutput = $true
  $startInfo.UseShellExecute = $false
  if ($PWD.Provider.Name -eq "FileSystem") {
      $startInfo.WorkingDirectory = $PWD
  }
  $process = New-Object System.Diagnostics.Process
  $process.StartInfo = $startInfo
  Set-PoshContext
  $process.Start() | Out-Null
  $standardOut = $process.StandardOutput.ReadToEnd()
  $process.WaitForExit()
  $standardOut
  $global:LASTEXITCODE = $realLASTEXITCODE
  Remove-Variable realLASTEXITCODE -Confirm:$false
}
Set-Item -Path Function:prompt -Value $Prompt -Force

from oh-my-posh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.