JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.01k stars 2.37k forks source link

OMP does not work on clink #2769

Closed Milkman337 closed 2 years ago

Milkman337 commented 2 years ago

Code of Conduct

What happened?

when I try to launch omp on clink this happens:

`-- Helper functions

function get_priority_number(name, default) local value = os.getenv(name) if os.envmap ~= nil and type(os.envmap) == 'table' then local t = os.envmap[name] value = (t ~= nil and type(t) == 'string') and t or value end if type(default) == 'number' then value = tonumber(value) if value == nil then return default else return value end else return default end end

-- Duration functions

local endedit_time = 0 local last_duration = 0 local tip local tooltip_active = false local cached_prompt = {}

local function omp_exe() return '"'..'C:/Users/krise/AppData/Local/Programs/oh-my-posh/bin/oh-my-posh.exe'..'"' end

local function omp_config() return '"'..'C:\Users\krise\AppData\Local\Programs\oh-my-posh\themes\chips.omp.json'..'"' end

os.setenv("POSH_THEME", 'C:\Users\krise\AppData\Local\Programs\oh-my-posh\themes\chips.omp.json')

local function can_async() if (clink.version_encoded or 0) >= 10030001 then return settings.get("prompt.async") end end

local function run_poshcommand(command) command = '"'..command..'"' local ,ismain = coroutine.running() if ismain then output = io.popen(command):read("a") else output = io.popenyield(command):read("a") end return output end

local function os_clock_millis() -- Clink v1.2.30 has a fix for Lua's os.clock() implementation failing after -- the program has been running more than 24 days. In older versions, call -- OMP to get the time in milliseconds. if (clink.version_encoded or 0) >= 10020030 then return math.floor(os.clock() * 1000) else local prompt_exe = string.format('%s get millis', omp_exe()) return run_posh_command(prompt_exe) end end

local function duration_onbeginedit() last_duration = 0 if endedit_time ~= 0 then local beginedit_time = os_clock_millis() local elapsed = beginedit_time - endedit_time if elapsed >= 0 then last_duration = elapsed end end end

local function duration_onendedit(input) endedit_time = 0 -- For an empty command, the execution time should not be evaluated. if string.gsub(input, "^%s(.-)%s$", "%1") ~= "" then endedit_time = os_clock_millis() end end

-- Prompt functions

local function execution_time_option() if last_duration ~= nil then return "--execution-time "..last_duration end return "" end

local function error_level_option() if os.geterrorlevel ~= nil and settings.get("cmd.get_errorlevel") then return "--error "..os.geterrorlevel() end return "" end

local function get_posh_prompt(rprompt) local prompt = "primary" if rprompt then prompt = "right" end local prompt_exe = string.format('%s print %s --shell=cmd --config=%s %s %s', omp_exe(), prompt, omp_config(), execution_time_option(), error_level_option(), rprompt) return run_posh_command(prompt_exe) end

local function set_posh_tooltip(command) if command == nil then return end

-- escape special characters properly, if any
command = string.gsub(command, '(\\+)"', '%1%1"')
command = string.gsub(command, '(\\+)$', '%1%1')
command = string.gsub(command, '"', '\\"')
command = string.gsub(command, '([&<>%(%)@%^|])', '^%1')

local prompt_exe = string.format('%s print tooltip --shell=cmd %s --config=%s --command="%s"', omp_exe(), error_level_option(), omp_config(), command)
local tooltip = run_posh_command(prompt_exe)
if tooltip ~= "" then
    tooltip_active = true
    cached_prompt.right = tooltip
end

end

-- set priority lower than z.lua -- https://github.com/skywind3000/z.lua/pull/125/commits/48a77adf3575952b2e951aa820a1ce11ed4ce56b local zl_prompt_priority = get_priority_number('_ZL_CLINK_PROMPT_PRIORITY', 0) local p = clink.promptfilter(zl_prompt_priority + 1) function p:filter(prompt) if cached_prompt.left and cached_prompt.tip_space then -- Use the cached left prompt when updating the rprompt (tooltip) in -- response to the Spacebar. This allows typing to stay responsive. else -- Generate the left prompt normally. cached_prompt.left = get_posh_prompt(false) end return cached_prompt.left end function p:rightfilter(prompt) if cached_prompt.tip_space and can_async() then -- Generate tooltip asynchronously in response to Spacebar. if cached_prompt.coroutine then -- Coroutine is already in progress. The cached right prompt will -- be used until the coroutine finishes. else -- Create coroutine to generate tooltip rprompt. cached_prompt.coroutine = coroutine.create(function () set_posh_tooltip(tip) cached_prompt.tip_done = true -- Refresh the prompt once the tooltip is generated. clink.refilterprompt() end) end if cached_prompt.tip_done then -- Once the tooltip is ready, clear the Spacebar flag so that if the -- tip changes and the Spacebar is pressed again, we can -- generate a new tooltip. cached_prompt.tip_done = nil cached_prompt.tip_space = nil cached_prompt.coroutine = nil end else -- Tooltip is needed, but not in response to Spacebar, so refresh it -- immediately. set_posh_tooltip(tip) end if not tooltip_active then -- Tooltip is not active, generate rprompt normally. cached_prompt.right = get_posh_prompt(true) end return cached_prompt.right, false end function p:transientfilter(prompt) local prompt_exe = string.format('%s print transient --config=%s %s', omp_exe(), omp_config(), error_level_option()) prompt = run_posh_command(prompt_exe) if prompt == "" then prompt = nil end return prompt end function p:transientrightfilter(prompt) return "", false end

-- Event handlers

local function builtin_modules_onbeginedit() _cached_state = {} duration_onbeginedit() end

local function builtin_modules_onendedit(input) duration_onendedit(input) end

if clink.onbeginedit ~= nil and clink.onendedit ~= nil then clink.onbeginedit(builtin_modules_onbeginedit) clink.onendedit(builtin_modules_onendedit) end

-- Tooltips

function ohmyposh_space(rl_buffer) local new_tip = string.gsub(rl_buffer:getbuffer(), "^%s(.-)%s$", "%1") rl_buffer:insert(" ") if new_tip ~= tip then tip = new_tip -- remember the tip for use when filtering the prompt cached_prompt.tip_space = can_async() clink.refilterprompt() -- invoke the prompt filters so OMP can update the prompt per the tip end end

if rl.setbinding then clink.onbeginedit(function () tip = nil cached_prompt = {} end) rl.setbinding(' ', [["luafunc:ohmyposh_space"]], 'emacs') end`

