Jaykul / PowerLine

A more PowerShell prompt
MIT License
567 stars 31 forks source link

another repo #4

Closed czhang03 closed 6 years ago

czhang03 commented 8 years ago

I have seen another repo that is much similar to this repo.

Maybe you guys can discuss how to merge them together, so that we don't rebuild the wheels.

Here is the link to the repo: https://github.com/JanJoris/oh-my-posh

rkeithhill commented 8 years ago

I like @Jaykul handling of prompt, lines and blocks better and I like the module name PowerLine better. But I do like @JanJoris color theming support, Posh-Git support and admin/failed command indicators.

JanDeDobbeleer commented 8 years ago

Thx. oh-my-posh started out as more than just theming. I should rename it to posh-theme or something as it supports a lot more than just powerline styled prompts. You can do whatever with it. I do like this implementation, there's some cool stuff in here.

Jaykul commented 8 years ago

Having used oh-my-zsh, I loved the idea of oh-my-posh, but in both cases, their idea of a "theme" is really just a full-blown custom prompt function ... my goal is something much more modular, so it's easier to share and tweak other people's prompts.

I'm desperate to get rid of this mess I created and avoid creating a new mess.

For what it's worth:

You can already style the PowerLine prompt to not use background colors, and ditch PowerLine separators, so you should be able to build any prompt you like. That is simply not well documented yet.

I'm working on the nested blocks support and a few other pieces like #5 which seem important to finish before writing docs for themeing :stuck_out_tongue_winking_eye:

I would definitely like to collect themes, once I've stopped changing the design.

There are a few more built-in functions necessary. I have included a Get-Elapsed but turning this into a module broke using $? for success, so I need to publish the hack I'm using as Test-Success to show how to change background colors if there's an error (or just output an "x"), and probably need to add a couple others like Test-Elevation ...

I'd be happy to take suggestions and/or pull requests ;-)

rkeithhill commented 8 years ago

+1 for Test-Elevated or something like that. Currently, I use:

$global:Prompt_IsAdmin = (New-Object Security.Principal.WindowsPrincipal ([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)

Also, while I like the idea of smaller, more granular modules, the colors I would use for PowerLine would heavily influenced by the color theme I'm currently running. So if you don't do theming in this module, then perhaps there is some hook/registration between the theming module and this one so when I change color themes, my PowerLine block colors get updated as well.

Jaykul commented 8 years ago

Yeah ... I don't think I know an API for switching the color theme of the console. I mean, I have scripts to change the colors of console window shortcuts, but I don't know how to change it in a running window...

ConEmu, of course, has functionality for themes -- and I'm thinking about sharing my config for that and some of the color-switching scripts that I have (it's not much, but I switch between normal, elevated, and presentation themes).

Jaykul commented 8 years ago

By the way, you can use the slightly shorter string overload:

([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole("Administrators")

And I've been testing using the well-known Administrators SID, it seems to work. Both of these return nothing if you're not elevated:

[Security.Principal.WindowsIdentity]::GetCurrent().Groups -eq "S-1-5-32-544"
[Security.Principal.WindowsIdentity]::GetCurrent().Owner -eq 'S-1-5-32-544'