powershell Powersehll简介

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell Powersehll简介相关的知识,希望对你有一定的参考价值。

Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)

# Load posh-git module from current default module locaiton
Import-Module posh-git


# Set up a simple prompt, adding the git prompt parts inside git repos
function global:prompt {
    $realLASTEXITCODE = $LASTEXITCODE

    # Reset color, which can be messed up by Enable-GitColors
    $Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor

    Write-Host($pwd.ProviderPath) -nonewline

    Write-VcsStatus

    $global:LASTEXITCODE = $realLASTEXITCODE
    return "> "
}

function gh{
	
	$url = & git config --get remote.origin.url
    $url = $url.TrimEnd(".git")
    $branch = & git symbolic-ref HEAD 
    Write-Host "On Branch" $branch
    $branch = $branch.Substring(11,($branch.length-11))
    Write-Host $branch
    $url = $url.ToString() + "/tree/" + $branch.ToString()
	
    Write-Host "Opening" $url
    
    [System.Diagnostics.Process]::Start($url)
    return
}

function gh-pull{
	
	$url = & git config --get remote.origin.url
    $url = $url.TrimEnd(".git")
    $url = $url.ToString() + "/pulls"
	
    Write-Host "Opening" $url
    
    [System.Diagnostics.Process]::Start($url)
    return
}

Enable-GitColors

Pop-Location

Start-SshAgent -Quiet

以上是关于powershell Powersehll简介的主要内容,如果未能解决你的问题,请参考以下文章

2017-10-26

Powershell简介

powershell Powershell简介

MSSQL/WMI/PowerShell结合篇简介

powershell 基础

Powershell简介及其编程访问