Theme

chips.omp.json

What OS are you seeing the problem on?

Windows

Which shell are you using?

other (please specify)

Log output

Version: 9.0.0

Segments:

ConsoleTitle(true) -   0 ms - explorer in krise
session(true)  -   0 ms -  krise 
path(true)     -   0 ms -   ~
git(false)     -   5 ms -
root(false)    -   0 ms -
exit(true)     -   0 ms -   
node(false)    -   0 ms -
go(false)      -   0 ms -
python(false)  -   1 ms -
shell(true)    -   1 ms - in explorer
time(true)     -   0 ms - at 10:28:54

Run duration: 291.9465ms

Cache path: C:\Users\krise\AppData\Local\oh-my-posh

Config path: C:\Users\krise\AppData\Local\oh-my-posh\config.omp.json

Logs:

2022/09/11 10:28:54 debug: Getenv
C:\Users\krise\AppData\Local
2022/09/11 10:28:54 Getenv duration: 0s, args: LOCALAPPDATA
2022/09/11 10:28:54 CachePath duration: 0s, args:
2022/09/11 10:28:54 debug: Getenv

2022/09/11 10:28:54 Getenv duration: 0s, args: POSH_THEME
2022/09/11 10:28:54 debug: Getenv
C:\Users\krise\AppData\Local
2022/09/11 10:28:54 Getenv duration: 0s, args: LOCALAPPDATA
2022/09/11 10:28:54 CachePath duration: 523.8µs, args:
2022/09/11 10:28:54 debug: HTTPRequest
GET /JanDeDobbeleer/oh-my-posh/v9.0.0/themes/default.omp.json HTTP/1.1
Host: raw.githubusercontent.com
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip

