Skip to content

Change invocation method for CTTcustom.ps1#186

Open
kawells wants to merge 1 commit intoChrisTitusTech:mainfrom
kawells:patch-1
Open

Change invocation method for CTTcustom.ps1#186
kawells wants to merge 1 commit intoChrisTitusTech:mainfrom
kawells:patch-1

Conversation

@kawells
Copy link
Copy Markdown

@kawells kawells commented Mar 11, 2026

The & (call operator) executes a script in a child scope, meaning any functions defined within CTTcustom.ps1 are not exposed to your main PowerShell session. This change will ensure that CTTcustom.ps1 is loaded into the current PowerShell session's scope, making any functions defined in it accessible.

The `&` (call operator) executes a script in a child scope, meaning any functions defined within `CTTcustom.ps1` are not exposed to your main PowerShell session. This change will ensure that `CTTcustom.ps1` is loaded into the current PowerShell session's scope, making any functions defined in it accessible.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the PowerShell profile to load CTTcustom.ps1 into the current session scope so any functions it defines are available after the profile runs.

Changes:

  • Replace Invoke-Expression + call-operator string invocation with dot-sourcing of CTTcustom.ps1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 757 to +758
if (Test-Path "$PSScriptRoot\CTTcustom.ps1") {
Invoke-Expression -Command "& `"$PSScriptRoot\CTTcustom.ps1`""
. "$PSScriptRoot\CTTcustom.ps1"
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider building the path with Join-Path (and using Test-Path -LiteralPath) instead of embedding \ in an interpolated string. This avoids wildcard interpretation edge-cases and is more robust if this profile is used under PowerShell Core on non-Windows paths, while matching the existing Join-Path usage elsewhere in this profile (e.g., the Oh My Posh theme path).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants