Last active
April 14, 2023 11:55
-
-
Save ArjixWasTaken/b32ae11c2188704909d224549a6d4eea to your computer and use it in GitHub Desktop.
CopilotX CLI alias for powershell
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 characters
function ??() { | |
$TMPFILE = Get-ChildItem (New-TemporaryFile) | Rename-Item -NewName { [IO.Path]::ChangeExtension($_, ".ps1") } -PassThru | |
github-copilot-cli what-the-shell "$args (for powershell, don't use powershell aliases, eg ls => Get-ChildItem)" --shellout $TMPFILE.FullName | |
if (Test-Path $TMPFILE.FullName) { | |
Invoke-Expression $TMPFILE | Write-Output; | |
} else { | |
Write-Output "Apologies! Extracting command failed"; | |
} | |
Remove-Item -Path $TMPFILE -Force | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment