v0.6.0-beta3: CallerFilePath Script Execution
Pre-release
Pre-release
·
813 commits
to master
since this release
π Beta Release: CallerFilePath Script Execution Pattern
This beta release introduces a major improvement to script execution reliability.
β¨ What's New
- CallerFilePath Pattern: All scripts now use
[CallerFilePath]to determine their location - Push/Pop Directory Management: Scripts work reliably from any execution location
- Local Feed Cleanup: Pack script now ensures only one version exists in local feed at a time
- Prerelease Support: Test scripts use
@*-*pattern to support beta versions
π§ Technical Details
Scripts now use this pattern:
public static async Task<int> Main(string[] args, [CallerFilePath] string scriptPath = "")
{
string originalDirectory = Environment.CurrentDirectory;
string scriptDirectory = Path.GetDirectoryName(scriptPath)\!;
try
{
Environment.CurrentDirectory = scriptDirectory;
// Use relative paths from script location
return 0;
}
finally
{
Environment.CurrentDirectory = originalDirectory;
}
}This is the C# equivalent of PowerShell's $PSScriptRoot and ensures scripts work correctly regardless of where they're executed from.
β οΈ Known Issues
- CI/CD tests are temporarily disabled due to .NET 10 preview script execution issues
- Tests run successfully locally
π¦ Installation
dotnet tool install -g TimeWarp.Cli --version 0.6.0-beta3Or in scripts:
#:package TimeWarp.Cli@*-*