2022/09/11 10:28:54 debug: HTTPRequest
{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "p:yellow",
          "foreground": "p:black",
          "leading_diamond": "\ue0b6",
          "properties": {
            "display_host": false
          },
          "style": "diamond",
          "template": " {{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }} ",
          "trailing_diamond": "\ue0b0",
          "type": "session"
        },
        {
          "background": "p:orange",
          "foreground": "p:white",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "home_icon": "~",
            "style": "folder"
          },
          "style": "powerline",
          "template": " \uf74a {{ path .Path .Location }} ",
          "type": "path"
        },
        {
          "background": "p:green",
          "background_templates": [
            "{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}",
            "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}",
            "{{ if gt .Ahead 0 }}#49416D{{ end }}",
            "{{ if gt .Behind 0 }}#7A306C{{ end }}"
          ],
          "foreground": "p:black",
          "foreground_templates": [
            "{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}",
            "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}",
            "{{ if gt .Ahead 0 }}p:white{{ end }}"
          ],
          "powerline_symbol": "\ue0b0",
          "properties": {
            "branch_max_length": 25,
            "fetch_status": true,
            "fetch_upstream_icon": true,
            "github_icon": "\uf7a3"
          },
          "style": "powerline",
          "template": " {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }} ",
          "type": "git"
        },
        {
          "background": "p:yellow",
          "foreground": "p:white",
          "powerline_symbol": "\ue0b0",
          "properties": {
            "root_icon": "\uf0ad"
          },
          "style": "powerline",
          "template": " \uf0e7 ",
          "type": "root"
        },
        {
          "background": "p:blue",
          "background_templates": [
            "{{ if gt .Code 0 }}p:red{{ end }}"
          ],
          "foreground": "p:white",
          "leading_diamond": "<transparent,background>\ue0b0</>",
          "properties": {
            "always_enabled": true
          },
          "style": "diamond",
          "template": " {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} ",
          "trailing_diamond": "\ue0b4",
          "type": "exit"
        }
      ],
      "type": "prompt"
    },
    {
      "segments": [
        {
          "background": "transparent",
          "foreground": "p:green",
          "properties": {
            "display_mode": "files",
            "fetch_package_manager": false,
            "home_enabled": false
          },
          "style": "plain",
          "template": "\uf898 ",
          "type": "node"
        },
        {
          "background": "transparent",
          "foreground": "p:blue",
          "properties": {
            "fetch_version": false
          },
          "style": "powerline",
          "template": "\ufcd1 ",
          "type": "go"
        },
        {
          "background": "transparent",
          "foreground": "p:yellow",
          "properties": {
            "display_mode": "files",
            "fetch_version": true,
            "fetch_virtual_env": false
          },
          "style": "plain",
          "template": "\ue235 ",
          "type": "python"
        },
        {
          "background": "transparent",
          "foreground": "p:white",
          "style": "plain",
          "template": "in <p:blue><b>{{ .Name }}</b></> ",
          "type": "shell"
        },
        {
          "background": "transparent",
          "foreground": "p:white",
          "style": "plain",
          "template": "at <p:blue><b>{{ .CurrentDate | date \"15:04:05\" }}</b></>",
          "type": "time"
        }
      ],
      "type": "rprompt"
    }
  ],
  "console_title_template": "{{ .Shell }} in {{ .Folder }}",
  "final_space": true,
  "palette": {
    "black": "#262B44",
    "blue": "#4B95E9",
    "green": "#59C9A5",
    "orange": "#F07623",
    "red": "#D81E5B",
    "white": "#E0DEF4",
    "yellow": "#F3AE35"
  },
  "secondary_prompt": {
    "background": "transparent",
    "foreground": "p:black",
    "template": "<p:yellow,transparent>\ue0b6</><,p:yellow> > </><p:yellow,transparent>\ue0b0</> "
  },
  "tooltips": [
    {
      "background": "p:orange",
      "foreground": "p:white",
      "leading_diamond": "\ue0b6",
      "properties": {
        "display_default": true
      },
      "style": "diamond",
      "template": " \ue7ad {{ .Profile }}{{ if .Region }}@{{ .Region }}{{ end }} ",
      "tips": [
        "aws"
      ],
      "trailing_diamond": "\ue0b4",
      "type": "aws"
    },
    {
      "background": "p:blue",
      "foreground": "p:white",
      "leading_diamond": "\ue0b6",
      "style": "diamond",
      "template": " \ufd03 {{ .Name }} ",
      "tips": [
        "az"
      ],
      "trailing_diamond": "\ue0b4",
      "type": "az"
    }
  ],
  "transient_prompt": {
    "background": "transparent",
    "foreground": "p:black",
    "template": "<p:yellow,transparent>\ue0b6</><,p:yellow> {{ .Folder }} </><p:yellow,transparent>\ue0b0</> "
  },
  "version": 2
}

2022/09/11 10:28:54 HTTPRequest duration: 260.9409ms, args: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v9.0.0/themes/default.omp.json
2022/09/11 10:28:54 downloadConfig duration: 262.1009ms, args: https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v9.0.0/themes/default.omp.json
2022/09/11 10:28:54 Shell duration: 16.6899ms, args:
2022/09/11 10:28:54 resolveConfigPath duration: 278.7908ms, args:
2022/09/11 10:28:54 Init duration: 281.4194ms, args:
2022/09/11 10:28:54 Flags duration: 0s, args:
2022/09/11 10:28:54 config.loadConfig duration: 1.1031ms, args:
2022/09/11 10:28:54 Flags duration: 0s, args:
2022/09/11 10:28:54 debug: Getenv

2022/09/11 10:28:54 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/09/11 10:28:54 WindowsRegistryKeyValue duration: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 debug: WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC42B2B2B
2022/09/11 10:28:54 Root duration: 0s, args:
2022/09/11 10:28:54 Shell duration: 0s, args:
2022/09/11 10:28:54 ErrorCode duration: 0s, args:
2022/09/11 10:28:54 IsWsl duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 debug: User
krise
2022/09/11 10:28:54 User duration: 0s, args:
2022/09/11 10:28:54 debug: Host
DESKTOP-FT7TV7T
2022/09/11 10:28:54 Host duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 Flags duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 debug: Getenv

2022/09/11 10:28:54 Getenv duration: 0s, args: SSH_CONNECTION
2022/09/11 10:28:54 debug: Getenv

2022/09/11 10:28:54 Getenv duration: 0s, args: SSH_CLIENT
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 Shell duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 Flags duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 PathSeparator duration: 0s, args:
2022/09/11 10:28:54 PathSeparator duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 IsWsl duration: 0s, args:
2022/09/11 10:28:54 StackCount duration: 0s, args:
2022/09/11 10:28:54 DirIsWritable duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 Shell duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 debug: CommandPath
C:\Program Files\Git\cmd\git.exe
2022/09/11 10:28:54 CommandPath duration: 5.2706ms, args: git.exe
2022/09/11 10:28:54 HasCommand duration: 5.2706ms, args: git.exe
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/09/11 10:28:54 HasParentFilePath duration: 0s, args: .git
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 Root duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 ErrorCode duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 Shell duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 Flags duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 PathSeparator duration: 0s, args:
2022/09/11 10:28:54 debug: HasFiles
false
2022/09/11 10:28:54 HasFiles duration: 1.0451ms, args: *.py
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 PathSeparator duration: 0s, args:
2022/09/11 10:28:54 debug: HasFiles
false
2022/09/11 10:28:54 HasFiles duration: 520.1µs, args: *.ipynb
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 PathSeparator duration: 0s, args:
2022/09/11 10:28:54 debug: HasFiles
false
2022/09/11 10:28:54 HasFiles duration: 0s, args: pyproject.toml
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 PathSeparator duration: 0s, args:
2022/09/11 10:28:54 debug: HasFiles
false
2022/09/11 10:28:54 HasFiles duration: 0s, args: venv.bak
2022/09/11 10:28:54 debug: HasFolder
false
2022/09/11 10:28:54 HasFolder duration: 0s, args: .venv
2022/09/11 10:28:54 debug: HasFolder
false
2022/09/11 10:28:54 HasFolder duration: 0s, args: venv
2022/09/11 10:28:54 debug: HasFolder
false
2022/09/11 10:28:54 HasFolder duration: 0s, args: virtualenv
2022/09/11 10:28:54 debug: HasFolder
false
2022/09/11 10:28:54 HasFolder duration: 0s, args: env
2022/09/11 10:28:54 debug: HasFolder
false
2022/09/11 10:28:54 HasFolder duration: 0s, args: venv-win
2022/09/11 10:28:54 debug: HasFolder
false
2022/09/11 10:28:54 HasFolder duration: 0s, args: pyenv-win
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 Shell duration: 0s, args:
2022/09/11 10:28:54 Flags duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 Shell duration: 0s, args:
2022/09/11 10:28:54 debug: Pwd
C:\Users\krise
2022/09/11 10:28:54 Pwd duration: 0s, args:
2022/09/11 10:28:54 debug: Home
C:\Users\krise
2022/09/11 10:28:54 GOOS duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 TemplateCache duration: 0s, args:
2022/09/11 10:28:54 Shell duration: 0s, args:
2022/09/11 10:28:54 debug: Getenv
C:\Users\krise\AppData\Local
2022/09/11 10:28:54 Getenv duration: 0s, args: LOCALAPPDATA
2022/09/11 10:28:54 CachePath duration: 527.6µs, args:
2022/09/11 10:28:54 Flags duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@Milkman337 what are you doin to launch it? I get the impression you're initializing straight in CMD and it prints the init script. Did you follow the CMD guide?

