Kros.VariableSubstitution 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Kros.VariableSubstitution --version 1.0.0                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Kros.VariableSubstitution --version 1.0.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Kros.VariableSubstitution&version=1.0.0                
nuke :add-package Kros.VariableSubstitution --version 1.0.0                

varsub

varsub is tool for variable substitutions in JSON files. It was created as a replacement for the FileTransform task for DevOps, because it could not process multiple ZIP files at once.

Installation

varsub is implemented as a .NET Global Tool, so its installation is quite simple:

dotnet tool install -g Kros.VariableSubstitution

To update it to the latest version, if it was installed previously, use:

dotnet tool update -g Kros.VariableSubstitution

How to use it

varsub -w d:\Projects\artifacts -j **/appsettings.json

Parameters

--workingDirectory, -w: Working directory.

--zipFilesOrDirectories, -f: Glob pattern to search a list of files or directories.

--jsonTargetFiles, -j: Glob pattern to search the target Json files.

--tempDirectory, -t: Path to temp directory.

--variables, -v: Variables. (var1=value1 var2=value2)

This tool processes all ZIP files that match the --zipFilesOrDirectories pattern in working directory. Processes all files that match the --jsonTargetFiles pattern. By default, it takes variables from environment variables. It tries to find the corresponding property in the JSON object for these variables. If finds, will replace it.

The --variables parameter can be used mainly for testing purposes, with which it is possible to define variables and their values (--variables var1=value1 var2=value2 ...).

⚠ It is not possible to add a new property to a JSON object or a new record to a JSON field using this tool. It only allows the replacement of existing properties.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.2.0 518 3/22/2022
1.1.0 512 2/15/2022
1.0.4 380 6/8/2021
1.0.3 354 6/8/2021
1.0.2 383 6/8/2021
1.0.1 339 6/8/2021
1.0.0 377 6/8/2021