Adding support for Solarized colors; use dark palette
This commit is contained in:
parent
3af6307831
commit
17c5fcadef
2 changed files with 204 additions and 103 deletions
|
|
@ -1,3 +1,9 @@
|
|||
# Load up the colors and set the dark solarized theme.
|
||||
#
|
||||
$profileDir = split-path -parent $Profile
|
||||
Import-Module "$profileDir\Modules\ConsoleColors.psm1"
|
||||
Set-SolarizedColors -Dark
|
||||
|
||||
# These bits of profile courtesy of http://winterdom.com/
|
||||
#
|
||||
# http://winterdom.com/2008/01/modifyingthehomeinpowershell
|
||||
|
|
@ -21,9 +27,11 @@ function shorten-path([string] $path)
|
|||
|
||||
function prompt
|
||||
{
|
||||
# our theme
|
||||
$ok = $?
|
||||
|
||||
# Our "theme", as it were. Note that we assume the use of the
|
||||
# solarized colors.
|
||||
#
|
||||
$cdelim = [ConsoleColor]::DarkCyan
|
||||
$chost = [ConsoleColor]::Green
|
||||
$cloc = $csym = [ConsoleColor]::Cyan
|
||||
|
|
@ -37,105 +45,3 @@ function prompt
|
|||
|
||||
return ' '
|
||||
}
|
||||
|
||||
function Get-TfsWorkspace(
|
||||
[string] $path = "."
|
||||
)
|
||||
{
|
||||
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
|
||||
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.VersionControl.Client")
|
||||
|
||||
function InitServerAndWorkspaceFromWSInfo($wsInfo)
|
||||
{
|
||||
$tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($wsInfo.ServerUri.AbsoluteUri)
|
||||
$vcs = $tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
|
||||
return $vcs.GetWorkspace($wsInfo)
|
||||
}
|
||||
|
||||
# is there only 1 workspace in our cache file? If so, use that one regardless of the hint
|
||||
$workspaceInfos = [Microsoft.TeamFoundation.VersionControl.Client.Workstation]::Current.GetAllLocalWorkspaceInfo()
|
||||
if ($workspaceInfos.Length -eq 1)
|
||||
{
|
||||
return InitServerAndWorkspaceFromWSInfo($workspaceInfos[0])
|
||||
}
|
||||
|
||||
$workspaceInfos = [Microsoft.TeamFoundation.VersionControl.Client.Workstation]::Current.GetLocalWorkspaceInfoRecursively($path)
|
||||
if ($workspaceInfos.Length -gt 1)
|
||||
{
|
||||
throw 'More than one workspace matches the workspace hint "{0}": {1}' -f
|
||||
$path, [string]::join(', ', @($workspaceInfos | %{ $_.Name}))
|
||||
}
|
||||
elseif ($workspaceInfos.Length -eq 1)
|
||||
{
|
||||
return InitServerAndWorkspaceFromWSInfo($workspaceInfos[0])
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "Could not figure out a workspace based on $path"
|
||||
}
|
||||
}
|
||||
|
||||
function Get-TfsHistory(
|
||||
[string] $path,
|
||||
[switch] $raw
|
||||
)
|
||||
{
|
||||
$workspace = Get-TfsWorkspace $path
|
||||
$vcs = $workspace.VersionControlServer
|
||||
$serverPath = $workspace.GetServerItemForLocalItem($path)
|
||||
|
||||
$changes = $vcs.QueryHistory($serverPath, [Microsoft.TeamFoundation.VersionControl.Client.VersionSpec]::Latest, 0, [Microsoft.TeamFoundation.VersionControl.Client.RecursionType]::None, $null, $null, $null, 100, $false, $false)
|
||||
if ($raw)
|
||||
{
|
||||
foreach($cs in $changes)
|
||||
{
|
||||
$cs
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($cs in $changes)
|
||||
{
|
||||
new-object PSObject -Property @{
|
||||
Uri = $cs.ArtifactUri;
|
||||
Comment = $cs.Comment;
|
||||
Committer = $cs.Committer;
|
||||
Owner = $cs.Owner;
|
||||
Date = $cs.CreationDate;
|
||||
Id = $cs.ChangesetId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get-directoryOfFileAbove($file, $start = $null)
|
||||
{
|
||||
if (-not $start)
|
||||
{
|
||||
$start = resolve-path "."
|
||||
}
|
||||
|
||||
while(($start) -and (-not (test-path "$start\$file")))
|
||||
{
|
||||
$start = split-path -Parent $start
|
||||
}
|
||||
return $start
|
||||
}
|
||||
|
||||
function die($message)
|
||||
{
|
||||
write-host -Foreground "Red" $message
|
||||
exit 1
|
||||
}
|
||||
|
||||
function add-vhd($vhdfile) {
|
||||
$path = resolve-path $vhdfile
|
||||
$script = "SELECT VDISK FILE=`"$path`"`r`nATTACH VDISK"
|
||||
$script | diskpart
|
||||
}
|
||||
|
||||
function remove-vhd($vhdfile) {
|
||||
$path = resolve-path $vhdfile
|
||||
$script = "SELECT VDISK FILE=`"$path`"`r`nDETACH VDISK"
|
||||
$script | diskpart
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue