Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
streamlining profile. was getting a little modularization crazy
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmuc committed Dec 5, 2011
1 parent a26682d commit c5da8cb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 67 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
/Modules
29 changes: 26 additions & 3 deletions profile/profile.ps1 → Microsoft.PowerShell_profile.ps1
@@ -1,3 +1,9 @@
###########################################################
#
# Scott's custom profile
#
###########################################################

# prompt customization coming from the following:
# http://winterdom.com/2008/08/mypowershellprompt
function shorten-path([string] $path) {
Expand All @@ -21,13 +27,15 @@ function prompt {
write-host ' {' -n -f $cdelim
write-host (shorten-path (pwd).Path) -n -f $cloc
write-host '}' -n -f $cdelim

$global:GitStatus = Get-GitStatus
Write-GitStatus $GitStatus

return '> '
}

Set-Alias which Get-Command

function Setup-Path {
$paths = @("$($env:Path)", "$($env:UserProfile)\poshfiles\scripts")
gci $env:UserProfile\bin | % { $paths += $_.FullName }
Expand All @@ -38,7 +46,22 @@ function Import-InstalledModules {
Get-Module -ListAvailable | ? { $_.ModuleType -eq "Script" } | Import-Module
}

function Nuke-Item($item) { Remove-Item $item -Recurse -Force }

function Edit-HostsFiles {
Start-Process -FilePath notepad -ArgumentList "$env:windir\system32\drivers\etc\hosts"
}

# found at http://www.gregorystrike.com/2011/01/27/how-to-tell-if-powershell-is-32-bit-or-64-bit/
Function Get-Bits {
Switch ([System.Runtime.InterOpServices.Marshal]::SizeOf([System.IntPtr])) {
4 { Return "32-bit" }
8 { Return "64-bit" }
default { Return "Unknown Type" }
}
}

Setup-Path
Import-InstalledModules

Enable-GitColors
Enable-GitColors
10 changes: 2 additions & 8 deletions README.md
Expand Up @@ -4,19 +4,13 @@ Powershell Profile
To install simply run the following in Powershell

<pre>
(new-object Net.WebClient).DownloadString("https://github.com/scottmuc/poshfiles/raw/master/install.ps1") | invoke-expression
git clone git@github.com:scottmuc/poshfiles %USERPROFILE%\Documents\WindowsPowershell
</pre>

Features
--------

- Add any script to $env:UserProfile\poshfiles\scripts and it will be globally available
look at Edit-Hosts.ps1 as an example
- Creates a pretty prompt
- Imports all Script modules whenever powershell is run
- Sets up your $env:Path so all directories in $env:UserProfile\bin are globally available

TODO
----

- Instructions on how to fork, modify the installer, and have your own custom powershell profile
- Loaded with some utility functions
44 changes: 0 additions & 44 deletions install.ps1

This file was deleted.

1 change: 0 additions & 1 deletion scripts/Edit-HostsFile.ps1

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/Get-Bits.ps1

This file was deleted.

0 comments on commit c5da8cb

Please sign in to comment.