Jaykul / PowerLine

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

Improve instructions #27

Open MisinformedDNA opened 6 years ago

MisinformedDNA commented 6 years ago

The current instructions do not make it obvious which commands I am supposed to perform vs what's going on in the background.

For instance, am I supposed to add this:

function prompt {
    -join $prompt.Invoke()
}

or

[System.Collections.Generic.List[ScriptBlock]]$Prompt = @(
    { "PS " }
    { $executionContext.SessionState.Path.CurrentLocation }
    { '>' * ($nestedPromptLevel + 1) }
)

or as per Sample.ps1 (which doesn;t run successfully)

$global:PowerLinePrompt = 1,
    # two lines
    @(
        # on the first line, two columns -- the first one is null (empty), the second is right-justified
        $null,
        @(
            @{ text = { New-PowerLineBlock (Get-Elapsed) -ErrorBackgroundColor DarkRed -ErrorForegroundColor White -ForegroundColor Black -BackgroundColor DarkGray } }
            @{ bg = "Gray";     fg = "Black"; text = { Get-Date -f "T" } }
        )
    ),
    (
        @{ bg = "Blue";     fg = "White"; text = { $MyInvocation.HistoryId } },
        @{ bg = "Cyan";     fg = "White"; text = { [PowerLine.Prompt]::Gear * $NestedPromptLevel } },
        @{ bg = "Cyan";     fg = "White"; text = { if($pushd = (Get-Location -Stack).count) { "$([char]187)" + $pushd } } },
        @{ bg = "DarkBlue"; fg = "White"; text = { $pwd.Drive.Name } },
        @{ bg = "DarkBlue"; fg = "White"; text = { Split-Path $pwd -leaf } },
        # This requires my PoshCode/PSGit module and the use of the SamplePSGitConfiguration -- remove the last LeftCap in that.
        @{ bg = "DarkCyan";               text = { Get-GitStatusPowerline } }
    )

It would help a lot if there were some simple tutorials/walkthroughs.

weloytty commented 6 years ago

I can understand how that is confusing, it's the old v2 syntax. I did a PR to update it, hopefully it will give you a better idea of what powerline can do. The pr is https://github.com/Jaykul/PowerLine/pull/28

I used Jaykul's profile at https://github.com/Jaykul/Profile for a lot of help, it can be intimidating though. I keep my profile in github too, so its easy to install on machines I have to use, you can look at https://github.com/weloytty/Profile for the underachiever's version of a profile.

kort3x commented 6 years ago

I second this. The module might be cool and all but the I have no clue how to use it.

Jaykul commented 5 years ago

I'll work on the docs some more...