Skip to content

Commit

Permalink
!deploy v0.6.1
Browse files Browse the repository at this point in the history
## 0.6.1 - 2019-11-04

* Miscellaneous
    * Fixed: Errors thrown on functions `Open-Code`, `Edit-PSProfileInitScript`, & `Edit-PSProfilePrompt` when `code-insiders` is not installed
  • Loading branch information
scrthq committed Nov 4, 2019
1 parent 21487ea commit 1dca0bb
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* [PSProfile - ChangeLog](#psprofile---changelog)
* [0.6.1 - 2019-11-04](#061---2019-11-04)
* [0.6.0 - 2019-11-02](#060---2019-11-02)
* [0.5.0 - 2019-10-08](#050---2019-10-08)
* [0.4.1 - 2019-10-08](#041---2019-10-08)
Expand All @@ -20,6 +21,11 @@

# PSProfile - ChangeLog

## 0.6.1 - 2019-11-04

* Miscellaneous
* Fixed: Errors thrown on functions `Open-Code`, `Edit-PSProfileInitScript`, & `Edit-PSProfilePrompt` when `code-insiders` is not installed

## 0.6.0 - 2019-11-02

* [Issue #21](https://github.com/scrthq/PSProfile/issues/21) - _Thank you [@corbob](https://github.com/corbob)!_
Expand Down
24 changes: 20 additions & 4 deletions PSProfile/Public/Init Scripts/Edit-PSProfileInitScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,27 @@ function Edit-PSProfileInitScript {
$Save
)
Process {
$codeCommand = @('code','code-insiders')
if ($WithInsiders) {
$codeCommand = @('code-insiders','code')
$code = $null
$codeCommand = if($WithInsiders) {
@('code-insiders','code')
}
else {
@('code','code-insiders')
}
foreach ($cmd in $codeCommand) {
try {
if ($found = (Get-Command $cmd -All -ErrorAction Stop | Where-Object { $_.CommandType -notin @('Function','Alias') } | Select-Object -First 1 -ExpandProperty Source)) {
$code = $found
break
}
}
catch {
$Global:Error.Remove($Global:Error[0])
}
}
if ($null -eq $code){
throw "Editor not found!"
}
$code = (Get-Command $codeCommand -All | Where-Object { $_.CommandType -notin @('Function','Alias') })[0].Source
foreach ($initScript in $Name) {
if ($Global:PSProfile.InitScripts.Contains($initScript)) {
$in = @{
Expand Down
32 changes: 20 additions & 12 deletions PSProfile/Public/Power Tools/Open-Code.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,27 @@ function Open-Code {
}
}
Process {
$codeCommand = @('code','code-insiders')
if($WithInsiders) {
$codeCommand = @('code-insiders','code')
$code = $null
$codeCommand = if($WithInsiders) {
@('code-insiders','code')
}
else {
@('code','code-insiders')
}
foreach ($cmd in $codeCommand) {
try {
if ($found = (Get-Command $cmd -All -ErrorAction Stop | Where-Object { $_.CommandType -notin @('Function','Alias') } | Select-Object -First 1 -ExpandProperty Source)) {
$code = $found
break
}
}
catch {
$Global:Error.Remove($Global:Error[0])
}
}
if ($null -eq $code){
throw "Editor not found!"
}
$code = (Get-Command $codeCommand -All | Where-Object { $_.CommandType -notin @('Function','Alias') })[0].Source
if ($PSCmdlet.ParameterSetName -eq 'InputObject') {
$collection.Add($InputObject)
if ($PSBoundParameters.ContainsKey('Path')) {
Expand Down Expand Up @@ -159,14 +175,6 @@ function Open-Code {
[System.IO.Path]::Combine($global:PSProfile.GitPathMap['chef-repo'],'cookbooks',$PSBoundParameters['Cookbook'])
}
}
<# if ($AddToWorkspace) {
Write-Verbose "Running command: code --add $($PSBoundParameters[$PSCmdlet.ParameterSetName]) $ArgumentList"
& $code --add $target $ArgumentList
}
else {
Write-Verbose "Running command: code $($PSBoundParameters[$PSCmdlet.ParameterSetName]) $ArgumentList"
& $code $target $ArgumentList
} #>
$cmd = @()
if ($AddToWorkspace) {
$cmd += '--add'
Expand Down
24 changes: 20 additions & 4 deletions PSProfile/Public/Prompts/Edit-PSProfilePrompt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,27 @@ function Edit-PSProfilePrompt {
$Save
)
Process {
$codeCommand = @('code','code-insiders')
if ($WithInsiders) {
$codeCommand = @('code-insiders','code')
$code = $null
$codeCommand = if($WithInsiders) {
@('code-insiders','code')
}
else {
@('code','code-insiders')
}
foreach ($cmd in $codeCommand) {
try {
if ($found = (Get-Command $cmd -All -ErrorAction Stop | Where-Object { $_.CommandType -notin @('Function','Alias') } | Select-Object -First 1 -ExpandProperty Source)) {
$code = $found
break
}
}
catch {
$Global:Error.Remove($Global:Error[0])
}
}
if ($null -eq $code){
throw "Editor not found!"
}
$code = (Get-Command $codeCommand -All | Where-Object { $_.CommandType -notin @('Function','Alias') })[0].Source
$in = @{
StdIn = Get-PSProfilePrompt -Global
TmpFile = [System.IO.Path]::Combine(([System.IO.Path]::GetTempPath()),"ps-prompt-$(-join ((97..(97+25)|%{[char]$_}) | Get-Random -Count 3)).ps1")
Expand Down

0 comments on commit 1dca0bb

Please sign in to comment.