Milkman337 commented 2 years ago

you are correct I tried to do it in cmd but I also have that lua script but it doesnt do anything. Im guessing it goes into this folder as this is what the clink info command said: image

That file contains this load(io.popen('oh-my-posh --config="C:\Users\krise\AppData\Local\Programs\oh-my-posh\themes\jandedobbeleer.omp.json" --init --shell cmd'):read("*a"))

JanDeDobbeleer commented 2 years ago

@Milkman337 that's probably not the scripts directory, can you show the output of clink info?

Milkman337 commented 2 years ago

image

JanDeDobbeleer commented 2 years ago

@Milkman337 OK, so you need this directory: C\Users\krise\AppData\Local\clink , add the file there and reload CMD.

Milkman337 commented 2 years ago

that still doesnt work it just goes to this normal terminal image

lewis-yeung commented 2 years ago

That file contains this

load(io.popen('oh-my-posh --config="C:\Users\krise\AppData\Local\Programs\oh-my-posh\themes\jandedobbeleer.omp.json" --init --shell cmd'):read("*a"))

@Milkman337 You should use / instead of \ for a path in Lua like this:

load(io.popen('oh-my-posh init cmd --config="C:/Users/krise/AppData/Local/Programs/oh-my-posh/themes/jandedobbeleer.omp.json"'):read("*a"))()

EDITED: Added the missing parentheses (()) at the end.

Milkman337 commented 2 years ago

still doesnt work

Milkman337 commented 2 years ago

ok so I found out that the correct directory is C:/Program Fules (x86)/clink because if something is wrong with the command it gives the help on starting cmd

Milkman337 commented 2 years ago

I put this in it now: load(io.popen('oh-my-posh.exe --init --shell cmd --config "C:/Users/krise/AppData/Local/Programs/oh-my-posh/themes/jandedobbeleer.omp.json"'):read("*a")) but it still does not work

JanDeDobbeleer commented 2 years ago

@Milkman337 do you have the latest version of clink installed?

Milkman337 commented 2 years ago

yep

JanDeDobbeleer commented 2 years ago

@Milkman337 I can't reproduce this at all. Just set up a new laptop and everything works when following the guide.

lewis-yeung commented 2 years ago

I put this in it now: load(io.popen('oh-my-posh.exe --init --shell cmd --config "C:/Users/krise/AppData/Local/Programs/oh-my-posh/themes/jandedobbeleer.omp.json"'):read("*a")) but it still does not work

@Milkman337 Aha, I know why it didn't work at all. You missed a pair of parentheses (()) at the end. The following must work fine for you:

load(io.popen('oh-my-posh init cmd --config="C:/Users/krise/AppData/Local/Programs/oh-my-posh/themes/jandedobbeleer.omp.json"'):read("*a"))()
JanDeDobbeleer commented 2 years ago

Closing as this isn't an issue with CMD or oh-my-posh. We can continue the conversation if needed.

Yaredseb9 commented 1 year ago

Windows CMD

For cmd, install [clink](https://chrisant996.github.io/clink/ ). Download clink and run the installer. You can verify the installer by running clink info.

Next create a file called oh-my-posh.lua in your clink directory. Note that this directory is given from clink info. The load string below starts OMP - note the theme is specified as well. This section of text can be replaced if you disagree with me on the theme to be used.

notepad AppData\Local\clink\oh-my-posh.lua Finally add this text to the file load(io.popen('oh-my-posh --config="C:/Users/Brent/.oh-my-posh/themes/agnosterplus.omp.json" --init --shell cmd'):read("*a"))()

complete guide Link

JanDeDobbeleer commented 1 year ago

@Yaredseb9 this is an exact copy of our docs, any reason you added this here?

github-actions[bot] commented 11 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.