Skip to content

Commit

Permalink
Merge pull request #67 from StartAutomating/Docking-Emoji
Browse files Browse the repository at this point in the history
Emoji 0.1.5
  • Loading branch information
StartAutomating committed Apr 12, 2024
2 parents 3ea5c5f + 7ec7fb4 commit f75c335
Show file tree
Hide file tree
Showing 12 changed files with 254 additions and 7 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/DockEmoji.yml
@@ -0,0 +1,41 @@

name: Dock Emoji
on:
push:
branches:
- main
- master
paths-ignore:
- 'docs/**'
- '*.help.txt'
- '*.md'
jobs:
DockEmoji:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@master
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
env:
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io
41 changes: 41 additions & 0 deletions Build/GitHub/Jobs/DockEmoji.psd1
@@ -0,0 +1,41 @@
@{
'runs-on'='ubuntu-latest'
'permissions' = @{
'contents'='read'
'packages'='write'
}
steps = @(
@{
'name'='Checkout repository'
'uses'='actions/checkout@v4'
},
@{
'name'='Log in to the Container registry'
'uses'='docker/login-action@master'
'with'=@{
'registry'='${{ env.REGISTRY }}'
'username'='${{ github.actor }}'
'password'='${{ secrets.GITHUB_TOKEN }}'
}
},
@{
'name'='Extract metadata (tags, labels) for Docker'
'id'='meta'
'uses'='docker/metadata-action@master'
'with'=@{
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
}
},
@{
'name'='Build and push Docker image'
'uses'='docker/build-push-action@master'
'with'=@{
'context'='.'
'push'='true'
'tags'='${{ steps.meta.outputs.tags }}'
'labels'='${{ steps.meta.outputs.labels }}'
}
}

)
}
6 changes: 6 additions & 0 deletions Build/GitHub/On/PushToMain.psd1
@@ -0,0 +1,6 @@
@{
push = @{
branches =@('main','master')
"paths-ignore" = @("docs/**","*.help.txt", "*.md")
}
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,11 @@
## Emoji 0.1.5:

* Emoji.Symbol.HTML (#66)
* ... and new views (#62)
* Emoji Docker Support (#63, #64, #65)

---

## Emoji 0.1.4:

* Emoji.Symbol.CSS (#58)
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
@@ -0,0 +1,5 @@
FROM mcr.microsoft.com/powershell
ENV PSModulePath ./Modules
COPY . ./Modules/Emoji
RUN pwsh -c "New-Item -Path /root/.config/powershell/Microsoft.PowerShell_profile.ps1 -Value 'Import-Module Emoji' -Force"

86 changes: 86 additions & 0 deletions Emoji.format.ps1xml
Expand Up @@ -296,6 +296,75 @@
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>Html</Name>
<ViewSelectedBy>
<TypeName>Emoji.Symbol</TypeName>
</ViewSelectedBy>
<TableControl>
<AutoSize />
<TableHeaders>
<TableColumnHeader>
</TableColumnHeader>
<TableColumnHeader>
<Label>Name</Label>
</TableColumnHeader>
<TableColumnHeader>
<Alignment>Left</Alignment>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>Emoji</PropertyName>
</TableColumnItem>
<!-- {ConditionalStyle:"Foreground.Green"}-->
<TableColumnItem>
<ScriptBlock>
$CellColorValue = $($Script:_LastCellStyle ='Foreground.Green';$Script:_LastCellStyle)

$CellColorValue = if ($psStyle) {
@(foreach ($styleProp in $CellColorValue) {
if ($styleProp -match '^\$') {
$ExecutionContext.SessionState.InvokeCommand.InvokeScript($styleProp)
}
elseif ($styleProp -match '\.') {
$targetObject = $psStyle
foreach ($dotProperty in $styleProp -split '(?&lt;!\.)\.') {
if (
($targetObject.psobject.Members['Item'] -and
($targetObject.Item -is [Management.Automation.PSMethodInfo])
) -or
$targetObject -is [Collections.IDictionary]
) {
$targetObject = $targetObject[$dotProperty]
} else {
$targetObject = $targetObject.$dotProperty
}
}
if ($targetObject) {
$targetObject
}
}
else {
$psStyle.$styleProp
}
}) -join ''
}

$output = . {$_.'Name'}
@($CellColorValue; $output; $psStyle.Reset) -join ''
</ScriptBlock>
</TableColumnItem>
<TableColumnItem>
<PropertyName>HTML</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
<View>
<Name>Emoji.Symbol</Name>
<ViewSelectedBy>
Expand Down Expand Up @@ -502,5 +571,22 @@
</CustomEntries>
</CustomControl>
</View>
<View>
<Name>HTML</Name>
<ViewSelectedBy>
<TypeName>Emoji.Symbol</TypeName>
</ViewSelectedBy>
<CustomControl>
<CustomEntries>
<CustomEntry>
<CustomItem>
<ExpressionBinding>
<PropertyName>HTML</PropertyName>
</ExpressionBinding>
</CustomItem>
</CustomEntry>
</CustomEntries>
</CustomControl>
</View>
</ViewDefinitions>
</Configuration>
14 changes: 8 additions & 6 deletions Emoji.psd1
@@ -1,5 +1,5 @@
@{

Check warning on line 1 in Emoji.psd1

View workflow job for this annotation

GitHub Actions / PowerShellStaticAnalysis

PSUseBOMForUnicodeEncodedFile : Missing BOM encoding for non-ASCII encoded file 'Emoji.psd1'
ModuleVersion = '0.1.4'
ModuleVersion = '0.1.5'
RootModule = 'Emoji.psm1'

Check warning on line 4 in Emoji.psd1

View workflow job for this annotation

GitHub Actions / PowerShellStaticAnalysis

PSAvoidTrailingWhitespace : Line has trailing whitespace
Description = '⟩⚡PowerShell Emoji 😎😉😍🥰🤔😟'
Expand All @@ -18,17 +18,19 @@
LicenseURI = 'https://github.com/StartAutomating/blob/main/LICENSE'
Tags = 'Emoji', 'PowerShell'
ReleaseNotes = @'
## Emoji 0.1.4:
## Emoji 0.1.5:
* Emoji.Symbol.CSS (#58)
* ... and new views (#60)
* Also making color more tolerant of strict mode (#59)
* Emoji.Symbol.HTML (#66)
* ... and new views (#62)
* Emoji Docker Support (#63, #64, #65)
---
Full history in [CHANGELOG](https://github.com/StartAutomating/Emoji/blob/main/CHANGELOG.md)
Like it? [Star It](https://github.com/StartAutomating/Emoji)! Love it? [Support It!](https://github.com/sponsors/StartAutomating)
> Like It? [Star It](https://github.com/StartAutomating/Emoji)
> Love It? [Support It](https://github.com/sponsors/StartAutomating)
'@
}
Recommends = 'Posh','PipeScript','EZOut'
Expand Down
17 changes: 17 additions & 0 deletions Emoji.types.ps1xml
Expand Up @@ -607,6 +607,23 @@ $className = $this.Name.ToLower() -replace '\s','-'

</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>HTML</Name>
<GetScriptBlock>
&lt;#
.SYNOPSIS
Gets an Emoji as HTML
.DESCRIPTION
Gets an Emoji as an HTML span
.EXAMPLE
(Get-Emoji -Name 'Grinning Face').HTML
#&gt;
param()

"&lt;span&gt;$([Web.HttpUtility]::HtmlEncode($this.Emoji))&lt;/span&gt;"

</GetScriptBlock>
</ScriptProperty>
<ScriptProperty>
<Name>Number</Name>
<GetScriptBlock>
Expand Down
10 changes: 10 additions & 0 deletions README.md
@@ -1,3 +1,13 @@
<div align='center'>
<img src='Assets/Emoji.png' alt='emoji' />
<a href='https://www.powershellgallery.com/packages/emoji/'>
<img src='https://img.shields.io/powershellgallery/dt/emoji' />
</a>
<br/>
<a href='https://github.com/sponsors/StartAutomating'>❤️</a>
<a href='https://github.com/StartAutomating/emoji/stargazers'>⭐</a>
</div>

# Emoji
⟩⚡PowerShell Emoji 😎😉😍🥰🤔😟

Expand Down
10 changes: 10 additions & 0 deletions README.ps.md
@@ -1,3 +1,13 @@
<div align='center'>
<img src='Assets/Emoji.png' alt='emoji' />
<a href='https://www.powershellgallery.com/packages/emoji/'>
<img src='https://img.shields.io/powershellgallery/dt/emoji' />
</a>
<br/>
<a href='https://github.com/sponsors/StartAutomating'>❤️</a>
<a href='https://github.com/StartAutomating/emoji/stargazers'>⭐</a>
</div>

# Emoji
⟩⚡PowerShell Emoji 😎😉😍🥰🤔😟

Expand Down
12 changes: 11 additions & 1 deletion Types/Emoji.Symbol/Emoji.Symbol.format.ps1
Expand Up @@ -28,6 +28,12 @@ Write-FormatView -TypeName Emoji.Symbol -Property CSS -AlignProperty @{
CSS = 'Left'
} -AutoSize -Name CSS

Write-FormatView -TypeName Emoji.Symbol -Property Emoji, Name, HTML -AlignProperty @{
Html = 'Left'
} -AutoSize -Name Html -StyleProperty @{
Name = 'Foreground.Green'
}

Write-FormatView -TypeName Emoji.Symbol -Action {
Write-FormatViewExpression -ScriptBlock {
$_.Emoji.PadRight(4)
Expand Down Expand Up @@ -59,4 +65,8 @@ Write-FormatView -TypeName Emoji.Symbol -Action {
Write-FormatViewExpression -Text "*/"
Write-FormatViewExpression -Newline
Write-FormatViewExpression -Property CSS
} -Name CSS
} -Name CSS

Write-FormatView -TypeName Emoji.Symbol -Action {
Write-FormatViewExpression -Property HTML
} -Name HTML
11 changes: 11 additions & 0 deletions Types/Emoji.Symbol/get_HTML.ps1
@@ -0,0 +1,11 @@
<#
.SYNOPSIS
Gets an Emoji as HTML
.DESCRIPTION
Gets an Emoji as an HTML span
.EXAMPLE
(Get-Emoji -Name 'Grinning Face').HTML
#>
param()

"<span>$([Web.HttpUtility]::HtmlEncode($this.Emoji))</span>"

0 comments on commit f75c335

Please sign in to comment.