forked from brianary/scripts
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ 🎨 Add char import; reorg script data
- Loading branch information
Showing
14 changed files
with
73,880 additions
and
73,789 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
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
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,45 @@ | ||
<# | ||
.SYNOPSIS | ||
Imports characters by name as constants into the current scope. | ||
.INPUTS | ||
System.String containing a character name. | ||
.FUNCTIONALITY | ||
Unicode | ||
.LINK | ||
Add-ScopeLevel.ps1 | ||
.LINK | ||
Get-UnicodeByName.ps1 | ||
.EXAMPLE | ||
Import-CharConstants.ps1 NL :UP: HYPHEN-MINUS 'EN DASH' '—' '©' -Scope Script | ||
Creates constants in the context of the current script for the named characters. | ||
#> | ||
|
||
#Requires -Version 7 | ||
[CmdletBinding()] Param( | ||
# The control code abbreviation, Unicode name, HTML entity, or GitHub name of the character to create a constant for. | ||
# "NL" will use the newline appropriate to the environment. | ||
[Parameter(Position=0,Mandatory=$true,ValueFromPipeline=$true,ValueFromRemainingArguments=$true)][string[]] $CharacterName, | ||
# The scope of the constant. | ||
[string] $Scope = 'Local', | ||
<# | ||
Appends a U+FE0F VARIATION SELECTOR-16 suffix to the character, which suggests an emoji presentation | ||
for characters that support both a simple text presentation as well as a color emoji-style one. | ||
#> | ||
[switch] $AsEmoji | ||
) | ||
Begin {$level = Add-ScopeLevel.ps1 -Scope $Scope} | ||
Process | ||
{ | ||
foreach($name in $CharacterName) | ||
{ | ||
$cname = $name -replace ':' | ||
$value = $name -ceq 'NL' ? [Environment]::NewLine : (Get-UnicodeByName.ps1 -Name $name -AsEmoji:$AsEmoji) | ||
Set-Variable -Name $cname -Value $value -Scope $level -Option Constant -Description $name | ||
} | ||
} |
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
Oops, something went wrong.