r/PowerShell • • Mar 15 '16

¯\_(ツ)_/¯

function Get-AsciiShrug {
    $OutputEncoding = [System.Text.Encoding]::unicode
    write-output "¯_($(0x30C4|%{[char]$_}))_/¯" | clip
}
144 Upvotes

48 comments sorted by

View all comments

Show parent comments

10

u/codekaizen Mar 15 '16

Nice, though I'd prefer this encoding of the parameters:

[ValidateSet(
    'Shrug',
    'Disapproval',
    'TableFlip',
    'TableBack',
    'TableFlip2',
    'TableBack2',
    'TableFlip3',
    'Denko',
    'BlowKiss',
    'Lenny',
    'Angry',
    'DontKnow')]
[string]$Name

Then I can lazily cycle through them.

3

u/spoonstar Mar 15 '16

It does the same thing, I just have to prepend a hyphen beforehand. ValidateSet does make it quicker for me to add new ones though, so thanks for reminding me about it!

10

u/MattHodge Mar 16 '16

I have created a new version with all your ideas: https://github.com/MattHodge/MattHodgePowerShell/blob/master/Fun/Get-Ascii.ps1

  • Uses Validate Parameters

  • Outputs to console as well as clipboard

  • Doesn't copy the newline to the clipboard

2

u/gbrayut Mar 16 '16

Nice work!

2

u/mcwidget Mar 16 '16

This is great. I may have stolen it.

1

u/spoonstar Mar 16 '16

No newline! Great!