-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from StartAutomating/Posh-Updates
Posh 0.1.2
- Loading branch information
Showing
35 changed files
with
1,505 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Push-Location (Split-Path $PSScriptRoot) | ||
Initialize-Splatter -Verb Get, Use, Find -OutputPath .\@.ps1 | ||
Pop-Location | ||
Initialize-Splatter -Verb Get, Use, Find, Merge -OutputPath .\@.ps1 | ||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#1. Customizing Profiles | ||
|
||
# Profiles are a useful part of PowerShell. | ||
|
||
# They run when PowerShell starts. | ||
|
||
# Posh makes profiles easy to explore and modify | ||
|
||
$Posh.Profile | ||
|
||
# Let's pipe it into Get-Member and see what it can do: | ||
|
||
$Posh.Profile | Get-Member | ||
|
||
# We can get all the current profile file, by using | ||
|
||
$Posh.Profile.File | ||
|
||
# We can also get all current profile files, by using | ||
|
||
$Posh.Profile.Files | ||
|
||
# If we want to import a module in our profile, we can use | ||
|
||
$Posh.Profile.ImportModule("Posh") | ||
|
||
# If we want to add arbitrary code to our profile, we can use: | ||
|
||
$Posh.Profile.Add({ | ||
"Welcome to PowerShell!" | Out-Host | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 1. Making Prompts more Posh | ||
|
||
# `Prompt` is a PowerShell function that is called just before PowerShell asks for input. | ||
|
||
# It outputs the text that goes before a prompt. | ||
|
||
# Modifying the PowerShell prompt can be incredibly useful. | ||
|
||
# This is why Posh makes modifying the prompt easy. | ||
|
||
#2. Replacing parts of the prompt | ||
|
||
# We can see information about the current prompt by running: | ||
|
||
$Posh.Prompt | ||
|
||
# Let's use Get-Member to see what we can do: | ||
|
||
$Posh.Prompt | Get-Member | ||
|
||
# Now let's modify the prompt to replace the username with astericks | ||
|
||
$Posh.Prompt.Replace( | ||
$(if ($env:User) { $env:User } else { $env:USERNAME }), | ||
'*****' | ||
) | ||
|
||
#.ShowPrompt | ||
|
||
# Now let's replace the start of the prompt. | ||
|
||
# We can provide a string, scriptblock, or emoji number. | ||
|
||
$Posh.Prompt.Replace("PS ", 0x2AA1) | ||
|
||
# Looks nice. Let's replace the end of the prompt. | ||
|
||
$Posh.Prompt.Replace(">", 0x2AA2) | ||
|
||
# For extra fun, let's add some content to the end of the prompt | ||
|
||
$Posh.Prompt.Append({(Get-Date).ToShortTimeString()}) | ||
|
||
# Hmm, that isn't quite distintive enough. Let's undo that step. | ||
|
||
$Posh.Prompt.Pop() | ||
|
||
# Now let's add a "better" end to the prompt: | ||
|
||
$Posh.Prompt.Append({ | ||
"[$((Get-Date).ToShortTimeString())]" | ||
}) | ||
|
||
# Posh provides the fundamental building blocks to modify your prompt. | ||
|
||
# May it make your shell more sleek. |
Oops, something went wrong.