Last active
August 19, 2024 19:22
-
-
Save ninmonkey/e9968c829185a310574e61f2365105a4 to your computer and use it in GitHub Desktop.
Revisions
-
ninmonkey revised this gist
Jul 11, 2024 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,8 @@ function GetClipboardItem { $Item = Get-Item -ea ignore $_ } if( -not $item ) { # ' invalid input: returning nothing' | Write-Host -fg '#3379c4' throw 'invalid input: returning nothing' # useful for: $foo | gcl.gi | cl return } $global:GI = $Item -
ninmonkey revised this gist
Jul 11, 2024 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -24,9 +24,12 @@ function GetClipboardItem { } else { $Item = Get-Item -ea ignore $_ } if( -not $item ) { ' invalid input: returning nothing' | Write-Host -fg '#3379c4' return } $global:GI = $Item $Item $Item | join-string -f ' => Copied: "{0}"' | Write-host -fg 'gray60' -bg 'gray2' } } -
ninmonkey revised this gist
Jul 11, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Here's tiny clipboard sugar for a profile # context: there was a thread about creating a custom clipboard uri, and clipboard cmdlets # <https://discord.com/channels/180528040881815552/447476117629304853/1260981998479081562> Import-Module Pansies # It's nice to get a confirmation that your clip was saved $PSDefaultParameterValues['Set-ClipBoard:PassThru'] = $true -
ninmonkey revised this gist
Jul 11, 2024 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,11 @@ function GetClipboardItem { [Alias('Gcl.Gi')] param() process { if( $null -eq $_ ) { $Item = Get-Clipboard | Get-Item -ea ignore } else { $Item = Get-Item -ea ignore $_ } if( -not $item ) { return } $global:GI = $Item $Item -
ninmonkey revised this gist
Jul 11, 2024 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,18 +11,18 @@ Set-Alias 'gcl' 'Get-Clipboard' function GetClipboardItem { <# .description This reads the clipboard, converts to an item if and only if the path exists invalid paths do not return a value invalid paths will not erase previous $global:gi values #> [Alias('Gcl.Gi')] param() process { $Item = Get-Clipboard | Get-Item -ea ignore $_ if( -not $item ) { return } $global:GI = $Item $Item $Item | join-string -f 'Copied: "{0}"' | Write-host -fg 'gray60' -bg 'gray2' } } -
ninmonkey created this gist
Jul 11, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ # Here's tiny clipboard sugar for a profile # context: there was a thread about creating a custom clipboard uri, and clipboard cmdlets # <https://discord.com/channels/180528040881815552/447476117629304853/1260981998479081562> # It's nice to get a confirmation that your clip was saved $PSDefaultParameterValues['Set-ClipBoard:PassThru'] = $true Set-alias 'cl' 'Set-ClipBoard' # 'sc' already exists Set-Alias 'gcl' 'Get-Clipboard' function GetClipboardItem { <# .description This sets your clipboard returns a non-null value, if and only if the path exists invalid paths skip set-clipbaord # optionally you can set a global, and set- #> param() process { $Item = Get-Item -ea ignore $_ if( -not $item ) { return } $global:GI = $Item $Item | Set-Clipboard -passthru:$false $Item } }