diff --git a/Build/NLedgerBuild.proj b/Build/NLedgerBuild.proj index d875a586..fe7f31dd 100644 --- a/Build/NLedgerBuild.proj +++ b/Build/NLedgerBuild.proj @@ -13,8 +13,9 @@ $(SourceRoot)ProductInfo.xml - $(SourceRoot)NLedger.Tests\bin\Release\net452\NLedger.Tests.dll $(SourceRoot)NLedger.IntegrationTests\bin\Release\net472\NLedger.IntegrationTests.dll $(SourceRoot)NLedger.Extensibility.Python.Tests\bin\Release\net472\NLedger.Extensibility.Python.Tests.dll - $(SourceRoot)NLedger.Tests\bin\Release\netcoreapp3.1\NLedger.Tests.dll $(SourceRoot)NLedger.IntegrationTests\bin\Release\netcoreapp3.1\NLedger.IntegrationTests.dll $(SourceRoot)NLedger.Extensibility.Python.Tests\bin\Release\netcoreapp3.1\NLedger.Extensibility.Python.Tests.dll + $(SourceRoot)NLedger.Tests\bin\Release\net48\NLedger.Tests.dll $(SourceRoot)NLedger.IntegrationTests\bin\Release\net48\NLedger.IntegrationTests.dll $(SourceRoot)NLedger.Extensibility.Python.Tests\bin\Release\net48\NLedger.Extensibility.Python.Tests.dll + $(SourceRoot)NLedger.Tests\bin\Release\net6.0\NLedger.Tests.dll $(SourceRoot)NLedger.IntegrationTests\bin\Release\net6.0\NLedger.IntegrationTests.dll $(SourceRoot)NLedger.Extensibility.Python.Tests\bin\Release\net6.0\NLedger.Extensibility.Python.Tests.dll + $(SourceRoot)NLedger.Tests\bin\Release\net8.0\NLedger.Tests.dll $(SourceRoot)NLedger.IntegrationTests\bin\Release\net8.0\NLedger.IntegrationTests.dll $(SourceRoot)NLedger.Extensibility.Python.Tests\bin\Release\net8.0\NLedger.Extensibility.Python.Tests.dll @@ -60,8 +61,9 @@ - - + + + @@ -74,8 +76,8 @@ - - + + @@ -85,26 +87,50 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -121,12 +147,13 @@ - + - - + + + - + @@ -168,8 +195,8 @@ - - + + diff --git a/Build/NLedgerBuild.ps1 b/Build/NLedgerBuild.ps1 index 958e3046..bdf74f74 100644 --- a/Build/NLedgerBuild.ps1 +++ b/Build/NLedgerBuild.ps1 @@ -151,9 +151,9 @@ Param() write-host "Interactive console helps you compile, test and build NLedger with various options`r`n" write-host -NoNewline "It supports several short commands that run the build process with typical targets:`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "all" - write-host -NoNewline " all build steps (compile, test, package). Does not require admin proviledges (longer build time);`r`n PS> " + write-host -NoNewline " all build steps (compile, test, package). Does not require admin privileges (longer build time);`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "all-elevated" - write-host -NoNewline " all build steps with admin priviledges (testing is faster because of possibility to create native images);`r`n PS> " + write-host -NoNewline " all build steps with admin privileges (testing is faster because of possibility to create native images);`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "build" write-host -NoNewline " compile NLedger code; no other steps;`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "codetest" @@ -161,9 +161,9 @@ Param() write-host -NoNewline -ForegroundColor Yellow "release" write-host -NoNewline " compile and build a package; no testing;`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "test" - write-host -NoNewline " compile, create a package and run Ledger tests. Does not require admin priviledges (longer testing time);`r`n PS> " + write-host -NoNewline " compile, create a package and run Ledger tests. Does not require admin privileges (longer testing time);`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "test-elevated" - write-host -NoNewline " compile, create a package and run Ledger tests. Requires admin proviledges (faster testing time);`r`n PS> " + write-host -NoNewline " compile, create a package and run Ledger tests. Requires admin privileges (faster testing time);`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "package" write-host -NoNewline " compile and build a package; no testing;`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "msi" @@ -172,7 +172,7 @@ Param() write-host -NoNewline " create an Nuget package; no testing;`r`n PS> " write-host -NoNewline -ForegroundColor Yellow "help" write-host -NoNewline " show this help page again.`r`n" - write-host -NoNewline "`r`nNote: some build targets require administrative priviledges because they try to create NLedger native images by means of NGen." + write-host -NoNewline "`r`nNote: some build targets require administrative privileges because they try to create NLedger native images by means of NGen." write-host -NoNewline "`r`nIt significatnly shortens testing time (from several minutes to tens of seconds)." write-host -NoNewline "`r`nIf it is inacceptable on this environment, use non-elevating targets.`r`n" write-host -NoNewline "`r`nType '" diff --git a/Build/NLedgerWix/Components.wxs b/Build/NLedgerWix/Components.wxs index 02635eb5..28e53158 100644 --- a/Build/NLedgerWix/Components.wxs +++ b/Build/NLedgerWix/Components.wxs @@ -7,43 +7,99 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + - - + + + - - @@ -467,6 +523,8 @@ + + @@ -677,57 +735,21 @@ - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + diff --git a/Build/NLedgerWix/InstallerScripts.vbs b/Build/NLedgerWix/InstallerScripts.vbs index 30f6b024..8d3d8432 100644 --- a/Build/NLedgerWix/InstallerScripts.vbs +++ b/Build/NLedgerWix/InstallerScripts.vbs @@ -1,6 +1,6 @@ ' CUSTOM ACTION -' Shows a warning message that Powershel is not installed +' Shows a warning message that Powershell is not installed ' Requires property "NoPowershellWarningMessage" Sub ShowNoPowershellWarningMessage() Set rec = Session.Installer.CreateRecord(1) diff --git a/Build/NLedgerWix/Product.wxs b/Build/NLedgerWix/Product.wxs index 30c8f0bf..93179b4e 100644 --- a/Build/NLedgerWix/Product.wxs +++ b/Build/NLedgerWix/Product.wxs @@ -5,7 +5,7 @@ - + @@ -81,53 +81,35 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -138,76 +120,81 @@ - - - - - - + + + + + + + + + + + - - - - - - - - + + + + - - - - - + + + - + - - - - - - - + - + WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed - + - - + + + + + + - - + + + + + + - $AppBinFiles>2 - $AppBinFiles=2 + $BinNet48Files>2 + $BinNet60Files>2 + $BinNet80Files>2 + $BinNet48Files=2 + $BinNet60Files=2 + $BinNet80Files=2 diff --git a/Build/NLedgerWix/Product_en-us.wxl b/Build/NLedgerWix/Product_en-us.wxl index 70593143..1d21b114 100644 --- a/Build/NLedgerWix/Product_en-us.wxl +++ b/Build/NLedgerWix/Product_en-us.wxl @@ -22,8 +22,8 @@ Web Browser page that shows .Net Ledger in action (Powershell is required) Test Toolkit Testing framework with a collection of tests (Powershell is required) - Manual Install - Command line console that register .Net Ledger binaries (Powershell is required) + Python Extension + Python support in .Net Ledger diff --git a/CHANGELOG.md b/CHANGELOG.md index fbb90d75..ca6859b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,34 @@ +## 0.8.5 (2023-12-28) + +### Release Information + +- Support for multi-target deployments +- Migrating to LTS .Net versions +- Created .Net Ledger Tools management console +- Bug fixing + +### Features + +- Default solution targets are changed to current LTS versions (.Net Framework 4.8, .Net 6.0, .Net 8) +- Public packages (MSI and ZIP) are distributed with pre-built binaries for LTS targets +- Public NuGet package includes Standard 2.0, .Net 6.0 and .Net 8 targets +- Development build script `get-nledger-up.ps1` is changed to support custom targets. Developers can build and test binaries for any supported .Net versions. +- Development build script `get-nledger-up.ps1` is changed to reflect local environment limitations. Non-available targets are silently skipped. +- Added a single management console `.Net Ledger Tools` that incorporates commands for installation, configuration, testing, Python management and running interactive demo + +### Known Issues + +- Listed in ProductInfo.xml +- NLedger Python module requires PythonNet module version 2.5.2 or 3.0.0-pre. Adding support for PythonNet 3.0.3 is addressed by further development. + +### Bug Fixing + +- Bug fixing (GH #24 #25 #26 #29) + +### Breaking Changes + +- .Net Ledger Tools management console replaces interactive PowerShell scripts for installing, testing, Python management and running Live Demo. + ## 0.8.4 (2021-12-01) ### Release Information diff --git a/Contrib/NLManagement/NLSetup.psm1 b/Contrib/Common/NLedgerConfig.psm1 similarity index 51% rename from Contrib/NLManagement/NLSetup.psm1 rename to Contrib/Common/NLedgerConfig.psm1 index faabaeff..1ed079c1 100644 --- a/Contrib/NLManagement/NLSetup.psm1 +++ b/Contrib/Common/NLedgerConfig.psm1 @@ -1,334 +1,305 @@ -# NLedger Setup Module that provides basic functions to manage NLedger settings - -[CmdletBinding()] -Param( - [Parameter(Mandatory=$False)][string]$Script:nledgerPath = $null -) - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path -Import-Module $Script:ScriptPath\NLWhere.psm1 -Force -Import-Module $Script:ScriptPath\NLCommon.psm1 -Force - -$Global:ConfigDataExtensions = @{} - -<# -.SYNOPSIS - Returns configuration container. -.DESCRIPTION - This function calls NLedger.CLI binaries to build a configuration container. - The container contains complete descriptive information about all settings - and current values. -.NOTES - Author: Dmitry Merzlyakov - Date: June 25, 2018 -#> -function GetConfigData { - [CmdletBinding()] - Param() - - if (!$Script:nledgerBinaryLoaded) { throw "NLedger binaries not loaded. GetConfigData is not available."} - - $private:appConfigFile = [System.IO.Path]::GetFullPath($Script:AppSettingsFile) - setAppConfigFile $private:appConfigFile | Out-Null - - $private:extensionIndex = @{} - $private:definitions = New-Object "System.Collections.Generic.List[NLedger.Utility.Settings.CascadeSettings.ISettingDefinition]" - - foreach($private:extension in $Global:ConfigDataExtensions.Values) { - foreach($private:setting in $private:extension.Settings) { - $private:def = New-Object $Script:StringSettingDefinitionType -ArgumentList @($private:setting.Name,$private:setting.Description,$private:setting.Default) - $private:definitions.Add($private:def) | Out-Null - $private:extensionIndex[$private:def] = $private:extension.Category - } - } - - $Private:NLedgerConfiguration = New-Object $Script:NLedgerConfigurationType @(,$private:definitions) - if (!$Private:NLedgerConfiguration) { throw "Cannot create $Script:NLedgerConfigurationType" } - - $Private:settings = @() - foreach($Private:definition in $Private:NLedgerConfiguration.Definitions) { - $private:valDefaultValue = $Private:definition.DefaultValue - $private:valAppSettings = $Private:NLedgerConfiguration.SettingsContainer.AppSettings.GetValue($Private:definition.Name) - $private:valCommonSettings = $Private:NLedgerConfiguration.SettingsContainer.CommonSettings.GetValue($Private:definition.Name) - $private:valUserSettings = $Private:NLedgerConfiguration.SettingsContainer.UserSettings.GetValue($Private:definition.Name) - $private:valVarSettings = $Private:NLedgerConfiguration.SettingsContainer.VarSettings.GetValue($Private:definition.Name) - $private:valEffectiveValue = $Private:NLedgerConfiguration.SettingsContainer.GetEffectiveValue($Private:definition.Name) - - $private:isIndexed = $private:extensionIndex.ContainsKey($Private:definition) - $private:category = if($private:isIndexed){$private:extensionIndex[$Private:definition]}else{".Net Ledger Application Settings"} - - $Private:settings += [PsCustomObject]@{ - Name=$Private:definition.Name - Category=$private:category - Description=$Private:definition.Description - SettingType=$Private:definition.SettingType.Name - PossibleValues=$Private:definition.GetValues() - - DefaultValue=[string]$private:valDefaultValue - HasDefaultValue=$private:valDefaultValue -ne $null - - AppSettingValue=[string]$private:valAppSettings - HasAppSettingValue=$private:valAppSettings -ne $null - IsAvailableForApp=(!$private:isIndexed) - - CommonSettingValue=[string]$private:valCommonSettings - HasCommonSettingValue=$private:valCommonSettings -ne $null - IsAvailableForCommon=$Private:definition.Scope -eq "user" - - UserSettingValue=[string]$private:valUserSettings - HasUserSettingValue=$private:valUserSettings -ne $null - IsAvailableForUser=$Private:definition.Scope -eq "user" - - EnvironmentSettingValue=[string]$private:valVarSettings - HasEnvironmentSettingValue=$private:valVarSettings -ne $null - IsAvailableForEnv=(!$private:isIndexed) - - EffectiveSettingValue=[string]$private:valEffectiveValue - HasEffectiveSettingValue=$private:valEffectiveValue -ne $null - } - } - - return [PsCustomObject]@{ - CommonSettingsFile=[System.IO.Path]::GetFullPath($Private:NLedgerConfiguration.SettingsContainer.CommonSettings.FilePath) - CommonSettingsFileExists=$($Private:NLedgerConfiguration.SettingsContainer.CommonSettings.FileExists) - UserSettingsFile=[System.IO.Path]::GetFullPath($Private:NLedgerConfiguration.SettingsContainer.UserSettings.FilePath) - UserSettingsFileExists=$($Private:NLedgerConfiguration.SettingsContainer.UserSettings.FileExists) - AppSettingsFile=$private:appConfigFile - AppSettingsFileExists=$Script:AppSettingsFileExists - Settings=$Private:settings - } -} - -# Local helper function -function ReadConfig { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$configPath - ) - - $Private:settings = @{} - if (Test-Path -LiteralPath $configPath -PathType Leaf) { - [xml]$Private:config = Get-Content $configPath - if (!($Private:config.DocumentElement.Name -eq "configuration")) { throw "Unexpected root element. Only 'configuration' is expected" } - $Private:config.configuration.appSettings.GetElementsByTagName("add") | %{ $Private:settings[$_.key] = $_.value } - } - - return $Private:settings -} - -# Local helper function -function UpdateConfig { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$configPath, - [Parameter(Mandatory=$True)]$addOrUpdate, - [Parameter(Mandatory=$False)]$remove = @() - ) - - [xml]$Private:config = if (Test-Path -LiteralPath $configPath -PathType Leaf) { Get-Content $configPath } else { [xml]'' } - UpdateConfigXml -xml $Private:config -addOrUpdate $addOrUpdate -remove $remove | Out-Null - - [bool]$Private:hasAppSettings = $Private:config.SelectNodes("/configuration/appSettings/add").Count - [string]$private:folder = Split-Path -parent $configPath - - if ($Private:hasAppSettings) { - if (!(Test-Path -LiteralPath $private:folder -PathType Container)) { New-Item -ItemType Directory -Force -Path $private:folder } - $Private:config.Save($configPath) | Out-Null - } else { - Remove-Item -LiteralPath $configPath -Force - } -} - -# Local helper function -function UpdateConfigXml { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][xml]$xml, - [Parameter(Mandatory=$False)]$addOrUpdate = @{}, - [Parameter(Mandatory=$False)]$remove = @() - ) - - if (!($xml.DocumentElement.Name -eq "configuration")) { throw "Unexpected root element. Only 'configuration' is expected" } - - $Private:appSettings = ($xml.DocumentElement.GetElementsByTagName("appSettings"))[0] - if (!$Private:appSettings) { - $Private:appSettings = $xml.CreateElement("appSettings") - $xml.DocumentElement.AppendChild($Private:appSettings) | Out-Null - } - - foreach($Private:name in $addOrUpdate.Keys) { - $Private:appSetting = $Private:appSettings.GetElementsByTagName("add") | ?{$_.key -eq $Private:name} - if (!$Private:appSetting) { - $Private:appSetting = $xml.CreateElement("add") - $Private:appSettings.AppendChild($Private:appSetting) | Out-Null - } - - $Private:appSetting.SetAttribute("key", $Private:name) | Out-Null - $Private:appSetting.SetAttribute("value", $addOrUpdate[$Private:name]) | Out-Null - } - - foreach($Private:name in $remove) { - $Private:appSetting = $Private:appSettings.GetElementsByTagName("add") | ?{$_.key -eq $Private:name} - if ($Private:appSetting) { $Private:appSettings.RemoveChild($Private:appSetting) | Out-Null } - } - - return $xml -} - -<# -.SYNOPSIS - Updates a setting value in a configuration file. -.DESCRIPTION - This function physically updates a configuration file that conforms the specified scope. -.PARAMETER scope - The configuration scope (app,common,user). -.PARAMETER settingName - Setting name (case-insensitive). -.PARAMETER settingValue - Setting value. Will be validated before an update. -.NOTES - Author: Dmitry Merzlyakov - Date: June 25, 2018 -#> -function SetConfigValue { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$scope, - [Parameter(Mandatory=$True)][string]$settingName, - [Parameter(Mandatory=$True)][AllowEmptyString()][string]$settingValue - ) - - # Check scope value - if (!(@("app","common","user") -contains $scope)) { throw "Invalid scope value: $scope" } - - $private:configData = GetConfigData - $private:setting = $private:configData.Settings | ?{$_.Name -eq $settingName} - - # Check name - if (!($private:setting)) { return get-fault "Cannot find setting $settingName" } - $settingName = $private:setting.Name - - # Check value - $private:permitted = $private:setting.PossibleValues | %{ $_ } - if ($private:permitted) { - [string]$private:selectedPermitted = $private:permitted | ?{ $_ -eq $settingValue } - if (!($private:selectedPermitted)) { return get-fault "Cannot set '$settingValue' to '$settingName' setting because it is not in the range of permitted values." } - $settingValue = $private:selectedPermitted - } - - # Check availability - if (($scope -eq "app") -and !($private:setting.IsAvailableForApp)) { return get-fault "Cannot set '$settingName' setting because it is out of permitted scope." } - if (($scope -eq "common") -and !($private:setting.IsAvailableForCommon)) { return get-fault "Cannot set '$settingName' setting because it is out of permitted scope." } - if (($scope -eq "user") -and !($private:setting.IsAvailableForUser)) { return get-fault "Cannot set '$settingName' setting because it is out of permitted scope." } - - [string]$private:fileName = if($scope -eq "app") { $Private:configData.AppSettingsFile } else { if($scope -eq "common") { $Private:configData.CommonSettingsFile } else { $Private:configData.UserSettingsFile } } - [string]$private:folder = Split-Path -parent $private:fileName - if (!(Test-Path -LiteralPath $private:folder -PathType Container)) { New-Item -ItemType Directory -Force -Path $private:folder } - - # Set value - UpdateConfig -configPath $private:fileName -addOrUpdate @{ "$settingName"="$settingValue" } | Out-Null - - return get-success "Setting '$settingName' is set to '$settingValue' (Scope '$scope')" -} - -function RemoveConfigValue { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$scope, - [Parameter(Mandatory=$True)][string]$settingName - ) - - # Check scope value - if (!(@("app","common","user") -contains $scope)) { throw "Invalid scope value: $scope" } - - $private:configData = GetConfigData - $private:setting = $private:configData.Settings | ?{$_.Name -eq $settingName} - - # Check name - if (!($private:setting)) { return get-fault "Cannot find setting $settingName" } - $settingName = $private:setting.Name - - # Check availability - if (($scope -eq "app") -and !($private:setting.IsAvailableForApp)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } - if (($scope -eq "common") -and !($private:setting.IsAvailableForCommon)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } - if (($scope -eq "user") -and !($private:setting.IsAvailableForUser)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } - - [string]$private:fileName = if($scope -eq "app") { $Private:configData.AppSettingsFile } else { if($scope -eq "common") { $Private:configData.CommonSettingsFile } else { $Private:configData.UserSettingsFile } } - if (!(Test-Path -LiteralPath $private:fileName -PathType Leaf)) { return get-fault "Cannot remove setting $settingName because it is already removed" } - - # Set value - UpdateConfig -configPath $private:fileName -addOrUpdate @{} -remove @("$settingName") | Out-Null - - return get-success "Setting '$settingName' is removed (Scope '$scope')" -} - -function setAppConfigFile { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$appConfigFile - ) - - [NLedger.Utility.Settings.CascadeSettings.Sources.SystemConfigurationSettingsSource]::AppConfigFileName = $appConfigFile -} - -function SetPlatform { - [CmdletBinding()] - Param( - [Switch][bool]$preferCore = $false - ) - - [string]$private:frameworkLedger = Get-NLedgerPath - [string]$private:coreLedger = Get-NLedgerPath -preferCore - if (!($private:frameworkLedger) -and !($private:coreLedger)) {throw "No binaries found. Check that they are built"} - if ($private:frameworkLedger -eq $private:coreLedger) {$private:frameworkLedger = $null} - - [string]$Private:preferableNLedger = Get-NLedgerPath -preferCore:$preferCore - [string]$Private:preferablePath = [System.IO.Path]::GetDirectoryName($Private:preferableNLedger) - - [string]$Private:dsp = [System.IO.Path]::DirectorySeparatorChar - - $Script:IsCorePlatform = $private:coreLedger -eq $Private:preferableNLedger - $Script:AppSettingsFile = if($Script:IsCorePlatform){"$Private:preferablePath$($Private:dsp)NLedger-cli.dll.config"}else{"$Private:preferablePath$($Private:dsp)NLedger-cli.exe.config"} - $Script:AppSettingsFileExists = (Test-Path -LiteralPath $Script:AppSettingsFile -PathType Leaf) - - return get-success "Current platform is $(if($Script:IsCorePlatform){".Net Core"}else{".Net Framework"}) [App config file is $($Script:AppSettingsFile)]" -} - -function Test-NLedgerBinaryLoaded { return $Script:nledgerBinaryLoaded } - -# Module Initialization - -[bool]$Script:nledgerBinaryLoaded = $False - -if (!$Script:nledgerPath) { - Write-Verbose "NLedger path is not specified; calling Get-NLedgerPath..." - $private:path = Get-NLedgerPath - if (!$private:path) { - Write-Verbose "NLedger binaries not found; NLSetup functionality is limited" - return - } - $Script:nledgerPath = [System.IO.Path]::GetDirectoryName($private:path) -} - -Write-Verbose "NLedger path is $Script:nledgerPath" - -Write-Verbose "Loading NLedger binaries..." -$Script:NLedgerAssembly = [System.Reflection.Assembly]::LoadFrom("$Script:nledgerPath\NLedger.dll") - -if (!$Script:NLedgerAssembly) { - Write-Verbose "Cannot load NLedger binaries; NLSetup functionality is limited" - return -} -$Script:nledgerBinaryLoaded = $true - -Write-Verbose "Looking for NLedger configuration class" -$Script:NLedgerConfigurationType = $Script:NLedgerAssembly.GetType("NLedger.Utility.Settings.NLedgerConfiguration") -if (!$Script:NLedgerConfigurationType) { throw "Class NLedger.Utility.Settings.NLedgerConfiguration not found." } -$Script:StringSettingDefinitionType = $Script:NLedgerAssembly.GetType("NLedger.Utility.Settings.CascadeSettings.Definitions.StringSettingDefinition") -if (!$Script:StringSettingDefinitionType) { throw "Class NLedger.Utility.Settings.CascadeSettings.Definitions.StringSettingDefinition not found." } - -$Script:IsCorePlatform = $false -$Script:AppSettingsFile = $null -$Script:AppSettingsFileExists = $null -$null = SetPlatform - +<# +.SYNOPSIS +NLedger configuration settings management + +.DESCRIPTION +Provides helper functions that allow to read and update NLedger config settings + +.NOTES +Author: Dmitry Merzlyakov +Date: December 14, 2023 +#> + +[CmdletBinding()] +Param() + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path +Import-Module $Script:ScriptPath/SysCommon.psm1 +Import-Module $Script:ScriptPath/NLedgerEnvironment.psm1 + +$Global:ConfigDataExtensions = @{} + + +<# +.SYNOPSIS + Returns configuration container. +.DESCRIPTION + This function calls NLedger.CLI binaries to build a configuration container. + The container contains complete descriptive information about all settings + and current values. +.NOTES + Author: Dmitry Merzlyakov + Date: June 25, 2018 +#> +function Get-NLedgerConfigData { + [CmdletBinding()] + Param([Parameter()][string]$nledgerPath) + + if (!(Test-NLedgerAssemblyLoaded)) { throw "NLedger binaries not loaded. GetConfigData is not available."} + $appConfigName = Set-NLedgerAppConfigFile $(if($nledgerPath){$nledgerPath}else{(Get-NLedgerDeploymentInfo).PreferredNLedgerExecutableInfo.NLedgerExecutable}) + + $private:extensionIndex = @{} + $private:definitions = New-Object "System.Collections.Generic.List[NLedger.Utility.Settings.CascadeSettings.ISettingDefinition]" + + foreach($private:extension in $Global:ConfigDataExtensions.Values) { + foreach($private:setting in $private:extension.Settings) { + $private:def = New-Object $Script:StringSettingDefinitionType -ArgumentList @($private:setting.Name,$private:setting.Description,$private:setting.Default) + $private:definitions.Add($private:def) | Out-Null + $private:extensionIndex[$private:def] = $private:extension.Category + } + } + + $Private:NLedgerConfiguration = New-Object $Script:NLedgerConfigurationType @(,$private:definitions) | Assert-IsNotEmpty "Cannot create $Script:NLedgerConfigurationType" + + $Private:settings = @() + foreach($Private:definition in $Private:NLedgerConfiguration.Definitions) { + $private:valDefaultValue = $Private:definition.DefaultValue + $private:valAppSettings = $Private:NLedgerConfiguration.SettingsContainer.AppSettings.GetValue($Private:definition.Name) + $private:valCommonSettings = $Private:NLedgerConfiguration.SettingsContainer.CommonSettings.GetValue($Private:definition.Name) + $private:valUserSettings = $Private:NLedgerConfiguration.SettingsContainer.UserSettings.GetValue($Private:definition.Name) + $private:valVarSettings = $Private:NLedgerConfiguration.SettingsContainer.VarSettings.GetValue($Private:definition.Name) + $private:valEffectiveValue = $Private:NLedgerConfiguration.SettingsContainer.GetEffectiveValue($Private:definition.Name) + + $private:isIndexed = $private:extensionIndex.ContainsKey($Private:definition) + $private:category = if($private:isIndexed){$private:extensionIndex[$Private:definition]}else{".Net Ledger Application Settings"} + + $Private:settings += [PsCustomObject]@{ + Name=$Private:definition.Name + Category=$private:category + Description=$Private:definition.Description + SettingType=$Private:definition.SettingType.Name + PossibleValues=$Private:definition.GetValues() + + DefaultValue=[string]$private:valDefaultValue + HasDefaultValue=[bool]$private:valDefaultValue + + AppSettingValue=[string]$private:valAppSettings + HasAppSettingValue=[bool]$private:valAppSettings + IsAvailableForApp=(!$private:isIndexed) + + CommonSettingValue=[string]$private:valCommonSettings + HasCommonSettingValue=[bool]$private:valCommonSettings + IsAvailableForCommon=$Private:definition.Scope -eq "user" + + UserSettingValue=[string]$private:valUserSettings + HasUserSettingValue=[bool]$private:valUserSettings + IsAvailableForUser=$Private:definition.Scope -eq "user" + + EnvironmentSettingValue=[string]$private:valVarSettings + HasEnvironmentSettingValue=[bool]$private:valVarSettings + IsAvailableForEnv=(!$private:isIndexed) + + EffectiveSettingValue=[string]$private:valEffectiveValue + HasEffectiveSettingValue=[bool]$private:valEffectiveValue + } + } + + return [PsCustomObject]@{ + CommonSettingsFile=[System.IO.Path]::GetFullPath($Private:NLedgerConfiguration.SettingsContainer.CommonSettings.FilePath) + CommonSettingsFileExists=$($Private:NLedgerConfiguration.SettingsContainer.CommonSettings.FileExists) + UserSettingsFile=[System.IO.Path]::GetFullPath($Private:NLedgerConfiguration.SettingsContainer.UserSettings.FilePath) + UserSettingsFileExists=$($Private:NLedgerConfiguration.SettingsContainer.UserSettings.FileExists) + AppSettingsFile=$appConfigName + AppSettingsFileExists=[bool]$appConfigName + Settings=$Private:settings + } +} + +function Update-NLedgerConfigXml { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][xml]$xml, + [Parameter(Mandatory=$False)][hashtable]$addOrUpdate = @{}, + [Parameter(Mandatory=$False)]$remove = @() + ) + + if (!($xml.DocumentElement.Name -eq "configuration")) { throw "Unexpected root element. Only 'configuration' is expected" } + + $Private:appSettings = ($xml.DocumentElement.GetElementsByTagName("appSettings"))[0] + if (!$Private:appSettings) { + $Private:appSettings = $xml.CreateElement("appSettings") + $xml.DocumentElement.AppendChild($Private:appSettings) | Out-Null + } + + foreach($Private:name in $addOrUpdate.Keys) { + $Private:appSetting = $Private:appSettings.GetElementsByTagName("add") | ?{$_.key -eq $Private:name} + if (!$Private:appSetting) { + $Private:appSetting = $xml.CreateElement("add") + $Private:appSettings.AppendChild($Private:appSetting) | Out-Null + } + + $Private:appSetting.SetAttribute("key", $Private:name) | Out-Null + $Private:appSetting.SetAttribute("value", $addOrUpdate[$Private:name]) | Out-Null + } + + foreach($Private:name in $remove) { + $Private:appSetting = $Private:appSettings.GetElementsByTagName("add") | ?{$_.key -eq $Private:name} + if ($Private:appSetting) { $Private:appSettings.RemoveChild($Private:appSetting) | Out-Null } + } + + return $xml +} + +function Update-NLedgerConfigFile { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][string]$configPath, + [Parameter(Mandatory=$True)][hashtable]$addOrUpdate, + [Parameter(Mandatory=$False)]$remove = @() + ) + + [xml]$Private:config = if (Test-Path -LiteralPath $configPath -PathType Leaf) { Get-Content $configPath } else { [xml]'' } + $null = Update-NLedgerConfigXml -xml $Private:config -addOrUpdate $addOrUpdate -remove $remove + + [bool]$Private:hasAppSettings = $Private:config.SelectNodes("/configuration/appSettings/add").Count + [string]$private:folder = Split-Path -parent $configPath + + if ($Private:hasAppSettings) { + if (!(Test-Path -LiteralPath $private:folder -PathType Container)) { $null = New-Item -ItemType Directory -Force -Path $private:folder } + $null = $Private:config.Save($configPath) + } else { + $null = Remove-Item -LiteralPath $configPath -Force + } +} + +<# +.SYNOPSIS + Updates a setting value in a configuration file. +.DESCRIPTION + This function physically updates a configuration file that conforms the specified scope. +.PARAMETER scope + The configuration scope (app,common,user). +.PARAMETER settingName + Setting name (case-insensitive). +.PARAMETER settingValue + Setting value. Will be validated before an update. +.NOTES + Author: Dmitry Merzlyakov + Date: June 25, 2018 +#> +function Set-NLedgerConfigValue { + [CmdletBinding()] + Param( + [Parameter(Mandatory)][ValidateSet("app","common","user",IgnoreCase=$true)][string]$scope, + [Parameter(Mandatory)][string]$settingName, + [Parameter(Mandatory)][AllowEmptyString()][string]$settingValue + ) + + $private:configData = Get-NLedgerConfigData + $private:setting = $private:configData.Settings | Where-Object{$_.Name -eq $settingName} | Assert-IsNotEmpty "Cannot find setting $settingName" + $settingName = $private:setting.Name + + # Check value + $private:permitted = $private:setting.PossibleValues | ForEach-Object{ $_ } + if ($private:permitted) { + [string]$private:selectedPermitted = $private:permitted | Where-Object{ $_ -eq $settingValue } | Assert-IsNotEmpty "Cannot set '$settingValue' to '$settingName' setting because it is not in the range of permitted values." + $settingValue = $private:selectedPermitted + } + + # Check availability + if (($scope -eq "app") -and !($private:setting.IsAvailableForApp)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } + if (($scope -eq "common") -and !($private:setting.IsAvailableForCommon)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } + if (($scope -eq "user") -and !($private:setting.IsAvailableForUser)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } + + [string]$private:fileName = if($scope -eq "app") { $Private:configData.AppSettingsFile } else { if($scope -eq "common") { $Private:configData.CommonSettingsFile } else { $Private:configData.UserSettingsFile } } + [string]$private:folder = Split-Path -parent $private:fileName + if (!(Test-Path -LiteralPath $private:folder -PathType Container)) { $null = New-Item -ItemType Directory -Force -Path $private:folder } + + # Set value + $null = Update-NLedgerConfigFile -configPath $private:fileName -addOrUpdate @{ "$settingName"="$settingValue" } + + [PSCustomObject]@{ + Status = "Updated" + Setting = $settingName + Value = $settingValue + Scope = $scope + } +} + +function Remove-NLedgerConfigValue { + [CmdletBinding()] + Param( + [Parameter(Mandatory)][ValidateSet("app","common","user",IgnoreCase=$true)][string]$scope, + [Parameter(Mandatory)][string]$settingName + ) + + $private:configData = Get-NLedgerConfigData + $private:setting = $private:configData.Settings | Where-Object{$_.Name -eq $settingName} | Assert-IsNotEmpty "Cannot find setting $settingName" + $settingName = $private:setting.Name + + # Check availability + if (($scope -eq "app") -and !($private:setting.IsAvailableForApp)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } + if (($scope -eq "common") -and !($private:setting.IsAvailableForCommon)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } + if (($scope -eq "user") -and !($private:setting.IsAvailableForUser)) { throw "Cannot set '$settingName' setting because it is out of permitted scope." } + + [string]$private:fileName = if($scope -eq "app") { $Private:configData.AppSettingsFile } else { if($scope -eq "common") { $Private:configData.CommonSettingsFile } else { $Private:configData.UserSettingsFile } } + if (!(Test-Path -LiteralPath $private:fileName -PathType Leaf)) { throw "Cannot remove setting $settingName because it is already removed" } + + # Set value + $null = Update-NLedgerConfigFile -configPath $private:fileName -addOrUpdate @{} -remove @("$settingName") + + [PSCustomObject]@{ + Status = "Removed" + Setting = $settingName + Scope = $scope + } +} + + +function Set-NLedgerAppConfigFile { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$nledgerPath) + + if (!(Test-Path -LiteralPath $nledgerPath -PathType Leaf)) { return } + + $path = [System.IO.Path]::GetDirectoryName($nledgerPath) + $appConfig = [System.IO.Path]::GetFullPath("$path/NLedger-cli.dll.config") + if (!(Test-Path -LiteralPath $appConfig -PathType Leaf)) { $appConfig = [System.IO.Path]::GetFullPath("$path/NLedger-cli.exe.config") } + if (!(Test-Path -LiteralPath $appConfig -PathType Leaf)) { return } + + Write-Verbose "Use app.config file: $appConfig" + [NLedger.Utility.Settings.CascadeSettings.Sources.SystemConfigurationSettingsSource]::AppConfigFileName = $appConfig + $appConfig +} + +function Get-NLedgerAssemblyType { + [CmdletBinding()] + Param([Parameter()][string]$typeName) + + ($Script:nledgerAssembly | Assert-IsNotEmpty "NLedger assembly is not loaded").GetType($typeName) | Assert-IsNotEmpty "Class $typeName not found." +} + +# Lazy initialization +$Script:isNLedgerConfigModuleInitialized = $false + +function Initialize-NLedgerConfigModule { + [CmdletBinding()] + Param() + + if (!$Script:nledgerAssembly -and !$Script:isNLedgerConfigModuleInitialized) + { + [string]$Script:nledgerAssemblyName = (Get-NLedgerDeploymentInfo).NLedgerStandardAssembly | Select-Object -Last 1 + Write-Verbose "Loading NLedger assembly ($Script:nledgerAssemblyName) for config management" + + if ($Script:nledgerAssemblyName) { $Script:nledgerAssembly = [System.Reflection.Assembly]::LoadFrom($Script:nledgerAssemblyName) } + + if (!$Script:nledgerAssembly) { + Write-Verbose "Cannot load NLedger assembly; config management functionality is limited" + return + } + + Write-Verbose "Looking for NLedger configuration class" + $Script:NLedgerConfigurationType = Get-NLedgerAssemblyType "NLedger.Utility.Settings.NLedgerConfiguration" + $Script:StringSettingDefinitionType = Get-NLedgerAssemblyType "NLedger.Utility.Settings.CascadeSettings.Definitions.StringSettingDefinition" + + $Script:isNLedgerConfigModuleInitialized = $true + } +} + +function Test-NLedgerAssemblyLoaded { + [CmdletBinding()] + Param() + + $null = Initialize-NLedgerConfigModule + [bool]$Script:nledgerAssembly +} diff --git a/Contrib/Common/NLedgerEnvironment.psm1 b/Contrib/Common/NLedgerEnvironment.psm1 new file mode 100644 index 00000000..bb31148a --- /dev/null +++ b/Contrib/Common/NLedgerEnvironment.psm1 @@ -0,0 +1,327 @@ +<# +.SYNOPSIS +Helper functions for interacting with the NLedger binaries + +.DESCRIPTION +Provides information about the current structure of NLedger deployment + +.NOTES +Author: Dmitry Merzlyakov +Date: December 14, 2023 +#> + +[CmdletBinding()] +Param() + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path +Import-Module $Script:ScriptPath/SysConsole.psm1 +Import-Module $Script:ScriptPath/SysPlatform.psm1 +Import-Module $Script:ScriptPath/SysDotnet.psm1 +Import-Module $Script:ScriptPath/SysCommon.psm1 + +<# +.SYNOPSIS + Returns a fully qualified path and name to NLedger executable file +.DESCRIPTION + Checks whether given folder contains NLedger executable file and returns a full path and name. + It works on any OS (Windows, Linux, OSX) so it either returns NLedger-cli.exe or NLedger-cli. + If folder or file does not exist, it returns an empty value. +#> +function Get-NLedgerExecutableFile { + [CmdletBinding()] + Param( + [Parameter(Mandatory)][string]$folderName, + [Switch][bool]$link + ) + + $folderName = [System.IO.Path]::GetFullPath($folderName) + $fileName = if($link){"ledger"}else{"NLedger-cli"} + if (Test-Path -LiteralPath $folderName -PathType Container) { + [string]$nledgerFile = [System.IO.Path]::GetFullPath("$folderName/$fileName.exe") + if (Test-Path -LiteralPath $nledgerFile -PathType Leaf) { $nledgerFile } + else { + $nledgerFile = [System.IO.Path]::GetFullPath("$tfmFolder/$fileName") + if (Test-Path -LiteralPath $nledgerFile -PathType Leaf) { $nledgerFile } + } + } +} + +<# +.SYNOPSIS + Returns a collection of NLedger binaries found in a package folder. +.DESCRIPTION + Looks for NLedger binaries in all sub-folders of a given folder. + Sub-folders should match TFM names or ignored otherwise. + Returns a collection of objects containing a full path, TFM code and other flags. + Note: isDebug is a declarative flag indicating wether folder contains Release or Debug binaries. +#> +function Find-NLedgerBinaries { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][string]$folderName, + [Parameter(Mandatory=$True)][bool]$isDebug + ) + + if (Test-Path -LiteralPath $folderName -PathType Container) { + Write-Verbose "Find-NLedgerBinaries - collecting info from $folderName folder." + foreach($targetFolder in (Get-ChildItem -LiteralPath $folderName -Directory) | Where-Object { Test-IsTfmCode $_.Name }) { + [string]$tfmCode = $targetFolder.Name + [string]$tfmFolder = $targetFolder.FullName + [bool]$isOsxRuntime = $false + + if (Test-Path -LiteralPath "$tfmFolder/osx-x64" -PathType Container) { + $tfmFolder = "$tfmFolder/osx-x64" + $isOsxRuntime = $true + } + + [string]$nledgerFile = Get-NLedgerExecutableFile $tfmFolder + if (!$nledgerFile) { continue } + [string]$nledgerLink = Get-NLedgerExecutableFile $tfmFolder -link + + Write-Verbose "Found executable NLedger: $nledgerFile (TFM: $tfmCode; Debug: $isDebug; OSX: $isOsxRuntime)" + [PSCustomObject]@{ + NLedgerExecutable = $nledgerFile + NLedgerLink = $nledgerLink + Path = [System.IO.Path]::GetDirectoryName($nledgerFile) + TfmCode = $tfmCode + IsDebug = $isDebug + IsOsxRuntime = $isOsxRuntime + } + } + } else { + Write-Verbose "Find-NLedgerBinaries - folder $folderName does not exist." + } +} + +<# +.SYNOPSIS + Returns a collection of all available NLedger binaries located in the current deployment structure. +.DESCRIPTION + Looks for NLedger binaries in expected locations in the current deployment structure (where the script is located). + It properly recognizes development structures (and looks for binaries in Source/NLedger.CLI/bin folder) + or deployment packages (with /bin/ folder). +#> +function Find-CurrentNLedgerBinaries { + [CmdletBinding()] + Param() + + [string]$devDebugBin = [System.IO.Path]::GetFullPath("$Script:ScriptPath/../../Source/NLedger.CLI/bin/Debug") + [string]$devReleaseBin = [System.IO.Path]::GetFullPath("$Script:ScriptPath/../../Source/NLedger.CLI/bin/Release") + [string]$publicBin = [System.IO.Path]::GetFullPath("$Script:ScriptPath/../bin") + + return @() + + (Find-NLedgerBinaries -folderName $devDebugBin -isDebug $true) + + (Find-NLedgerBinaries -folderName $devReleaseBin -isDebug $false) + + (Find-NLedgerBinaries -folderName $publicBin -isDebug $false) +} + +function Find-CurrentNLedgerStandardAssembly { + [CmdletBinding()] + Param() + + $paths = @("$Script:ScriptPath/../../Source/NLedger/bin/Debug/netstandard2.0", "$Script:ScriptPath/../../Source/NLedger/bin/Release/netstandard2.0", "$Script:ScriptPath/../bin/netstandard2.0") + $paths | ForEach-Object { [System.IO.Path]::GetFullPath("$_/NLedger.dll") } | Where-Object { Test-Path -LiteralPath $_ -PathType Leaf } +} + +<# +.SYNOPSIS + Returns a collection of all installed NLedger binaries on the current machine. +.DESCRIPTION + NLedger is considered to be installed if it is available by PATH variable. + This function returns all NLedger binary files found by any path listed in PATH variable. + Of course, only the first path is effective. +#> +function Find-InstalledNLedgerBinaries { + [CmdletBinding()] + Param() + + Get-Paths | ForEach-Object { Get-NLedgerExecutableFile $_ } | Where-Object { $_ } +} + +function Get-NLedgerDeploymentInfo { + [CmdletBinding()] + Param() + + $runtimes = Get-AllRuntimeTargets + + $binaries = Find-CurrentNLedgerBinaries + + $installed = Find-InstalledNLedgerBinaries + [string]$effectiveInstalled = $installed | Select-Object -First 1 + + $infos = $binaries | ForEach-Object { + $bin = $_ + [PSCustomObject]@{ + NLedgerExecutable = $bin.NLedgerExecutable + NLedgerLink = $bin.NLedgerLink + Path = [System.IO.Path]::GetDirectoryName($bin.NLedgerExecutable) + TfmCode = $bin.TfmCode + IsDebug = $bin.IsDebug + IsOsxRuntime = $bin.IsOsxRuntime + IsInstalled = [bool]($bin.NLedgerExecutable -eq $effectiveInstalled) + HasRuntime = ($runtimes | Where-Object { Test-IsRuntimeCompatible -binaryTfmCode $bin.TfmCode -runtimeTfmCode $_ } | Measure-Object).Count -gt 0 + ExpandedTfmCode = Expand-TfmCode $bin.TfmCode + } + } | Sort-Object { [string]::Format("{0}.{1}.{2:00}.{3:00}.{4:00}", [int]!$_.IsDebug, [int]!$_.ExpandedTfmCode.IsFramework, $_.ExpandedTfmCode.Version.Major, $_.ExpandedTfmCode.Version.Minor, $_.ExpandedTfmCode.Version.Build ) } + + $effectiveInstalledInfo = $infos | Where-Object { $_.IsInstalled } + [bool]$isExternalInstall = $effectiveInstalled -and (!$effectiveInstalledInfo) + + $preferredNLedgerExecutableInfo = if($effectiveInstalledInfo) { $effectiveInstalledInfo } + else { $infos | Where-Object { $_.HasRuntime } | Select-Object -Last 1 } + + [PSCustomObject]@{ + Binaries = $binaries + Installed = $installed + EffectiveInstalled = $effectiveInstalled + EffectiveInstalledInfo = $effectiveInstalledInfo + IsExternalInstall = $isExternalInstall + Runtimes = $runtimes + Infos = $infos + PreferredNLedgerExecutableInfo = $preferredNLedgerExecutableInfo + NLedgerStandardAssembly = (Find-CurrentNLedgerStandardAssembly) + } + +} + +function Select-NLedgerDeploymentInfos { + [CmdletBinding()] + Param( + [Parameter(Mandatory)]$deploymentInfo, + [Parameter(Mandatory)][string]$tfmCodes, + [Parameter(Mandatory)][bool]$isDebug + ) + + $codes = $tfmCodes -split ";" + $deploymentInfo.Infos | Where-Object { $codes -contains $_.TfmCode -and $_.IsDebug -eq $isDebug } +} + +function Select-NLedgerDeploymentInfo { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)]$deploymentInfo, + [Parameter(Mandatory=$True)][string]$tfmCode, + [Parameter(Mandatory=$True)][bool]$isDebug + ) + + $deploymentInfo.Infos | Where-Object { $_.TfmCode -eq $tfmCode -and $_.IsDebug -eq $isDebug } | Select-Object -First 1 +} + +function Select-NLedgerExecutableInfo { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)]$deploymentInfo, + [Parameter(Mandatory=$True)][string]$tfmCode, + [Parameter(Mandatory=$True)][bool]$isDebug + ) + + $deploymentInfo.Binaries | Where-Object { $_.TfmCode -eq $tfmCode -and $_.IsDebug -eq $isDebug } | Select-Object -First 1 +} + +function Select-NLedgerPreferrableInfo { + Param( + [Parameter()][string]$tfmCode, + [Parameter()][ValidateSet("debug","release","",IgnoreCase=$true)][string]$profile, + [Parameter(ValueFromPipeline)]$deploymentInfo + ) + + Process { + if (!$tfmCode -and $profile) { throw "Invalid arguments: profile can be specified only when tfmCode is specified also."} + + if ($tfmCode) { + $isDebug = $profile -eq "debug" + Select-NLedgerDeploymentInfo $deploymentInfo $tfmCode $isDebug | Assert-IsNotEmpty "NLedger binaries for $(Out-TfmProfile $tfmCode $isDebug) are not found." + } else { + $deploymentInfo.PreferredNLedgerExecutableInfo | Assert-IsNotEmpty "No available binaries for installation." + } + } +} + +function Out-TfmProfile{ + [CmdletBinding()] + Param( + [Parameter(Mandatory)][string]$tfmCode, + [Parameter(Mandatory)][bool]$isDebug + ) + "$tfmCode ($(if($isDebug){"Debug"}else{"Release"}))" +} + +function Get-LinkNameFromFile{ + [CmdletBinding()] + Param([Parameter(Mandatory)][string]$nledgerExecutable) + + $path = [System.IO.Path]::GetDirectoryName($nledgerExecutable) + $name = [System.IO.Path]::GetFileName($nledgerExecutable) + + [System.IO.Path]::GetFullPath("$path/$($name.Replace("NLedger-cli", "ledger"))") +} + +function Install-NLedgerExecutable { + [CmdletBinding()] + Param( + [Parameter(Mandatory)][string]$tfmCode, + [Parameter(Mandatory)][bool]$isDebug, + [switch]$link + ) + + $deploymentInfo = Get-NLedgerDeploymentInfo + if($deploymentInfo.EffectiveInstalled) {throw "NLedger is already installed: ($($deploymentInfo.EffectiveInstalled))"} + + $info = Select-NLedgerExecutableInfo $deploymentInfo $tfmCode $isDebug + if (!$info) {throw "NLedger binaries for $(Out-TfmProfile $tfmCode $isDebug) are not found."} + + Write-Verbose "Installing NLedger; adding to PATH: $($info.Path)" + $null = Add-Path $info.Path + + if($link -and !($info.NLedgerLink)) { + $linkName = Get-LinkNameFromFile $info.NLedgerExecutable + Write-Verbose "Adding hard link $linkName" + $null = Add-HardLink -linkPath $linkName -filePath $info.NLedgerExecutable + } + + if ((Test-IsFrameworkTfmCode $info.TfmCode) -and (Test-CanCallNGen)) { + Write-Verbose "Adding NGen native image (if possible) $($info.NLedgerExecutable)" + $null = Add-NGenImage $info.NLedgerExecutable + } + + [PSCustomObject]@{ + Path = $info.Path + NLedgerExecutable = $info.NLedgerExecutable + NLedgerLink = $linkName + } +} + +function Uninstall-NLedgerExecutable { + [CmdletBinding()] + Param([switch]$link) + + Write-Verbose "Uninstalling NLedger" + $deploymentInfo = Get-NLedgerDeploymentInfo + + foreach($nledgerPath in Find-InstalledNLedgerBinaries ) { + $info = $deploymentInfo.Infos | Where-Object { $_.NLedgerExecutable -eq $nledgerPath } | Select-Object -First 1 + if ($info) { + Write-Verbose "Uninstalling NLedger found by path $($info.NLedgerExecutable)" + + if ($link -and $info.NLedgerLink) { + Write-Verbose "Removing hard link $($info.NLedgerLink)" + $null = Remove-HardLink $info.NLedgerLink + } + + if ((Test-IsFrameworkTfmCode $info.TfmCode) -and (Test-CanCallNGen)) { + Write-Verbose "Removing NGen native image (if presented) $($info.NLedgerExecutable)" + $null = Remove-NGenImage $info.NLedgerExecutable + } + + Write-Verbose "Removing from PATH" + $null = Remove-Path $info.Path + + Write-Verbose "NLedger located by this path is uninstalled" + } else { + Write-Warning "NLedger installed by path $($info.NLedgerExecutable) does not belong to the current deployment and cannot be uninstalled. Check PATH variable if it is not expected." + } + } + +} + +Export-ModuleMember -function * -alias * \ No newline at end of file diff --git a/Contrib/Common/SysCommon.psm1 b/Contrib/Common/SysCommon.psm1 new file mode 100644 index 00000000..f94c9373 --- /dev/null +++ b/Contrib/Common/SysCommon.psm1 @@ -0,0 +1,93 @@ +<# +.SYNOPSIS +SysCommon.psm1 - a module containing common auxiliary procedures. + +.NOTES +Author: Dmitry Merzlyakov +Date: December 14, 2023 +#> + +[CmdletBinding()] +Param() + +<# +.SYNOPSIS +Ensures that the pipeline output is not empty + +.DESCRIPTION +Allows you to build a pipeline with checkpoints that verify that +previous steps have produced at least one output of the pipeline. +If it detects that the output is empty, an exception is thrown. + +.PARAMETER errorMessage +An optional error message to throw if the pipeline output is empty. +If this parameter is omitted, the error message "Expected a non-empty value" will appear. + +.PARAMETER val +Pipeline input + +.EXAMPLE +Get-Process | Where-Object { $_.ProcessName -eq "ACME" } | Assert-IsNotEmpty -errorMessage "ACME process not found" + +Ensures that a process named ACME is found before moving on to the next steps. +#> +function Assert-IsNotEmpty { + Param( + [Parameter()][AllowEmptyString()][string]$errorMessage = "Expected a non-empty value", + [Parameter(ValueFromPipeline)]$val + ) + + Begin { $hitCounter = 0 } + + Process { $hitCounter++ ; if (!$val) { throw $errorMessage } ; $val } + + End { if (!$hitCounter) { throw $errorMessage } } +} + +# Global variable that can contain a default failure recovering function for Assert-CommandCompleted. +# The function receives $_ parameter containing an exception object +$Global:AssertionCommandCompletedFailure = $null + +function Assert-CommandCompleted { + Param( + [Parameter(Mandatory)][scriptblock]$body, + [Parameter()][scriptblock]$failureRecovering = $Global:AssertionCommandCompletedFailure + ) + + try { . $body } + catch { + Write-Verbose $_ + if ($failureRecovering) { $failureRecovering.InvokeWithContext($null, [psvariable]::new("_", $_))[0] } + else { Write-Output "[ERROR] $($_.exception.message)" } + } + +} + +function Out-YesNo { + Param([Parameter(ValueFromPipeline)]$val) + + Process { if($val) {"Yes"} else {"No"} } +} + +function Out-MessageWhenEmpty { + Param( + [Parameter()][AllowEmptyString()][string]$message = "[None]", + [Parameter(ValueFromPipeline)]$val + ) + + Process { if($val) {$val} else {$message} } +} + +function Get-PsEscapedString { + Param([Parameter(ValueFromPipeline)][string]$str) + + Process { if($str -match "\s|'|""|``") { "'$($str -replace "'","''")'" } else {$str} } +} + +function Get-CommandExpression { + Param( + [Parameter(Mandatory)][string]$command, + [Parameter()][string[]]$commandArguments) + + "& $($command | Get-PsEscapedString) $(($commandArguments | Get-PsEscapedString) -join ' ')" +} diff --git a/Contrib/Common/SysConsole.psm1 b/Contrib/Common/SysConsole.psm1 new file mode 100644 index 00000000..d6963009 --- /dev/null +++ b/Contrib/Common/SysConsole.psm1 @@ -0,0 +1,186 @@ +<# +.SYNOPSIS +Helper functions for interacting with the console + +.DESCRIPTION +Provides the ability to output colorized text to the terminal + +.NOTES +Author: Dmitry Merzlyakov +Date: December 14, 2023 +#> + +[CmdletBinding()] +Param() + +# ANSI Terminal colorization + +[bool]$Global:ANSI_Colorization = !([System.Environment]::OSVersion.Platform -eq "Win32NT" -and [System.Environment]::OSVersion.Version.Major -lt 10) + +[string]$ESC = [char]27 +[string]$Global:NormalColor = "$($ESC)[0m" +[string]$Global:ForegroundBold = "$($ESC)[1m" +[string]$Global:ForegroundUnderline = "$($ESC)[4m" +[string]$Global:ForegroundBlink = "$($ESC)[5m" + +[string]$Global:BackgroundColorBlack = "$($ESC)[40m" +[string]$Global:BackgroundColorRed = "$($ESC)[41m" +[string]$Global:BackgroundColorGreen = "$($ESC)[42m" +[string]$Global:BackgroundColorYellow = "$($ESC)[43m" +[string]$Global:BackgroundColorBlue = "$($ESC)[44m" +[string]$Global:BackgroundColorMagenta = "$($ESC)[45m" +[string]$Global:BackgroundColorCyan = "$($ESC)[46m" +[string]$Global:BackgroundColorWhite = "$($ESC)[47m" + +[string]$Global:BackgroundColorBoldBlack = "$($ESC)[40;1m" +[string]$Global:BackgroundColorBoldRed = "$($ESC)[41;1m" +[string]$Global:BackgroundColorBoldGreen = "$($ESC)[42;1m" +[string]$Global:BackgroundColorBoldYellow = "$($ESC)[43;1m" +[string]$Global:BackgroundColorBoldBlue = "$($ESC)[44;1m" +[string]$Global:BackgroundColorBoldMagenta = "$($ESC)[45;1m" +[string]$Global:BackgroundColorBoldCyan = "$($ESC)[46;1m" +[string]$Global:BackgroundColorBoldWhite = "$($ESC)[47;1m" + +[string]$Global:ForegroundColorBlack = "$($ESC)[30m" +[string]$Global:ForegroundColorRed = "$($ESC)[31m" +[string]$Global:ForegroundColorGreen = "$($ESC)[32m" +[string]$Global:ForegroundColorYellow = "$($ESC)[33m" +[string]$Global:ForegroundColorBlue = "$($ESC)[34m" +[string]$Global:ForegroundColorMagenta = "$($ESC)[35m" +[string]$Global:ForegroundColorCyan = "$($ESC)[36m" +[string]$Global:ForegroundColorWhite = "$($ESC)[37m" + +[string]$Global:ForegroundColorBoldBlack = "$($ESC)[30;1m" +[string]$Global:ForegroundColorBoldRed = "$($ESC)[31;1m" +[string]$Global:ForegroundColorBoldGreen = "$($ESC)[32;1m" +[string]$Global:ForegroundColorBoldYellow = "$($ESC)[33;1m" +[string]$Global:ForegroundColorBoldBlue = "$($ESC)[34;1m" +[string]$Global:ForegroundColorBoldMagenta = "$($ESC)[35;1m" +[string]$Global:ForegroundColorBoldCyan = "$($ESC)[36;1m" +[string]$Global:ForegroundColorBoldWhite = "$($ESC)[37;1m" + +$Script:AnsiBackgroundColorMapping = @{ + Black = $Global:BackgroundColorBlack + DarkBlue = $Global:BackgroundColorBlue + DarkGreen = $Global:BackgroundColorGreen + DarkCyan = $Global:BackgroundColorCyan + DarkRed = $Global:BackgroundColorRed + DarkMagenta = $Global:BackgroundColorMagenta + DarkYellow = $Global:BackgroundColorYellow + Gray = $Global:BackgroundColorWhite + DarkGray = $Global:BackgroundColorBoldBlack + Blue = $Global:BackgroundColorBoldBlue + Green = $Global:BackgroundColorBoldGreen + Cyan = $Global:BackgroundColorBoldCyan + Red = $Global:BackgroundColorBoldRed + Magenta = $Global:BackgroundColorBoldMagenta + Yellow = $Global:BackgroundColorBoldYellow + White = $Global:BackgroundColorBoldWhite +} + +$Script:AnsiForegroundColorMapping = @{ + Black = $Global:ForegroundColorBlack + DarkBlue = $Global:ForegroundColorBlue + DarkGreen = $Global:ForegroundColorGreen + DarkCyan = $Global:ForegroundColorCyan + DarkRed = $Global:ForegroundColorRed + DarkMagenta = $Global:ForegroundColorMagenta + DarkYellow = $Global:ForegroundColorYellow + Gray = $Global:ForegroundColorWhite + DarkGray = $Global:ForegroundColorBoldBlack + Blue = $Global:ForegroundColorBoldBlue + Green = $Global:ForegroundColorBoldGreen + Cyan = $Global:ForegroundColorBoldCyan + Red = $Global:ForegroundColorBoldRed + Magenta = $Global:ForegroundColorBoldMagenta + Yellow = $Global:ForegroundColorBoldYellow + White = $Global:ForegroundColorBoldWhite +} + +$Script:AnsiFormatColorMapping = @{ + Normal = $Global:NormalColor + Bold = $Global:ForegroundBold + Underline = $Global:ForegroundUnderline + Blink = $Global:ForegroundBlink +} + +$Script:AnsiColorMapping = @{ + b = $Script:AnsiBackgroundColorMapping + c = $Script:AnsiForegroundColorMapping + f = $Script:AnsiFormatColorMapping +} + +<# +.SYNOPSIS + Replaces color tokens in the input text with ANSI escape code +.DESCRIPTION + Console output can be colorized by adding ANSI escape codes into the output text. + Adding control codes directly to text can be tricky; easier to interact with mnemonic color names. + This function converts specially formatted tokens to escape code so you can colorize your text in an easy way. + + The token format is {action:color} where action is a letter 'b', 'c' or 'f': + - 'b' means Background color (possible color values are Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, + DarkMagenta, DarkYellow, Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White) + - 'c' means Foreground color (possible color values as above) + - 'f' means Format and can be specified as Normal, Bold, Underline, Blink + + The output string contains corresponded ANSI escape code and ready for output to the terminal. + + The colorization can be globally disabled by setting a variable $Global:ANSI_Colorization to $False. + This variable is $True by default except Windows OS older than version 10 (where support of ANSI code is limited). +.PARAMETER inputString + The input string containing color tokens. +.EXAMPLE + Convert-ColorTokensToAnsi "{c:Green}Colored{f:Normal} text" + Prints Colored word highlighted Green +.EXAMPLE + Convert-ColorTokensToAnsi "plan text" + Prints a plain text without colorization +.NOTES + It is recommended to reset the colorization at the end of the text using {f:Normal} token. + This will restore the original background and foreground terminal colors, so further output will match the original color schema. +#> +function Convert-ColorTokensToAnsi { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][AllowEmptyString()][string]$inputString + ) + + $private:foundMatches = @((Select-String -InputObject $inputString '{(?c|b|f):(?\w+)}' -AllMatches).Matches) + [array]::Reverse($private:foundMatches) + foreach($private:match in $private:foundMatches) { + if ($private:match.Groups) { + [string]$private:type = $private:match.Groups[1].Value + [string]$private:color = $private:match.Groups[2].Value + [int]$private:pos = $private:match.Groups[0].Index + [int]$private:length = $private:match.Groups[0].Length + + if ($Global:ANSI_Colorization) { + $Private:mapping = $Script:AnsiColorMapping[$private:type] + $Private:ansiCode = $Private:mapping[$private:color] + if (!($Private:ansiCode)) { throw "Invalid color in token: $($Private:color)" } + } else { $Private:ansiCode = "" } + + $inputString = $inputString.Remove($private:pos, $private:length) + $inputString = $inputString.Insert($private:pos, $Private:ansiCode) + } + } + + return $inputString +} + +<# +.SYNOPSIS + Replaces color tokens in the pipeline with ANSI escape code +.DESCRIPTION + Functionally equal to Convert-ColorTokensToAnsi but can be easily used in pipelines. + You can colorize the output just by adding it after your text and a pipe. +.EXAMPLE + "{c:Green}Colored{f:Normal} text" | Out-AnsiString + Prints Colored word highlighted Green +#> +function Out-AnsiString { + Process { Convert-ColorTokensToAnsi $_ } +} + +Export-ModuleMember -function * -alias * \ No newline at end of file diff --git a/Contrib/Common/SysDotnet.psm1 b/Contrib/Common/SysDotnet.psm1 new file mode 100644 index 00000000..170e0740 --- /dev/null +++ b/Contrib/Common/SysDotnet.psm1 @@ -0,0 +1,229 @@ +<# +.SYNOPSIS +Helper functions for interacting with Dotnet features + +.DESCRIPTION +Provides access to .Net Framework and Net/NetCore environmental information + +.NOTES +Author: Dmitry Merzlyakov +Date: December 14, 2023 +#> + +[CmdletBinding()] +Param() + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path +Import-Module $Script:ScriptPath/SysPlatform.psm1 + +<# +.SYNOPSIS + Returns a list of installed .Net Framework SDKs as a collection of version numbers +.DESCRIPTION + This function finds information about installed .Net Framework SDKs by checking the content of the folder + %ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\.NETFramework\ + It returns an empty output for non-Windows machines. +#> +function Get-NetFrameworkSDKs { + [CmdletBinding()] + Param() + + if (Get-SpecialFolderProgramFilesX86) { + (Get-ChildItem -Path "$(Get-SpecialFolderProgramFilesX86)/Reference Assemblies/Microsoft/Framework/.NETFramework" -Directory) | + Where-Object { $_ -match "v\d+.\d+(.\d+)?" } | + ForEach-Object { [version]($_ | Select-String -Pattern "\d+.\d+(.\d+)?").Matches.Value } + } +} + +<# +.SYNOPSIS + Returns available .Net Framework SDK targets on the current machine as a list of TFM codes +.DESCRIPTION + Transforms a collection of installed .Net Framework SDKs into a list of TFM codes +#> +function Get-NetFrameworkSdkTargets { + [CmdletBinding()] + Param() + + (Get-NetFrameworkSDKs) | ForEach-Object { if($_.Build -eq -1) {"net$($_.Major)$($_.Minor)"} else {"net$($_.Major)$($_.Minor)$($_.Build)"} } +} + +<# +.SYNOPSIS + Returns a version of currently installed .Net Framework +.DESCRIPTION + Returns a TFM code that corresponds to the installed .Net Framework on the current machine. + If .Net Framework is not installed (or if it is not available on non-Windows OS), the function returns an empty result. +#> +function Get-NetFrameworkRuntimeTarget { + [CmdletBinding()] + Param() + + if (Test-IsWindows) { + [int]$release = Get-ItemPropertyValue -LiteralPath 'HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release + if ($release -ge 533320) { return "net481" } + if ($release -ge 528040) { return "net48" } + if ($release -ge 461808) { return "net472" } + if ($release -ge 461308) { return "net471" } + if ($release -ge 460798) { return "net47" } + if ($release -ge 394802) { return "net462" } + if ($release -ge 394254) { return "net461" } + if ($release -ge 393295) { return "net46" } + if ($release -ge 379893) { return "net452" } + if ($release -ge 378675) { return "net451" } + if ($release -ge 378389) { return "net45" } + } +} + +<# +.SYNOPSIS + Determines whether dotnet is installed on the current machine. +.DESCRIPTION + Returns True if "dotnet" command is available on the current machine. +#> +function Test-IsDotnetInstalled { + [CmdletBinding()] + Param() + + [bool]-not(-not($(get-command dotnet -ErrorAction SilentlyContinue))) +} + +<# +.SYNOPSIS + Determines currently installed dotnet SDKs +.DESCRIPTION + Returns a list of versions that includes all installed SDK returned by the command "dotnet --list-sdks" +#> +function Get-DotnetSdks { + [CmdletBinding()] + Param() + + $(dotnet --list-sdks) | ForEach-Object { [version]($_ | Select-String -Pattern "^\d+\.\d+\.\d+").Matches.Value } +} + +<# +.SYNOPSIS + Determines currently installed dotnet runtime versions +.DESCRIPTION + Returns the list of versions of every installed dotnet runtime +#> +function Get-DotnetRuntimes { + [CmdletBinding()] + Param() + + $(dotnet --list-runtimes) | ForEach-Object { $g = ($_ | Select-String -Pattern "^(\w+\.\w+\.\w+)\s(\d+\.\d+\.\d+)").Matches.Groups; [PSCustomObject]@{Name = $g[1].Value;Version = [version]$g[2].Value} } +} + +<# +.SYNOPSIS + Provides available dotnet build targets +.DESCRIPTION + Returns the list of build targets (TFM codes) that correspond to the list of installed dotnet SDKs +#> +function Get-DotnetSdkTargets { + [CmdletBinding()] + Param() + + Get-DotnetSdks | ForEach-Object { "$(if($_.Major -lt 5){"netcoreapp"}else{"net"})$($_.Major).$($_.Minor)" } | Select-Object -Unique +} + +<# +.SYNOPSIS + Provides targets for available dotnet runtimes +.DESCRIPTION + Returns the list of targets (TFM codes) that correspond to the list of installed dotnet runtimes for 'Microsoft.NETCore.App' +#> +function Get-DotnetRuntimeNetCoreTargets { + [CmdletBinding()] + Param() + + Get-DotnetRuntimes | Where-Object {$_.Name -eq "Microsoft.NETCore.App"} | ForEach-Object {$_.Version} | + ForEach-Object { "$(if($_.Major -lt 5){"netcoreapp"}else{"net"})$($_.Major).$($_.Minor)" } | Select-Object -Unique +} + +<# +.SYNOPSIS + Provides targets for all available runtimes (.Net Framework and Net Core) +.DESCRIPTION + Returns the list of targets (TFM codes) for all available runtimes +#> +function Get-AllRuntimeTargets { + @() + (Get-NetFrameworkRuntimeTarget) + (Get-DotnetRuntimeNetCoreTargets) +} + +<# +.SYNOPSIS + Tests whether given string is a valid TFM code +.DESCRIPTION + Supports .Net Core/5.0+ and .Net Framework codes +#> +function Test-IsTfmCode { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$code) + + [bool]($code -match "(net|netcoreapp)\d+(\.\d+)?") +} + +<# +.SYNOPSIS + Tests whether given TFM code is about .Net Framework target +.DESCRIPTION + Supports all .Net Framework codes +#> +function Test-IsFrameworkTfmCode { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$code) + + [bool]($code -match "^net\d+$") +} + +<# +.SYNOPSIS + Extracts version and a generation flag from given Tfm code +.DESCRIPTION + Supports all .Net Framework codes +#> +function Expand-TfmCode { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$code) + + if ($code -match "^net(\d)(\d)$") { return [PSCustomObject]@{ TfmCode=$code; IsFramework=$True; Version=[version]"$($Matches[1]).$($Matches[2])" } } + if ($code -match "^net(\d)(\d)(\d)$") { return [PSCustomObject]@{ TfmCode=$code; IsFramework=$True; Version=[version]"$($Matches[1]).$($Matches[2]).$($Matches[3])" } } + if ($code -match "^net(\d+)\.(\d)$") { return [PSCustomObject]@{ TfmCode=$code; IsFramework=$False; Version=[version]"$($Matches[1]).$($Matches[2])" } } + if ($code -match "^netcoreapp(\d)\.(\d)$") { return [PSCustomObject]@{ TfmCode=$code; IsFramework=$False; Version=[version]"$($Matches[1]).$($Matches[2])" } } +} + +<# +.SYNOPSIS + Tests whether given dotnet binary can be run on given dotnet runtime +.DESCRIPTION + Takes binary and runtime TFM codes and returns True if they are compatible or False otherwise +#> +function Test-IsRuntimeCompatible { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][string]$binaryTfmCode, + [Parameter(Mandatory=$True)][string]$runtimeTfmCode + ) + + $bin = Expand-TfmCode $binaryTfmCode + $runtime = Expand-TfmCode $runtimeTfmCode + + if ($bin -and $runtime -and ($bin.IsFramework -eq $runtime.IsFramework)) { + if ($bin.IsFramework) { return $bin.Version -le $runtime.Version} + else { return $bin.Version.Major -eq $runtime.Version.Major} + } + + return $false +} + +function Test-HasCompatibleSdk { + [CmdletBinding()] + Param([Parameter(Mandatory)][string]$tfmCode) + + $expandedTfmCode = Expand-TfmCode $tfmCode + $targets = if ($expandedTfmCode.IsFramework) { Get-NetFrameworkSdkTargets } else { Get-DotnetSdkTargets } + [bool]($targets | ForEach-Object { Expand-TfmCode $_ } | Where-Object { $expandedTfmCode.Version -le $_.Version}) +} + +Export-ModuleMember -function * -alias * \ No newline at end of file diff --git a/Contrib/Common/SysPlatform.psm1 b/Contrib/Common/SysPlatform.psm1 new file mode 100644 index 00000000..3f05b461 --- /dev/null +++ b/Contrib/Common/SysPlatform.psm1 @@ -0,0 +1,390 @@ +<# +.SYNOPSIS +Helper functions for interacting with OS features + +.DESCRIPTION +Provides platform-independent functions that represent OS-related features. + +.NOTES +Author: Dmitry Merzlyakov +Date: December 14, 2023 +#> + +[CmdletBinding()] +Param() + +<# +.SYNOPSIS + Determines whether the current OS is Windows +.DESCRIPTION + Returns True if the current OS is Windows or returns False otherwise. +#> +function Test-IsWindows { + [CmdletBinding()] + Param() + + [bool][System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows) +} + +<# +.SYNOPSIS + Determines whether the current OS is OSX +.DESCRIPTION + Returns True if the current OS is OSX or returns False otherwise. +#> +function Test-IsOSX { +[CmdletBinding()] +Param() + + !(Test-IsWindows) -and [bool][System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::OSX) +} + +<# +.SYNOPSIS + Determines whether the current OS is Linux +.DESCRIPTION + Returns True if the current OS is Linux or returns False otherwise. +#> +function Test-IsLinux { +[CmdletBinding()] +Param() + + !(Test-IsWindows) -and [bool][System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Linux) +} + +<# +.SYNOPSIS + Returns a full path to ProgramFiles(x86) folder +.DESCRIPTION + Returns either a full path to ProgramFiles(x86) folder or empty string for non-Windows OS +#> +function Get-SpecialFolderProgramFilesX86 { +[CmdletBinding()] +Param() + + if(Test-IsWindows){[System.Environment]::GetFolderPath(([System.Environment+SpecialFolder]::ProgramFilesX86))}else{""} +} + +################# +# PATH management +################# + +[string]$Script:PathsSeparator = $(if(Test-IsWindows){";"}else{":"}) + +# Locate shell config file for unix-like platforms (linux and OSX) +[string]$Script:ShellConfig = $null +if(!(Test-IsWindows)) { + if ($env:SHELL -eq "/bin/zsh") { + $Script:ShellConfig = "$HOME/.zshrc" + } else { + $Script:ShellConfig = "$HOME/.bashrc" + if(!(Test-Path -LiteralPath $Script:ShellConfig -PathType Leaf)) { $Script:ShellConfig = "$HOME/.bash_profile" } + } + if(!(Test-Path -LiteralPath $Script:ShellConfig -PathType Leaf)) { $null = Add-Content $Script:ShellConfig "" } + if(!(Test-Path -LiteralPath $Script:ShellConfig -PathType Leaf)) { throw "Cannot find shell config file" } +} + +<# +.SYNOPSIS + Forces reading recent changes in PATH variable +.DESCRIPTION + Re-stars windows explorer so that a new process gets updated PATH variable. Does nothing on non-windows platforms. +#> +function Reset-Shell { + [CmdletBinding()] + Param() + + if (Test-IsWindows) { + Write-Verbose "Restarting windows explorer" + $null = (Stop-Process -ProcessName "explorer") + } else { + # Do nothing on non-windows platform. It is basically a good idea to execute "source ..." command in the parent shell, but it is too complicated. + } +} + +<# +.SYNOPSIS + Returns a collection of all paths that PATH environment variable contains +.DESCRIPTION + Return only valid entries (empty values are omitted) as a collection of strings +#> +function Get-Paths { + [CmdletBinding()] + Param() + + [string]$paths = $env:PATH + Write-Verbose "Get-Paths (win): $paths" + $paths -split $Script:PathsSeparator -ne '' +} + +<# +.SYNOPSIS + Compares two paths +.DESCRIPTION + Checks whether two paths are equal and returns True or False. Properly manages relative and do-normalized paths. +.PARAMETER pathA + First path +.PARAMETER pathB + Second path +#> +function Test-PathsAreEqual { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][string]$pathA, + [Parameter(Mandatory=$True)][string]$pathB + ) + + Write-Verbose "Test-PathsAreEqual: comparing paths '$pathA' and '$pathB'" + if (!(Test-Path -LiteralPath $pathA -PathType Container) -or !(Test-Path -LiteralPath $pathB -PathType Container)) { return $false } + [string]$Private:dirA = [System.IO.Path]::GetFullPath("$pathA/.") + [string]$Private:dirB = [System.IO.Path]::GetFullPath("$pathB/.") + Write-Verbose "Test-PathsAreEqual: normalized paths '$Private:dirA' and '$Private:dirB'" + + return $(if(Test-IsWindows){$Private:dirA -eq $Private:dirB}else{$Private:dirA -ceq $Private:dirB}) +} + +<# +.SYNOPSIS + Adds path to PATH variable +.DESCRIPTION + Adds a path to PATH variable if it is not there yet. Properly manages relative and do-normalized paths. Resets shell in case of changes in PATH. +#> +function Add-Path { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$path) + + if (!(Test-Path -LiteralPath $path -PathType Container)) { throw "Path $path does not exist" } + + $paths = Get-Paths + if (!($paths | Where-Object { Test-PathsAreEqual $_ $path })) { + + $paths += $path + $pathValue = $paths -join $Script:PathsSeparator + + if (Test-IsWindows) { + [System.Environment]::SetEnvironmentVariable("PATH",$pathValue,[System.EnvironmentVariableTarget]::User) + } else { + [string]$Private:exportString = "export PATH=`$PATH:$path" + [string]$Private:escapedExportString = [System.Text.RegularExpressions.Regex]::Escape($Private:exportString) + if(!(Select-String -LiteralPath $Script:ShellConfig -Pattern $Private:escapedExportString)) { # Check whether the file already contains the string + $Private:content = Get-Content $Script:ShellConfig + $null = ($Private:content | Out-File "$($Script:ShellConfig).old") + $null = Add-Content $Script:ShellConfig $Private:exportString + } + } + + $env:PATH = $pathValue + } +} + +<# +.SYNOPSIS + Removes path from PATH variable +.DESCRIPTION + Removes a path from PATH variable if it is currently there. Properly manages relative and do-normalized paths. Resets shell in case of changes in PATH. +#> +function Remove-Path { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$path) + + if (!(Test-Path -LiteralPath $path -PathType Container)) { throw "Path $path does not exist" } + + $paths = Get-Paths + if ($paths | Where-Object { Test-PathsAreEqual $_ $path }) { + + $paths = $paths | Where-Object { !(Test-PathsAreEqual $_ $path) } + $pathValue = $paths -join $Script:PathsSeparator + + if (Test-IsWindows) { + [System.Environment]::SetEnvironmentVariable("PATH",$pathValue,[System.EnvironmentVariableTarget]::User) + } else { + [string]$Private:exportString = "export PATH=`$PATH:$path" + [string]$Private:escapedExportString = [System.Text.RegularExpressions.Regex]::Escape($Private:exportString) + if(Select-String -LiteralPath $Script:ShellConfig -Pattern $Private:escapedExportString) { # Check whether the string was already removed + $Private:content = Get-Content $Script:ShellConfig + $null = ($Private:content | Out-File "$($Script:ShellConfig).old") + $Private:content = $Private:content | Where-Object { $_ -ne $Private:exportString } + $null = ($Private:content | Out-File $Script:ShellConfig ) + } + } + + $env:PATH = $pathValue + } +} + + +################# +# NGEN management +################# + +<# +.SYNOPSIS + Checks whether current user has administrative privileges +.DESCRIPTION + Returns True or False depending on whether current script is run as administrator +#> +function Test-AdministrativePriviledges { + [CmdletBinding()] + Param() + + return (Test-IsWindows) -and ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) +} + +<# +.SYNOPSIS + Returns paths to all installed NGen on current environment +.DESCRIPTION + Checks the latest installed .Net Framework and returns absolute paths to NGen executable files (x86 and x64 versions). +#> +function Get-InstalledNGens { + [CmdletBinding()] + Param() + + [string]$Private:ngen64 = "$((Get-ItemProperty "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").InstallPath)ngen.exe" + [string]$Private:ngen32 = "$((Get-ItemProperty "HKLM:SOFTWARE\WOW6432Node\Microsoft\NET Framework Setup\NDP\v4\Full").InstallPath)ngen.exe" + + if (Test-Path -LiteralPath $Private:ngen64 -PathType Leaf) { $Private:ngen64 } + if (Test-Path -LiteralPath $Private:ngen32 -PathType Leaf) { $Private:ngen32 } +} + +<# +.SYNOPSIS + Checks whether NGen functions can be called +.DESCRIPTION + The conditions are: windows platform, administrative privileges, NGen is available +#> +function Test-CanCallNGen { + [CmdletBinding()] + Param() + + return (Test-IsWindows) -and (Test-AdministrativePriviledges) -and (Get-InstalledNGens) +} + +<# +.SYNOPSIS + Checks whether given .Net binary file has a native image +.DESCRIPTION + Executes NGen display command to verify the status for given .Net binary file +.PARAMETER ngenPath + Absoulte path to NGen executable file. +.PARAMETER path + Absolute path to a .Net Framework binary file. +#> +function Test-NGenImage { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][string]$ngenPath, + [Parameter(Mandatory=$True)][string]$path + ) + + if(!(Test-Path -LiteralPath $ngenPath -PathType Leaf)) { throw "Cannot find $ngenPath" } + [string]$Private:displayResult = & $Private:ngenPath display $path + Write-Verbose "NGen display responds $Private:displayResult" + return ($Private:displayResult -notmatch "The specified assembly is not installed" ) +} + +<# +.SYNOPSIS + Creates a native image for a .Net binary file +.DESCRIPTION + Executes NGen install command to create a native image for a .Net binary file if it has not been installed yet +.PARAMETER path + Absolute path to a .Net Framework binary file. +#> +function Add-NGenImage { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$path) + + if(!(Test-Path -LiteralPath $path -PathType Leaf)) { throw "Cannot find the assembly $path" } + + foreach($Private:ngenPath in (Get-InstalledNGens | Where-Object {!(Test-NGenImage $_ $path)}) ) { + [string]$Private:installResult = & $Private:ngenPath install $path + Write-Verbose "NGen install responds $Private:installResult" + if ($installResult -match "error") { Write-Verbose "Error adding assembly $path" } + } +} + +<# +.SYNOPSIS + Removes a native image of a .Net binary file from NGen repository +.DESCRIPTION + Executes NGen uninstall command to remove a native image if it has not been removed yet +.PARAMETER path + Absolute path to a .Net Framework binary file. +#> +function Remove-NGenImage { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$path) + + if(!(Test-Path -LiteralPath $path -PathType Leaf)) { throw "Cannot find the assembly $path" } + + foreach($Private:ngenPath in (Get-InstalledNGens | Where-Object {Test-NGenImage $_ $path}) ) { + [string]$Private:uninstallResult = & $ngenPath uninstall $path + Write-Verbose "NGen uninstall responds $Private:uninstallResult" + if ($uninstallResult -match "error") { Write-Verbose "Error removing assembly $path" } + } +} + +##################### +# HARDLINK management +##################### + +<# +.SYNOPSIS + Checks whether given path is a hard link to a file +.DESCRIPTION + ReturnsTrue If the parameter is a hard link or False otherwise. +.PARAMETER linkPath + Path to a file or link. +#> +function Test-HardLink{ + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$linkPath) + + if (Test-Path -LiteralPath $linkPath -PathType Leaf) { + return !(!(Get-ChildItem -LiteralPath $linkPath | Where-Object {$_.LinkType -eq 'HardLink'})) + } +} + +<# +.SYNOPSIS + Creates a hard link to a file +.DESCRIPTION + If the target file exist and a link does not exist - creates a hard link. +.PARAMETER filePath + Path to an existing file. +.PARAMETER linkPath + Path to a link that needs to be created. +#> +function Add-HardLink { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][string]$filePath, + [Parameter(Mandatory=$True)][string]$linkPath + ) + + if (!(Test-Path -LiteralPath $filePath -PathType Leaf)) { throw "Link target file does not exist: $filePath" } + if (Test-Path -LiteralPath $linkPath -PathType Leaf) { throw "Link name already exist: $linkPath" } + + $null = (New-Item -ItemType HardLink -Path $linkPath -Value $filePath -ErrorAction Stop) +} + +<# +.SYNOPSIS + Removes a hard link to a file +.DESCRIPTION + If the parameter is a path to a hard link - removes a hard link. +.PARAMETER linkPath + Path to a link that needs to be removed. +#> +function Remove-HardLink { + [CmdletBinding()] + Param([Parameter(Mandatory=$True)][string]$linkPath) + + if(Test-HardLink $linkPath) { + $null = (Remove-Item $linkPath) + } +} + + +Export-ModuleMember -function * -alias * \ No newline at end of file diff --git a/Contrib/Common/Tests/RunTests.cmd b/Contrib/Common/Tests/RunTests.cmd new file mode 100644 index 00000000..0910d9e2 --- /dev/null +++ b/Contrib/Common/Tests/RunTests.cmd @@ -0,0 +1 @@ +@Powershell -NoLogo -ExecutionPolicy RemoteSigned -File "%~dp0RunTests.ps1" \ No newline at end of file diff --git a/Contrib/Common/Tests/RunTests.ps1 b/Contrib/Common/Tests/RunTests.ps1 new file mode 100644 index 00000000..234e25a4 --- /dev/null +++ b/Contrib/Common/Tests/RunTests.ps1 @@ -0,0 +1,22 @@ +# This file runs all tests for PowerShell Contrib scripts. +# Based on Pester unit testing framework (https://github.com/pester/Pester) +# Pestel 5 or higher needs to be installed by the command: Install-Module -Name Pester -Force -SkipPublisherCheck +# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process +[CmdletBinding()] +Param() + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path + +Import-Module Pester + +$config=[PesterConfiguration] @{ + Run = @{ + Path=$Script:ScriptPath + Exit=$true + } + TestResult = @{ + OutputPath="$($Script:ScriptPath)/TestResults.xml" + } +} + +Invoke-Pester -Configuration $config diff --git a/Contrib/Common/Tests/SysConsole.Tests.ps1 b/Contrib/Common/Tests/SysConsole.Tests.ps1 new file mode 100644 index 00000000..6b215c95 --- /dev/null +++ b/Contrib/Common/Tests/SysConsole.Tests.ps1 @@ -0,0 +1,87 @@ +# Tests for SysPlatform.psm1 module +# Based on Pester unit testing framework (https://github.com/pester/Pester) +# Pestel 5 or higher needs to be installed by the command: Install-Module -Name Pester -Force -SkipPublisherCheck +# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path +Import-Module $Script:ScriptPath/../SysConsole.psm1 -Force + +describe 'Convert-ColorTokensToAnsi' { + Context 'Run with ANSI_Colorization enabled' { + BeforeEach { $Global:ANSI_Colorization = $true } + AfterAll { $Global:ANSI_Colorization = $true } + + it 'Accepts empty strings' { Convert-ColorTokensToAnsi "" | Should -BeNullOrEmpty } + + it 'Accepts foreground color Black' { Convert-ColorTokensToAnsi "ABC{c:Black}DEF" | Should -BeExactly "ABC$([char]27)[30mDEF" } + it 'Accepts foreground color DarkBlue' { Convert-ColorTokensToAnsi "ABC{c:DarkBlue}DEF" | Should -BeExactly "ABC$([char]27)[34mDEF" } + it 'Accepts foreground color DarkGreen' { Convert-ColorTokensToAnsi "ABC{c:DarkGreen}DEF" | Should -BeExactly "ABC$([char]27)[32mDEF" } + it 'Accepts foreground color DarkCyan' { Convert-ColorTokensToAnsi "ABC{c:DarkCyan}DEF" | Should -BeExactly "ABC$([char]27)[36mDEF" } + it 'Accepts foreground color DarkRed' { Convert-ColorTokensToAnsi "ABC{c:DarkRed}DEF" | Should -BeExactly "ABC$([char]27)[31mDEF" } + it 'Accepts foreground color DarkMagenta' { Convert-ColorTokensToAnsi "ABC{c:DarkMagenta}DEF" | Should -BeExactly "ABC$([char]27)[35mDEF" } + it 'Accepts foreground color DarkYellow' { Convert-ColorTokensToAnsi "ABC{c:DarkYellow}DEF" | Should -BeExactly "ABC$([char]27)[33mDEF" } + it 'Accepts foreground color Gray' { Convert-ColorTokensToAnsi "ABC{c:Gray}DEF" | Should -BeExactly "ABC$([char]27)[37mDEF" } + it 'Accepts foreground color DarkGray' { Convert-ColorTokensToAnsi "ABC{c:DarkGray}DEF" | Should -BeExactly "ABC$([char]27)[30;1mDEF" } + it 'Accepts foreground color Blue' { Convert-ColorTokensToAnsi "ABC{c:Blue}DEF" | Should -BeExactly "ABC$([char]27)[34;1mDEF" } + it 'Accepts foreground color Green' { Convert-ColorTokensToAnsi "ABC{c:Green}DEF" | Should -BeExactly "ABC$([char]27)[32;1mDEF" } + it 'Accepts foreground color Cyan' { Convert-ColorTokensToAnsi "ABC{c:Cyan}DEF" | Should -BeExactly "ABC$([char]27)[36;1mDEF" } + it 'Accepts foreground color Red' { Convert-ColorTokensToAnsi "ABC{c:Red}DEF" | Should -BeExactly "ABC$([char]27)[31;1mDEF" } + it 'Accepts foreground color Magenta' { Convert-ColorTokensToAnsi "ABC{c:Magenta}DEF" | Should -BeExactly "ABC$([char]27)[35;1mDEF" } + it 'Accepts foreground color Yellow' { Convert-ColorTokensToAnsi "ABC{c:Yellow}DEF" | Should -BeExactly "ABC$([char]27)[33;1mDEF" } + it 'Accepts foreground color White' { Convert-ColorTokensToAnsi "ABC{c:White}DEF" | Should -BeExactly "ABC$([char]27)[37;1mDEF" } + it 'Accepts several foreground colors' { Convert-ColorTokensToAnsi "ABC{c:White}DEF123{c:Black}456" | Should -BeExactly "ABC$([char]27)[37;1mDEF123$([char]27)[30m456" } + it 'Disallows wrong foreground color' { { Convert-ColorTokensToAnsi "ABC{c:Purple}DEF" } | Should -Throw "Invalid color in token: Purple" } + + it 'Accepts background color Black' { Convert-ColorTokensToAnsi "ABC{b:Black}DEF" | Should -BeExactly "ABC$([char]27)[40mDEF" } + it 'Accepts background color DarkBlue' { Convert-ColorTokensToAnsi "ABC{b:DarkBlue}DEF" | Should -BeExactly "ABC$([char]27)[44mDEF" } + it 'Accepts background color DarkGreen' { Convert-ColorTokensToAnsi "ABC{b:DarkGreen}DEF" | Should -BeExactly "ABC$([char]27)[42mDEF" } + it 'Accepts background color DarkCyan' { Convert-ColorTokensToAnsi "ABC{b:DarkCyan}DEF" | Should -BeExactly "ABC$([char]27)[46mDEF" } + it 'Accepts background color DarkRed' { Convert-ColorTokensToAnsi "ABC{b:DarkRed}DEF" | Should -BeExactly "ABC$([char]27)[41mDEF" } + it 'Accepts background color DarkMagenta' { Convert-ColorTokensToAnsi "ABC{b:DarkMagenta}DEF" | Should -BeExactly "ABC$([char]27)[45mDEF" } + it 'Accepts background color DarkYellow' { Convert-ColorTokensToAnsi "ABC{b:DarkYellow}DEF" | Should -BeExactly "ABC$([char]27)[43mDEF" } + it 'Accepts background color Gray' { Convert-ColorTokensToAnsi "ABC{b:Gray}DEF" | Should -BeExactly "ABC$([char]27)[47mDEF" } + it 'Accepts background color DarkGray' { Convert-ColorTokensToAnsi "ABC{b:DarkGray}DEF" | Should -BeExactly "ABC$([char]27)[40;1mDEF" } + it 'Accepts background color Blue' { Convert-ColorTokensToAnsi "ABC{b:Blue}DEF" | Should -BeExactly "ABC$([char]27)[44;1mDEF" } + it 'Accepts background color Green' { Convert-ColorTokensToAnsi "ABC{b:Green}DEF" | Should -BeExactly "ABC$([char]27)[42;1mDEF" } + it 'Accepts background color Cyan' { Convert-ColorTokensToAnsi "ABC{b:Cyan}DEF" | Should -BeExactly "ABC$([char]27)[46;1mDEF" } + it 'Accepts background color Red' { Convert-ColorTokensToAnsi "ABC{b:Red}DEF" | Should -BeExactly "ABC$([char]27)[41;1mDEF" } + it 'Accepts background color Magenta' { Convert-ColorTokensToAnsi "ABC{b:Magenta}DEF" | Should -BeExactly "ABC$([char]27)[45;1mDEF" } + it 'Accepts background color Yellow' { Convert-ColorTokensToAnsi "ABC{b:Yellow}DEF" | Should -BeExactly "ABC$([char]27)[43;1mDEF" } + it 'Accepts background color White' { Convert-ColorTokensToAnsi "ABC{b:White}DEF" | Should -BeExactly "ABC$([char]27)[47;1mDEF" } + it 'Accepts several background colors' { Convert-ColorTokensToAnsi "ABC{b:White}DEF123{b:Black}456" | Should -BeExactly "ABC$([char]27)[47;1mDEF123$([char]27)[40m456" } + it 'Disallows wrong background color' { { Convert-ColorTokensToAnsi "ABC{b:Purple}DEF" } | Should -Throw "Invalid color in token: Purple" } + + it 'Accepts format color Normal' { Convert-ColorTokensToAnsi "ABC{f:Normal}DEF" | Should -BeExactly "ABC$([char]27)[0mDEF" } + it 'Accepts format color Bold' { Convert-ColorTokensToAnsi "ABC{f:Bold}DEF" | Should -BeExactly "ABC$([char]27)[1mDEF" } + it 'Accepts format color Underline' { Convert-ColorTokensToAnsi "ABC{f:Underline}DEF" | Should -BeExactly "ABC$([char]27)[4mDEF" } + it 'Accepts format color Blink' { Convert-ColorTokensToAnsi "ABC{f:Blink}DEF" | Should -BeExactly "ABC$([char]27)[5mDEF" } + it 'Accepts several format colors' { Convert-ColorTokensToAnsi "ABC{f:Normal}DEF123{f:Blink}456" | Should -BeExactly "ABC$([char]27)[0mDEF123$([char]27)[5m456" } + it 'Disallows wrong format color' { { Convert-ColorTokensToAnsi "ABC{f:Purple}DEF" } | Should -Throw "Invalid color in token: Purple" } + + it 'Accepts several foreground, background and format colors' { Convert-ColorTokensToAnsi "ABC{c:Black}DEF{b:White}KLM{f:Normal}" | Should -BeExactly "ABC$([char]27)[30mDEF$([char]27)[47;1mKLM$([char]27)[0m" } + } + Context 'Run with ANSI_Colorization disabled' { + BeforeEach { $Global:ANSI_Colorization = $false } + AfterAll { $Global:ANSI_Colorization = $true } + it 'Accepts empty strings' { Convert-ColorTokensToAnsi "" | Should -BeNullOrEmpty } + it 'Removes any foreground, background and format colors' { Convert-ColorTokensToAnsi "ABC{c:Black}DEF{b:White}KLM{f:Normal}" | Should -BeExactly "ABCDEFKLM" } + it 'Ignores wrong colors' { Convert-ColorTokensToAnsi "ABC{c:Purple}DEF{b:Purple}KLM{f:Purple}" | Should -BeExactly "ABCDEFKLM" } + } +} + +describe 'Out-AnsiString' { + Context 'Run with ANSI_Colorization enabled' { + BeforeEach { $Global:ANSI_Colorization = $true } + AfterAll { $Global:ANSI_Colorization = $true } + + it 'Accepts empty strings in pipeline' { "" | Out-AnsiString | Should -BeNullOrEmpty } + it 'Accepts several foreground, background and format colors in pipeline' { "ABC{c:Black}DEF{b:White}KLM{f:Normal}" | Out-AnsiString | Should -BeExactly "ABC$([char]27)[30mDEF$([char]27)[47;1mKLM$([char]27)[0m" } + } + Context 'Run with ANSI_Colorization disabled' { + BeforeEach { $Global:ANSI_Colorization = $false } + AfterAll { $Global:ANSI_Colorization = $true } + + it 'Accepts empty strings in pipeline' { "" | Out-AnsiString | Should -BeNullOrEmpty } + it 'Removes any foreground, background and format colors in pipeline' { "ABC{c:Black}DEF{b:White}KLM{f:Normal}" | Out-AnsiString | Should -BeExactly "ABCDEFKLM" } + } +} \ No newline at end of file diff --git a/Contrib/Common/Tests/SysDotnet.Tests.ps1 b/Contrib/Common/Tests/SysDotnet.Tests.ps1 new file mode 100644 index 00000000..a7b7a263 --- /dev/null +++ b/Contrib/Common/Tests/SysDotnet.Tests.ps1 @@ -0,0 +1,459 @@ +# Tests for SysDotnet.psm1 module +# Based on Pester unit testing framework (https://github.com/pester/Pester) +# Pestel 5 or higher needs to be installed by the command: Install-Module -Name Pester -Force -SkipPublisherCheck +# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path +Import-Module $Script:ScriptPath/../SysDotnet.psm1 -Force + +describe 'Get-NetFrameworkSDKs' { + Context 'Run on non-Windows machine' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName Get-SpecialFolderProgramFilesX86 -MockWith { "" } } + it "Returns empty string on non-Windows machine" { Get-NetFrameworkSDKs | Should -BeNullOrEmpty } + } + Context 'Run on Windows machine' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Get-SpecialFolderProgramFilesX86 -MockWith { "C:\Program86" } + Mock -ModuleName SysDotnet -CommandName Get-ChildItem -ParameterFilter { + ($Path -eq "C:\Program86/Reference Assemblies/Microsoft/Framework/.NETFramework") -and $Directory + } -MockWith { + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.X" + } + } + it "Returns SDK versions ignoring folders that do not match version pattern" { Get-NetFrameworkSDKs | Should -Be @( + [version]"4.0" + [version]"4.5" + [version]"4.5.1" + [version]"4.5.2" + [version]"4.6" + [version]"4.6.1" + [version]"4.7.2" + [version]"4.8" + ) } + } +} + +describe 'Get-NetFrameworkSdkTargets' { + Context 'Run on non-Windows machine' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName Get-SpecialFolderProgramFilesX86 -MockWith { "" } } + it "Returns empty string on non-Windows machine" { Get-NetFrameworkSdkTargets | Should -BeNullOrEmpty } + } + Context 'Run on Windows machine' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Get-SpecialFolderProgramFilesX86 -MockWith { "C:\Program86" } + Mock -ModuleName SysDotnet -CommandName Get-ChildItem -ParameterFilter { + ($Path -eq "C:\Program86/Reference Assemblies/Microsoft/Framework/.NETFramework") -and $Directory + } -MockWith { + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8" + "C:\Program86\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.X" + } + } + it "Returns SDK targets in TFM code format" { Get-NetFrameworkSdkTargets | Should -Be @( + "net40" + "net45" + "net451" + "net452" + "net46" + "net461" + "net472" + "net48" + ) } + } +} + +describe 'Get-NetFrameworkRuntimeTarget' { + Context 'Run on non-Windows machine' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $false } } + it "Returns empty string on non-Windows machine" { Get-NetFrameworkRuntimeTarget | Should -BeNullOrEmpty } + } + Context 'Run on Windows machine with .Net Framework 4.8.1' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 533320 } + } + it "Returns net481 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net481" } + } + Context 'Run on Windows machine with .Net Framework 4.8' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 528040 } + } + it "Returns net48 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net48" } + } + Context 'Run on Windows machine with .Net Framework 4.7.2' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 461808 } + } + it "Returns net472 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net472" } + } + Context 'Run on Windows machine with .Net Framework 4.7.1' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 461308 } + } + it "Returns net471 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net471" } + } + Context 'Run on Windows machine with .Net Framework 4.7' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 460798 } + } + it "Returns net47 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net47" } + } + Context 'Run on Windows machine with .Net Framework 4.6.2' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 394802 } + } + it "Returns net462 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net462" } + } + Context 'Run on Windows machine with .Net Framework 4.6.1' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 394254 } + } + it "Returns net461 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net461" } + } + Context 'Run on Windows machine with .Net Framework 4.6' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 393295 } + } + it "Returns net46 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net46" } + } + Context 'Run on Windows machine with .Net Framework 4.5.2' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 379893 } + } + it "Returns net452 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net452" } + } + Context 'Run on Windows machine with .Net Framework 4.5.1' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 378675 } + } + it "Returns net451 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net451" } + } + Context 'Run on Windows machine with .Net Framework 4.5' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 378389 } + } + it "Returns net45 TFM code" { Get-NetFrameworkRuntimeTarget | Should -Be "net45" } + } + Context 'Run on Windows machine with .Net Framework older than 4.5' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Test-IsWindows -MockWith { $true } + Mock -ModuleName SysDotnet -CommandName Get-ItemPropertyValue -ParameterFilter { + ($LiteralPath -eq "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full") -and $Name -eq "Release" + } -MockWith { 378389 - 1 } + } + it "Returns empty result" { Get-NetFrameworkRuntimeTarget | Should -BeNullOrEmpty } + } + +} + +describe 'Test-IsDotnetInstalled' { + Context 'Run on a machine without dotnet' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName get-command -MockWith { $false } } + it "Returns False if dotnet is not installed" { Test-IsDotnetInstalled | Should -BeFalse } + } + Context 'Run on a machine with dotnet' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName get-command -MockWith { "Represents a valid command object..." } } + it "Returns True if dotnet is installed" { Test-IsDotnetInstalled | Should -BeTrue } + } +} + +describe 'Get-DotnetSdks' { + Context 'Run on a machine with dotnet' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName dotnet -MockWith { + "3.1.426 [C:\Program Files\dotnet\sdk]" + "5.0.102 [C:\Program Files\dotnet\sdk]" + "6.0.201 [C:\Program Files\dotnet\sdk]" + "7.0.103 [C:\Program Files\dotnet\sdk]" + } } + it "Returns list of installed SDK versions" { Get-DotnetSdks | Should -Be @( + [version]"3.1.426" + [version]"5.0.102" + [version]"6.0.201" + [version]"7.0.103" + ) } + } +} + +describe 'Get-DotnetRuntimes' { + Context 'Run on a machine with dotnet' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName dotnet -MockWith { + "Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + "Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + "Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + "Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + "Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + } } + it "Returns list of installed runtime names and versions" { Get-DotnetRuntimes | ForEach-Object { "$_.Name-$.Version" } | Should -Be (@( + [PSCustomObject]@{Name = "Microsoft.AspNetCore.App"; Version = [version]"3.1.32"} + [PSCustomObject]@{Name = "Microsoft.AspNetCore.App"; Version = [version]"5.0.2"} + [PSCustomObject]@{Name = "Microsoft.AspNetCore.App"; Version = [version]"6.0.3"} + [PSCustomObject]@{Name = "Microsoft.AspNetCore.App"; Version = [version]"6.0.14"} + [PSCustomObject]@{Name = "Microsoft.AspNetCore.App"; Version = [version]"7.0.3"} + [PSCustomObject]@{Name = "Microsoft.NETCore.App"; Version = [version]"3.1.32"} + [PSCustomObject]@{Name = "Microsoft.NETCore.App"; Version = [version]"5.0.2"} + [PSCustomObject]@{Name = "Microsoft.NETCore.App"; Version = [version]"6.0.3"} + [PSCustomObject]@{Name = "Microsoft.NETCore.App"; Version = [version]"6.0.14"} + [PSCustomObject]@{Name = "Microsoft.NETCore.App"; Version = [version]"7.0.3"} + [PSCustomObject]@{Name = "Microsoft.WindowsDesktop.App"; Version = [version]"3.1.32"} + [PSCustomObject]@{Name = "Microsoft.WindowsDesktop.App"; Version = [version]"5.0.2"} + [PSCustomObject]@{Name = "Microsoft.WindowsDesktop.App"; Version = [version]"6.0.3"} + [PSCustomObject]@{Name = "Microsoft.WindowsDesktop.App"; Version = [version]"6.0.14"} + [PSCustomObject]@{Name = "Microsoft.WindowsDesktop.App"; Version = [version]"7.0.3"} + ) | ForEach-Object { "$_.Name-$.Version" } ) } + } +} + +describe 'Get-DotnetSdkTargets' { + Context 'Run on a machine with dotnet' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName dotnet -MockWith { + "3.1.426 [C:\Program Files\dotnet\sdk]" + "5.0.102 [C:\Program Files\dotnet\sdk]" + "6.0.201 [C:\Program Files\dotnet\sdk]" + "7.0.103 [C:\Program Files\dotnet\sdk]" + } } + it "Returns list of installed SDK in TFM code format" { Get-DotnetSdkTargets | Should -Be @( + "netcoreapp3.1" + "net5.0" + "net6.0" + "net7.0" + ) } + } +} + +describe 'Get-DotnetRuntimeNetCoreTargets' { + Context 'Run on a machine with dotnet' { + BeforeEach { Mock -ModuleName SysDotnet -CommandName dotnet -MockWith { + "Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.AspNetCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]" + "Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.NETCore.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]" + "Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + "Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + "Microsoft.WindowsDesktop.App 6.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + "Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + "Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]" + } } + it "Returns list of installed NetCore.App runtimes in TFM code format" { Get-DotnetRuntimeNetCoreTargets | Should -Be @( + "netcoreapp3.1" + "net5.0" + "net6.0" + "net7.0" + ) } + } +} + +describe 'Get-AllRuntimeTargets' { + Context 'None runtimes found' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Get-NetFrameworkRuntimeTarget -MockWith { } + Mock -ModuleName SysDotnet -CommandName Get-DotnetRuntimeNetCoreTargets -MockWith { } + } + it "Returns empty results if none runtimes found" { Get-AllRuntimeTargets | Should -BeNullOrEmpty } + } + Context '.Net Framework installed' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Get-NetFrameworkRuntimeTarget -MockWith { "net48" } + Mock -ModuleName SysDotnet -CommandName Get-DotnetRuntimeNetCoreTargets -MockWith { } + } + it "Returns empty results if none runtimes found" { Get-AllRuntimeTargets | Should -Be @( "net48" ) } + } + Context 'Dotnet Core installed' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Get-NetFrameworkRuntimeTarget -MockWith { } + Mock -ModuleName SysDotnet -CommandName Get-DotnetRuntimeNetCoreTargets -MockWith { "net5.0" } + } + it "Returns empty results if none runtimes found" { Get-AllRuntimeTargets | Should -Be @( "net5.0" ) } + } + Context '.Net Framework and dotnet Core are installed' { + BeforeEach { + Mock -ModuleName SysDotnet -CommandName Get-NetFrameworkRuntimeTarget -MockWith { "net48" } + Mock -ModuleName SysDotnet -CommandName Get-DotnetRuntimeNetCoreTargets -MockWith { "net5.0" } + } + it "Returns empty results if none runtimes found" { Get-AllRuntimeTargets | Should -Be @( "net48", "net5.0" ) } + } +} + +describe 'Test-IsTfmCode' { + it "Recognizes valid TFM code netcoreapp1.0" { Test-IsTfmCode "netcoreapp1.0" | Should -BeTrue } + it "Recognizes valid TFM code netcoreapp2.0" { Test-IsTfmCode "netcoreapp2.0" | Should -BeTrue } + it "Recognizes valid TFM code netcoreapp2.1" { Test-IsTfmCode "netcoreapp2.1" | Should -BeTrue } + it "Recognizes valid TFM code netcoreapp2.2" { Test-IsTfmCode "netcoreapp2.2" | Should -BeTrue } + it "Recognizes valid TFM code netcoreapp3.0" { Test-IsTfmCode "netcoreapp3.0" | Should -BeTrue } + it "Recognizes valid TFM code netcoreapp3.1" { Test-IsTfmCode "netcoreapp3.1" | Should -BeTrue } + it "Recognizes valid TFM code net5.0" { Test-IsTfmCode "net5.0" | Should -BeTrue } + it "Recognizes valid TFM code net6.0" { Test-IsTfmCode "net6.0" | Should -BeTrue } + it "Recognizes valid TFM code net7.0" { Test-IsTfmCode "net7.0" | Should -BeTrue } + it "Recognizes valid TFM code net11" { Test-IsTfmCode "net11" | Should -BeTrue } + it "Recognizes valid TFM code net20" { Test-IsTfmCode "net20" | Should -BeTrue } + it "Recognizes valid TFM code net35" { Test-IsTfmCode "net35" | Should -BeTrue } + it "Recognizes valid TFM code net40" { Test-IsTfmCode "net40" | Should -BeTrue } + it "Recognizes valid TFM code net403" { Test-IsTfmCode "net403" | Should -BeTrue } + it "Recognizes valid TFM code net45" { Test-IsTfmCode "net45" | Should -BeTrue } + it "Recognizes valid TFM code net451" { Test-IsTfmCode "net451" | Should -BeTrue } + it "Recognizes valid TFM code net452" { Test-IsTfmCode "net452" | Should -BeTrue } + it "Recognizes valid TFM code net46" { Test-IsTfmCode "net46" | Should -BeTrue } + it "Recognizes valid TFM code net461" { Test-IsTfmCode "net461" | Should -BeTrue } + it "Recognizes valid TFM code net462" { Test-IsTfmCode "net462" | Should -BeTrue } + it "Recognizes valid TFM code net47" { Test-IsTfmCode "net47" | Should -BeTrue } + it "Recognizes valid TFM code net471" { Test-IsTfmCode "net471" | Should -BeTrue } + it "Recognizes valid TFM code net472" { Test-IsTfmCode "net472" | Should -BeTrue } + it "Recognizes valid TFM code net48" { Test-IsTfmCode "net48" | Should -BeTrue } + it "Recognizes invalid TFM code" { Test-IsTfmCode "code12" | Should -BeFalse } +} + +describe 'Test-IsFrameworkTfmCode' { + it "Recognizes non-framework TFM code netcoreapp1.0" { Test-IsFrameworkTfmCode "netcoreapp1.0" | Should -BeFalse } + it "Recognizes non-framework TFM code netcoreapp2.0" { Test-IsFrameworkTfmCode "netcoreapp2.0" | Should -BeFalse } + it "Recognizes non-framework TFM code netcoreapp2.1" { Test-IsFrameworkTfmCode "netcoreapp2.1" | Should -BeFalse } + it "Recognizes non-framework TFM code netcoreapp2.2" { Test-IsFrameworkTfmCode "netcoreapp2.2" | Should -BeFalse } + it "Recognizes non-framework TFM code netcoreapp3.0" { Test-IsFrameworkTfmCode "netcoreapp3.0" | Should -BeFalse } + it "Recognizes non-framework TFM code netcoreapp3.1" { Test-IsFrameworkTfmCode "netcoreapp3.1" | Should -BeFalse } + it "Recognizes non-framework TFM code net5.0" { Test-IsFrameworkTfmCode "net5.0" | Should -BeFalse } + it "Recognizes non-framework TFM code net6.0" { Test-IsFrameworkTfmCode "net6.0" | Should -BeFalse } + it "Recognizes non-framework TFM code net7.0" { Test-IsFrameworkTfmCode "net7.0" | Should -BeFalse } + it "Recognizes framework TFM code net11" { Test-IsFrameworkTfmCode "net11" | Should -BeTrue } + it "Recognizes framework TFM code net20" { Test-IsFrameworkTfmCode "net20" | Should -BeTrue } + it "Recognizes framework TFM code net35" { Test-IsFrameworkTfmCode "net35" | Should -BeTrue } + it "Recognizes framework TFM code net40" { Test-IsFrameworkTfmCode "net40" | Should -BeTrue } + it "Recognizes framework TFM code net403" { Test-IsFrameworkTfmCode "net403" | Should -BeTrue } + it "Recognizes framework TFM code net45" { Test-IsFrameworkTfmCode "net45" | Should -BeTrue } + it "Recognizes framework TFM code net451" { Test-IsFrameworkTfmCode "net451" | Should -BeTrue } + it "Recognizes framework TFM code net452" { Test-IsFrameworkTfmCode "net452" | Should -BeTrue } + it "Recognizes framework TFM code net46" { Test-IsFrameworkTfmCode "net46" | Should -BeTrue } + it "Recognizes framework TFM code net461" { Test-IsFrameworkTfmCode "net461" | Should -BeTrue } + it "Recognizes framework TFM code net462" { Test-IsFrameworkTfmCode "net462" | Should -BeTrue } + it "Recognizes framework TFM code net47" { Test-IsFrameworkTfmCode "net47" | Should -BeTrue } + it "Recognizes framework TFM code net471" { Test-IsFrameworkTfmCode "net471" | Should -BeTrue } + it "Recognizes framework TFM code net472" { Test-IsFrameworkTfmCode "net472" | Should -BeTrue } + it "Recognizes framework TFM code net48" { Test-IsFrameworkTfmCode "net48" | Should -BeTrue } + it "Recognizes invalid TFM code" { Test-IsFrameworkTfmCode "code12" | Should -BeFalse } +} + +describe 'Expand-TfmCode' { + + it "Recognizes TFM code netcoreapp1.0 as non-framework" { (Expand-TfmCode "netcoreapp1.0").IsFramework | Should -BeFalse } + it "Recognizes TFM code netcoreapp2.0 as non-framework" { (Expand-TfmCode "netcoreapp2.0").IsFramework | Should -BeFalse } + it "Recognizes TFM code netcoreapp2.1 as non-framework" { (Expand-TfmCode "netcoreapp2.1").IsFramework | Should -BeFalse } + it "Recognizes TFM code netcoreapp2.2 as non-framework" { (Expand-TfmCode "netcoreapp2.2").IsFramework | Should -BeFalse } + it "Recognizes TFM code netcoreapp3.0 as non-framework" { (Expand-TfmCode "netcoreapp3.0").IsFramework | Should -BeFalse } + it "Recognizes TFM code netcoreapp3.1 as non-framework" { (Expand-TfmCode "netcoreapp3.1").IsFramework | Should -BeFalse } + it "Recognizes TFM code net5.0 as non-framework" { (Expand-TfmCode "net5.0").IsFramework | Should -BeFalse } + it "Recognizes TFM code net6.0 as non-framework" { (Expand-TfmCode "net6.0").IsFramework | Should -BeFalse } + it "Recognizes TFM code net7.0 as non-framework" { (Expand-TfmCode "net7.0").IsFramework | Should -BeFalse } + it "Recognizes TFM code net11 as framework" { (Expand-TfmCode "net11").IsFramework | Should -BeTrue } + it "Recognizes TFM code net20 as framework" { (Expand-TfmCode "net20").IsFramework | Should -BeTrue } + it "Recognizes TFM code net35 as framework" { (Expand-TfmCode "net35").IsFramework | Should -BeTrue } + it "Recognizes TFM code net40 as framework" { (Expand-TfmCode "net40").IsFramework | Should -BeTrue } + it "Recognizes TFM code net403 as framework" { (Expand-TfmCode "net403").IsFramework | Should -BeTrue } + it "Recognizes TFM code net45 as framework" { (Expand-TfmCode "net45").IsFramework | Should -BeTrue } + it "Recognizes TFM code net451 as framework" { (Expand-TfmCode "net451").IsFramework | Should -BeTrue } + it "Recognizes TFM code net452 as framework" { (Expand-TfmCode "net452").IsFramework | Should -BeTrue } + it "Recognizes TFM code net46 as framework" { (Expand-TfmCode "net46").IsFramework | Should -BeTrue } + it "Recognizes TFM code net461 as framework" { (Expand-TfmCode "net461").IsFramework | Should -BeTrue } + it "Recognizes TFM code net462 as framework" { (Expand-TfmCode "net462").IsFramework | Should -BeTrue } + it "Recognizes TFM code net47 as framework" { (Expand-TfmCode "net47").IsFramework | Should -BeTrue } + it "Recognizes TFM code net471 as framework" { (Expand-TfmCode "net471").IsFramework | Should -BeTrue } + it "Recognizes TFM code net472 as framework" { (Expand-TfmCode "net472").IsFramework | Should -BeTrue } + it "Recognizes TFM code net48 as framework" { (Expand-TfmCode "net48").IsFramework | Should -BeTrue } + + it "Recognizes TFM code netcoreapp1.0 version" { (Expand-TfmCode "netcoreapp1.0").Version | Should -Be ([version]"1.0") } + it "Recognizes TFM code netcoreapp2.0 version" { (Expand-TfmCode "netcoreapp2.0").Version | Should -Be ([version]"2.0") } + it "Recognizes TFM code netcoreapp2.1 version" { (Expand-TfmCode "netcoreapp2.1").Version | Should -Be ([version]"2.1") } + it "Recognizes TFM code netcoreapp2.2 version" { (Expand-TfmCode "netcoreapp2.2").Version | Should -Be ([version]"2.2") } + it "Recognizes TFM code netcoreapp3.0 version" { (Expand-TfmCode "netcoreapp3.0").Version | Should -Be ([version]"3.0") } + it "Recognizes TFM code netcoreapp3.1 version" { (Expand-TfmCode "netcoreapp3.1").Version | Should -Be ([version]"3.1") } + it "Recognizes TFM code net5.0 version" { (Expand-TfmCode "net5.0").Version | Should -Be ([version]"5.0") } + it "Recognizes TFM code net6.0 version" { (Expand-TfmCode "net6.0").Version | Should -Be ([version]"6.0") } + it "Recognizes TFM code net7.0 version" { (Expand-TfmCode "net7.0").Version | Should -Be ([version]"7.0") } + it "Recognizes TFM code net11 version" { (Expand-TfmCode "net11").Version | Should -Be ([version]"1.1") } + it "Recognizes TFM code net20 version" { (Expand-TfmCode "net20").Version | Should -Be ([version]"2.0") } + it "Recognizes TFM code net35 version" { (Expand-TfmCode "net35").Version | Should -Be ([version]"3.5") } + it "Recognizes TFM code net40 version" { (Expand-TfmCode "net40").Version | Should -Be ([version]"4.0") } + it "Recognizes TFM code net403 version" { (Expand-TfmCode "net403").Version | Should -Be ([version]"4.0.3") } + it "Recognizes TFM code net45 version" { (Expand-TfmCode "net45").Version | Should -Be ([version]"4.5") } + it "Recognizes TFM code net451 version" { (Expand-TfmCode "net451").Version | Should -Be ([version]"4.5.1") } + it "Recognizes TFM code net452 version" { (Expand-TfmCode "net452").Version | Should -Be ([version]"4.5.2") } + it "Recognizes TFM code net46 version" { (Expand-TfmCode "net46").Version | Should -Be ([version]"4.6") } + it "Recognizes TFM code net461 version" { (Expand-TfmCode "net461").Version | Should -Be ([version]"4.6.1") } + it "Recognizes TFM code net462 version" { (Expand-TfmCode "net462").Version | Should -Be ([version]"4.6.2") } + it "Recognizes TFM code net47 version" { (Expand-TfmCode "net47").Version | Should -Be ([version]"4.7") } + it "Recognizes TFM code net471 version" { (Expand-TfmCode "net471").Version | Should -Be ([version]"4.7.1") } + it "Recognizes TFM code net472 version" { (Expand-TfmCode "net472").Version | Should -Be ([version]"4.7.2") } + it "Recognizes TFM code net48 version" { (Expand-TfmCode "net48").Version | Should -Be ([version]"4.8") } + + it "Recognizes invalid TFM code" { Expand-TfmCode "code12" | Should -BeFalse } +} + +describe 'Test-IsRuntimeCompatible' { + it "Returns False for .Net Framework binaries and Net runtime" { Test-IsRuntimeCompatible "net48" "net6.0" | Should -BeFalse } + it "Returns False for Net binaries and .Net Framework runtime" { Test-IsRuntimeCompatible "net6.0" "net48" | Should -BeFalse } + it "Returns True for equal .Net Framework binaries and runtime" { Test-IsRuntimeCompatible "net48" "net48" | Should -BeTrue } + it "Returns True for older .Net Framework binaries rather than runtime" { Test-IsRuntimeCompatible "net471" "net48" | Should -BeTrue } + it "Returns False for newer .Net Framework binaries rather than runtime" { Test-IsRuntimeCompatible "net48" "net45" | Should -BeFalse } + it "Returns True for equal Net binaries and runtime" { Test-IsRuntimeCompatible "net5.0" "net5.0" | Should -BeTrue } + it "Returns True for equal Net Major versions of binaries and runtime" { Test-IsRuntimeCompatible "net5.1" "net5.0" | Should -BeTrue } + it "Returns True for equal Net Major versions of binaries and runtime" { Test-IsRuntimeCompatible "net5.0" "net5.1" | Should -BeTrue } + it "Returns False for non-equal Net Major versions of binaries and runtime" { Test-IsRuntimeCompatible "net5.0" "net6.0" | Should -BeFalse } +} \ No newline at end of file diff --git a/Contrib/Common/Tests/SysPlatform.Tests.ps1 b/Contrib/Common/Tests/SysPlatform.Tests.ps1 new file mode 100644 index 00000000..5487d452 --- /dev/null +++ b/Contrib/Common/Tests/SysPlatform.Tests.ps1 @@ -0,0 +1,36 @@ +# Tests for SysPlatform.psm1 module +# Based on Pester unit testing framework (https://github.com/pester/Pester) +# Pestel 5 or higher needs to be installed by the command: Install-Module -Name Pester -Force -SkipPublisherCheck +# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path +Import-Module $Script:ScriptPath/../SysPlatform.psm1 -Force + +describe 'Test-IsWindows' { + Context 'Run on any machine' { + it 'Returns the same result as IsOSPlatform function' { Test-IsWindows | Should -Be ([bool][System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows))} + } +} + +describe 'Test-IsOSX' { + Context 'Run on any machine' { + it 'Returns the same result as IsOSPlatform function' { Test-IsOSX | Should -Be ([bool][System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::OSX))} + } +} + +describe 'Test-IsLinux' { + Context 'Run on any machine' { + it 'Returns the same result as IsOSPlatform function' { Test-IsOSX | Should -Be ([bool][System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Linux))} + } +} + +describe 'Get-SpecialFolderProgramFilesX86' { + Context 'Run on Windows machine' { + BeforeEach { Mock -ModuleName SysPlatform -CommandName Test-IsWindows -MockWith { $true } } + it 'Returns be equal to ProgramFilesX86' { Get-SpecialFolderProgramFilesX86 | Should -Be ([System.Environment]::GetFolderPath(([System.Environment+SpecialFolder]::ProgramFilesX86))) } + } + Context 'Run on non-Windows machine' { + BeforeEach { Mock -ModuleName SysPlatform -CommandName Test-IsWindows -MockWith { $false } } + it 'Returns empty result' { Get-SpecialFolderProgramFilesX86 | Should -BeNullOrEmpty } + } +} diff --git a/Contrib/Extras/cat.cmd b/Contrib/Extras/cat.cmd index cc381464..e64ae768 100644 --- a/Contrib/Extras/cat.cmd +++ b/Contrib/Extras/cat.cmd @@ -1,2 +1,2 @@ -@rem Simluate "cat" command on Windows environment +@rem Simulate "cat" command on Windows environment @more %1 %2 %3 %4 %5 \ No newline at end of file diff --git a/Contrib/Install/NLInstall.psm1 b/Contrib/Install/NLInstall.psm1 deleted file mode 100644 index ba32da37..00000000 --- a/Contrib/Install/NLInstall.psm1 +++ /dev/null @@ -1,189 +0,0 @@ -<# -.SYNOPSIS - Powershell module that manages NLedger deployment actions -.DESCRIPTION - Installs, uninstalls and checks deployment status on any platform (Wiindows, Linux, OSX) -.NOTES - Author: Dmitry Merzlyakov - Date: September 04, 2020 -#> - -[CmdletBinding()] -Param() - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path -Import-Module $Script:ScriptPath/../NLManagement/NLWhere.psm1 -Force -Import-Module $Script:ScriptPath/SysPath.psm1 -Force -Import-Module $Script:ScriptPath/SysHardLink.psm1 -Force -Import-Module $Script:ScriptPath/SysNGen.psm1 -Force - -[bool]$Script:isWindowsPlatform = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows) - -<# -.SYNOPSIS - Returns all installed NLedgers -.DESCRIPTION - Checks PATH variable and returns a collection of objects containing NLedger deployment details for every path -#> -function Get-NLedgerInstalls { - [CmdletBinding()] - Param() - - [string]$Private:linkName = "ledger$(if($Script:isWindowsPlatform){".exe"})" - [string]$Private:exeName = "NLedger-cli$(if($Script:isWindowsPlatform){".exe"})" - - foreach($path in Get-Paths) { - [string]$Private:absLinkName = [System.IO.Path]::GetFullPath("$($path)/$Private:linkName") - [string]$Private:absExeName = [System.IO.Path]::GetFullPath("$($path)/$Private:exeName") - [bool]$Private:hasLink = Test-Path -LiteralPath $Private:absLinkName -PathType Leaf - [bool]$Private:hasExe = Test-Path -LiteralPath $Private:absExeName -PathType Leaf - - if ($Private:hasLink -or $Private:hasExe) { - [PsCustomObject]@{ - Path = [System.IO.Path]::GetFullPath($path) - HasLink = $Private:hasLink - HasExe = $Private:hasExe - LinkPath = $Private:absLinkName - ExePath = $Private:absExeName - } - } - } -} - -<# -.SYNOPSIS - Installs NLedger -.DESCRIPTION - Checks environment status and installs NLedger (adds to PATH, creates 'ledger' alias and runs NGen for .Net Framework binaries). -.PARAMETER path - Path to NLedger executable binaries -#> -function Install-NLeger { - [CmdletBinding()] - Param([Parameter(Mandatory=$True)][string]$path) - - Write-Verbose "Installing NLedger (path $path)" - if (!(Test-Path -LiteralPath $path -PathType Container)) { throw "Folder not found: $path" } - - [string]$Private:linkName = [System.IO.Path]::GetFullPath("$($path)/ledger$(if($Script:isWindowsPlatform){".exe"})") - [string]$Private:exeName = [System.IO.Path]::GetFullPath("$($path)/NLedger-cli$(if($Script:isWindowsPlatform){".exe"})") - - if (!(Test-Path -LiteralPath $Private:exeName -PathType Leaf)) { throw "Required file not found: $Private:exeName" } - - $Private:installedInfo = Get-NLedgerInstalls - - if($Private:installedInfo) { - - $Private:externalInstalls = $Private:installedInfo | Where-Object { !(Test-PathsAreEqual $_.Path $path) } - if ($Private:externalInstalls) { - [string]$Private:externalPaths = ($Private:externalInstalls | Select-Object -ExpandProperty Path) -join "," - throw "[Uninstall other copies of NLedger] Cannot install NLedger located by path $path because of other Ledger or NLedger contributions found in folder(s): $Private:externalPaths" - } - - Write-Verbose "NLedger is already installed by path $path" - - if (Test-CanCallNGen) { - Write-Verbose "Updating NGen native image (if possible) $($Private:exeName)" - $null = Remove-NGenImage $Private:exeName - $null = Add-NGenImage $Private:exeName - } - - if (!($Private:installedInfo.HasLink)) { - Write-Verbose "Adding hard link $Private:linkName to $Private:exeName" - $null = Add-HardLink -linkPath $Private:linkName -filePath $Private:exeName - } - } else { - - if (Test-CanCallNGen) { - Write-Verbose "Adding NGen native image (if possible) $($Private:exeName)" - $null = Add-NGenImage $Private:exeName - } - - Write-Verbose "Adding hard link $($Private:linkName)" - if (Test-HardLink $Private:linkName) { Remove-HardLink $Private:linkName} - $null = Add-HardLink -linkPath $Private:linkName -filePath $Private:exeName - - Write-Verbose "Adding to PATH: $path" - Add-Path $path - } - - Write-Verbose "Installation finished" -} - -<# -.SYNOPSIS - Uninstalls NLedger -.DESCRIPTION - Checks environment status and uninstalls NLedger (removes from PATH, deletes 'ledger' alias and removed NGen image for .Net Framework binaries). -.PARAMETER path - Path to NLedger executable binaries -#> -function Uninstall-NLedger { - [CmdletBinding()] - Param() - Write-Verbose "Uninstalling NLedger" - - foreach($info in Get-NLedgerInstalls) { - Write-Verbose "Uniinstalling NLedger path $($info.Path)" - - if (!($info.HasExe)) { - Write-Warning "Folder $($info.Path) contains 'ledger' but not 'NLedger-cli'. It might indicate that this folder is not part of NLedger contribution and should not be removed from PATH" - } else { - if ($info.HasLink) { - Write-Verbose "Removing hard link $($info.LinkPath)" - $null = Remove-HardLink $info.LinkPath - } - if (Test-CanCallNGen) { - Write-Verbose "Removing NGen native image (if presented) $($info.ExePath)" - $null = Remove-NGenImage $info.ExePath - } - Write-Verbose "Removing from PATH" - Remove-Path $info.Path - } - } - Write-Verbose "Uninstalling finished" -} - -<# -.SYNOPSIS - Returns a summary status for NLedger deployment -.DESCRIPTION - Observes the current machine and collects information about NLedger deployment (available and installed binaries) -#> -function Get-NLedgerDeploymentStatus{ - [CmdletBinding()] - Param() - - # Detect current biinaries - [string]$Private:frameworkNLedger = Get-NLedgerPath -preferCore:$false - [string]$Private:coreNLedger = Get-NLedgerPath -preferCore:$true - if ($Private:frameworkNLedger -eq $Private:coreNLedger) { $Private:frameworkNLedger = $null } - [bool]$Private:binaryExist = ($Private:frameworkNLedger) -or ($Private:coreNLedger) - - # Detect existing installations - $Private:existingInstalls = Get-NLedgerInstalls - - $Private:currentInstall = $null - if ($Private:frameworkNLedger) { $Private:currentInstall = $Private:existingInstalls | Where-Object { Test-PathsAreEqual $_.Path ([System.IO.Path]::GetDirectoryName($Private:frameworkNLedger)) } } - if (($Private:coreNLedger) -and !($Private:currentInstall)) { $Private:currentInstall = $Private:existingInstalls | Where-Object { Test-PathsAreEqual $_.Path ([System.IO.Path]::GetDirectoryName($Private:coreNLedger)) } } - - $Private:externalInstalls = $Private:existingInstalls - if ($Private:currentInstall) { $Private:externalInstalls = $Private:externalInstalls | Where-Object { $_.Path -ne $Private:currentInstall.Path } } - - [bool]$Private:isCore = $false - if ($Private:currentInstall) { $Private:isCore = Test-PathsAreEqual $Private:currentInstall.Path ([System.IO.Path]::GetDirectoryName($Private:coreNLedger)) } - - [PsCustomObject]@{ - FrameworkNLedger = $Private:frameworkNLedger - CoreNLedger = $Private:coreNLedger - BinaryExist = $Private:binaryExist - ExistingInstalls = $Private:existingInstalls - HasExistingInstalls = !(!($Private:existingInstalls)) - CurrentInstall = $Private:currentInstall - HasCurrentInstall = !(!($Private:currentInstall)) - IsCurrentInstallCore = $Private:isCore - ExternalInstalls = $Private:externalInstalls - HasExternalInstalls = !(!($Private:externalInstalls)) - } - -} diff --git a/Contrib/Install/NLedger.Install.cmd b/Contrib/Install/NLedger.Install.cmd deleted file mode 100644 index 03c6f5e5..00000000 --- a/Contrib/Install/NLedger.Install.cmd +++ /dev/null @@ -1 +0,0 @@ -PowerShell -ExecutionPolicy RemoteSigned -File "%~dp0NLedger.Launcher.ps1" \ No newline at end of file diff --git a/Contrib/Install/NLedger.Install.ps1 b/Contrib/Install/NLedger.Install.ps1 deleted file mode 100644 index 9b52835a..00000000 --- a/Contrib/Install/NLedger.Install.ps1 +++ /dev/null @@ -1,134 +0,0 @@ -<# -.SYNOPSIS - Installs or uninstall NLedger binaries on any platform (Windows, Linux, OSX). -.DESCRIPTION - Installing NLedger is an optional operation that may improve it's usability. - It performs three basic actions: - 1) Adds the path to NLedger binaries to PATH variable so that you can call in any folder; - 2) Creates an alias (hard link) 'ledger' to 'NLedger-cli.exe' to let you use a typical name; - 3) For .Net Framework, it calls NGen to create a very efficient native image for NLedger binaries that - dramatically improves performance. Note: this action requires administrative priviledges. - If no switches are specified, this script can play a role of an interactive console where the user - can enter available commands and check the result status. Available commands are shown when the script is run. -.PARAMETER install - Installs NLedger binaries. If there are binaries for both platforms (.Net Framework and .Net Core), prefers .Net Framework, -.PARAMETER installPreferCore - Installs NLedger binaries but prefers .Net Core binaries if there is a choice. -.PARAMETER uninstall - Uninstalls NLedger (removes from PATH, deletes 'ledger' alias and deletes NGen image for .Net Framework) -.EXAMPLE - C:\PS> .\NLedger.Install.ps1 - Runs the script as an interactive console. Help script is shown and the user can enter commands. -.EXAMPLE - C:\PS> .\NLedger.Install.ps1 -uninstall - Uninstalls NLedger from the system. -.NOTES - Author: Dmitry Merzlyakov - Date: December 21, 2017 - - - If you do not want to enable PS scripts globally on your machine, - execute the following command in PS console: - set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process -#> - -[CmdletBinding()] -Param( - [Switch][bool]$install = $False, - [Switch][bool]$installPreferCore = $False, - [Switch][bool]$uninstall = $False -) - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path -Import-Module $Script:ScriptPath/NLInstall.psm1 -Force -Import-Module $Script:ScriptPath/../NLManagement/NLWhere.psm1 -Force - -trap -{ - write-error $_ - exit 1 -} - -function status{ - [CmdletBinding()] - Param([Switch][bool]$details = $False) - - $Private:status = Get-NLedgerDeploymentStatus - - if ($details) { - Write-Host "NLedger executable [Framework]: $(if($Private:status.FrameworkNLedger){$Private:status.FrameworkNLedger}else{"[Not found]"})" - Write-Host "NLedger executable [Core ]: $(if($Private:status.CoreNLedger){$Private:status.CoreNLedger}else{"[Not found]"})" - if(!$Private:status.BinaryExist) { Write-Host "NLedger binaries not found."} - } - - if ($details) { - if ($Private:status.HasExternalInstalls) { - Write-Host "Detected other NLedger deployments:" - foreach($info in $Private:status.ExternalInstalls) { Write-Host "$(if($info.HasExe){"Has 'NLedger-cli'"})$(if($info.HasLink){"[Has 'ledger']"}) $($info.Path)"} - } - if ($Private:status.HasCurrentInstall) { - Write-Host "Current binaries are installed: $(if($Private:status.CurrentInstall.HasExe){"Has 'NLedger-cli'"})$(if($Private:status.CurrentInstall.HasLink){"[Has 'ledger']"}) $($Private:status.CurrentInstall.Path)" - } else { - Write-Host "Current binaries are not installed" - } - } - - # Finalize status - if (!$Private:status.BinaryExist) { Write-Host -ForegroundColor Yellow "[Install is not possible] No available binaries to install. Check that they are built." } - if ($Private:status.HasExternalInstalls) { Write-Host -ForegroundColor Yellow "[Install is not possible] There are other NLedger deployments. Uninstall them first (use uninstall command)" } - - if ($Private:status.HasCurrentInstall) { - Write-Host -ForegroundColor Yellow "[NLedger is installed] [$(if($Private:status.IsCurrentInstallCore){"Core"}else{"Framework"}) platform] [$(if($Private:status.CurrentInstall.HasLink){"Alias 'ledger'"}else{"No 'ledger' alias"})] [$([System.IO.Path]::GetFileName($Private:status.CurrentInstall.ExePath))]" - Write-Host -ForegroundColor Yellow "Path: $($Private:status.CurrentInstall.Path)" - } else { - Write-Host -ForegroundColor Yellow "[NLedger is not installed] Use 'install' or 'install -core' command to install it." - } -} - -function install{ - Param([Switch][bool]$core = $False) - - $Private:status = Get-NLedgerDeploymentStatus - if ($Private:status.HasCurrentInstall -and !$Private:status.HasExternalInstalls) { Uninstall-NLedger } - - [string]$Script:nLedgerPath = Get-NLedgerPath -preferCore:$core - if(!($Script:nLedgerPath)) { "Cannot find NLedger binaries. Make sure that they are properly built."} - Install-NLeger -path $([System.IO.Path]::GetDirectoryName($Script:nLedgerPath)) - - Write-Host "Installation finished. It is recommended to start a new terminal session." - status -} - -function uninstall { - param () - Uninstall-NLedger - - Write-Host "Uninstalling finished. It is recommended to start a new terminal session." - status -} - -function help { - param () - - Write-Host "*** NLedger installer console ***" - Write-Host - Write-Host "Available commands: (type in Powershell console)" - Write-Host ">install [-core] Install NLedger binaries (add to PATH and create 'ledger' hard link)" - Write-Host " Switch -core prefers Core binaries if both Core and Framework executables are available)" - Write-Host ">uninstall Uninstall NLedger (remove from PATH and delete a hard link)" - Write-Host ">status [-details] Show current deployment status" - Write-Host ">help Show this information again" - Write-Host ">exit Close the console window" - Write-Host -} - -if($install) {install} -else { - if ($installPreferCore) {installPreferCore} - else { - if ($uninstall) {uninstall} - else { - help - status - } - } -} diff --git a/Contrib/Install/NLedger.Launcher.ps1 b/Contrib/Install/NLedger.Launcher.ps1 deleted file mode 100644 index 40227ce1..00000000 --- a/Contrib/Install/NLedger.Launcher.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -# This scripts runs the installer with elevated priviledges and keeps PS console open to let people read the status of installation activities. -[CmdletBinding()] -Param( - [Switch][bool]$uninstall = $False -) - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path -[string]$Script:InstallScriptPath = Resolve-Path (Join-Path $Script:ScriptPath "./NLedger.Install.ps1") -ErrorAction Stop - -[string]$Script:argList = "-NoExit -ExecutionPolicy RemoteSigned -File ""$Script:InstallScriptPath"" " -if ($uninstall) { $Script:argList += " -uninstall" } -if ($VerbosePreference -eq "Continue") { $Script:argList += " -verbose" } -Write-Verbose "Command line to execute: $Script:argList" - -Start-Process powershell.exe -Verb RunAs -ArgumentList ($Script:argList) \ No newline at end of file diff --git a/Contrib/Install/NLedger.Uninstall.cmd b/Contrib/Install/NLedger.Uninstall.cmd deleted file mode 100644 index 47242ba3..00000000 --- a/Contrib/Install/NLedger.Uninstall.cmd +++ /dev/null @@ -1 +0,0 @@ -PowerShell -ExecutionPolicy RemoteSigned -File "%~dp0NLedger.Launcher.ps1" -uninstall \ No newline at end of file diff --git a/Contrib/Install/SysHardLink.psm1 b/Contrib/Install/SysHardLink.psm1 deleted file mode 100644 index 1b689940..00000000 --- a/Contrib/Install/SysHardLink.psm1 +++ /dev/null @@ -1,71 +0,0 @@ -<# -.SYNOPSIS - Powershell module that helps managing hard links for files -.DESCRIPTION - Creates, removes and checks file hard links on any platform (Wiindows, Linux, OSX) -.NOTES - Author: Dmitry Merzlyakov - Date: September 04, 2020 -#> - -[CmdletBinding()] -Param() - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path - -<# -.SYNOPSIS - Checks whether given path is a hard link to a file -.DESCRIPTION - ReturnsTrue If the parameter is a hard link or False otherwise. -.PARAMETER linkPath - Path to a file or link. -#> -function Test-HardLink{ - [CmdletBinding()] - Param([Parameter(Mandatory=$True)][string]$linkPath) - - if (Test-Path -LiteralPath $linkPath -PathType Leaf) { - return !(!(Get-ChildItem -LiteralPath $linkPath | Where-Object {$_.LinkType -eq 'HardLink'})) - } -} - -<# -.SYNOPSIS - Creates a hard link to a file -.DESCRIPTION - If the target file exist and a link does not exist - creates a hard link. -.PARAMETER filePath - Path to an existing file. -.PARAMETER linkPath - Path to a link that needs to be created. -#> -function Add-HardLink { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$filePath, - [Parameter(Mandatory=$True)][string]$linkPath - ) - - if (!(Test-Path -LiteralPath $filePath -PathType Leaf)) { throw "Link target file does not exist: $filePath" } - if (Test-Path -LiteralPath $linkPath -PathType Leaf) { throw "Link name already exist: $linkPath" } - - $null = (New-Item -ItemType HardLink -Path $linkPath -Value $filePath -ErrorAction Stop) -} - -<# -.SYNOPSIS - Removes a hard link to a file -.DESCRIPTION - If the parameter is a path to a hard link - removes a hard link. -.PARAMETER linkPath - Path to a link that needs to be removed. -#> -function Remove-HardLink { - [CmdletBinding()] - Param([Parameter(Mandatory=$True)][string]$linkPath) - - if(Test-HardLink $linkPath) { - $null = (Remove-Item $linkPath) - } -} diff --git a/Contrib/Install/SysNGen.psm1 b/Contrib/Install/SysNGen.psm1 deleted file mode 100644 index 861e96d2..00000000 --- a/Contrib/Install/SysNGen.psm1 +++ /dev/null @@ -1,124 +0,0 @@ -<# -.SYNOPSIS - Powershell module that helps managing .Net Framework native images -.DESCRIPTION - Creates, removes and checks status for .Net Framework native images by calling NGen -.NOTES - Author: Dmitry Merzlyakov - Date: September 04, 2020 -#> - -[CmdletBinding()] -Param() - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path - -[bool]$Script:isWindowsPlatform = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows) - -<# -.SYNOPSIS - Checks whether current user has administrative privileges -.DESCRIPTION - Returns True or False depending on whether current script is run as administrator -#> -function Test-AdministrativePriviledges { - [CmdletBinding()] - Param() - - return $Script:isWindowsPlatform -and ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -} - -<# -.SYNOPSIS - Returns paths to all installed NGen on current environment -.DESCRIPTION - Checks the latest installed .Net Framework and returns absolute paths to NGen executable files (x86 and x64 versions). -#> -function Get-InstalledNGens { - [CmdletBinding()] - Param() - - [string]$Private:ngen64 = "$((Get-ItemProperty "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").InstallPath)ngen.exe" - [string]$Private:ngen32 = "$((Get-ItemProperty "HKLM:SOFTWARE\WOW6432Node\Microsoft\NET Framework Setup\NDP\v4\Full").InstallPath)ngen.exe" - - if (Test-Path -LiteralPath $Private:ngen64 -PathType Leaf) { $Private:ngen64 } - if (Test-Path -LiteralPath $Private:ngen32 -PathType Leaf) { $Private:ngen32 } -} - -<# -.SYNOPSIS - Checks whether NGen functions can be called -.DESCRIPTION - The conditions are: windows platform, administrative privileges, NGen is available -#> -function Test-CanCallNGen { - [CmdletBinding()] - Param() - - return $Script:isWindowsPlatform -and (Test-AdministrativePriviledges) -and (Get-InstalledNGens) -} - -<# -.SYNOPSIS - Checks whether given .Net binary file has a native image -.DESCRIPTION - Executes NGen display command to verify the status for given .Net binary file -.PARAMETER ngenPath - Absoulte path to NGen executable file. -.PARAMETER path - Absolute path to a .Net Framework binary file. -#> -function Test-NGenImage { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$ngenPath, - [Parameter(Mandatory=$True)][string]$path - ) - - if(!(Test-Path -LiteralPath $ngenPath -PathType Leaf)) { throw "Cannot find $ngenPath" } - [string]$Private:displayResult = & $Private:ngenPath display $path - Write-Verbose "NGen display responds $Private:displayResult" - return ($Private:displayResult -notmatch "The specified assembly is not installed" ) -} - -<# -.SYNOPSIS - Creates a native image for a .Net binary file -.DESCRIPTION - Executes NGen install command to create a native image for a .Net binary file if it has not been installed yet -.PARAMETER path - Absolute path to a .Net Framework binary file. -#> -function Add-NGenImage { - [CmdletBinding()] - Param([Parameter(Mandatory=$True)][string]$path) - - if(!(Test-Path -LiteralPath $path -PathType Leaf)) { throw "Cannot find the assembly $path" } - - foreach($Private:ngenPath in (Get-InstalledNGens | Where-Object {!(Test-NGenImage $_ $path)}) ) { - [string]$Private:installResult = & $Private:ngenPath install $path - Write-Verbose "NGen install responds $Private:installResult" - if ($installResult -match "error") { Write-Verbose "Error adding assembly $path" } - } -} - -<# -.SYNOPSIS - Removes a native image of a .Net binary file from NGen repository -.DESCRIPTION - Executes NGen uninstall command to remove a native image if it has not been removed yet -.PARAMETER path - Absolute path to a .Net Framework binary file. -#> -function Remove-NGenImage { - [CmdletBinding()] - Param([Parameter(Mandatory=$True)][string]$path) - - if(!(Test-Path -LiteralPath $path -PathType Leaf)) { throw "Cannot find the assembly $path" } - - foreach($Private:ngenPath in (Get-InstalledNGens | Where-Object {Test-NGenImage $_ $path}) ) { - [string]$Private:uninstallResult = & $ngenPath uninstall $path - Write-Verbose "NGen uninstall responds $Private:uninstallResult" - if ($uninstallResult -match "error") { Write-Verbose "Error removing assembly $path" } - } -} diff --git a/Contrib/Install/SysPath.psm1 b/Contrib/Install/SysPath.psm1 deleted file mode 100644 index 806835f7..00000000 --- a/Contrib/Install/SysPath.psm1 +++ /dev/null @@ -1,160 +0,0 @@ -<# -.SYNOPSIS - Powershell module that manages shell PATH variable -.DESCRIPTION - Adds, removes and checks paths in PATH variable on any platform (Wiindows, Linux, OSX) -.NOTES - Author: Dmitry Merzlyakov - Date: September 04, 2020 -#> - -[CmdletBinding()] -Param() - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path - -[bool]$Script:isWindowsPlatform = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows) -[string]$Script:PathsSeparator = $(if($Script:isWindowsPlatform){";"}else{":"}) - -# Locate shell config file for unix-like platforms (linux and OSX) -[string]$Script:ShellConfig = $null -if(!$Script:isWindowsPlatform) { - if ($env:SHELL -eq "/bin/zsh") { - $Script:ShellConfig = "$HOME/.zshrc" - } else { - $Script:ShellConfig = "$HOME/.bashrc" - if(!(Test-Path -LiteralPath $Script:ShellConfig -PathType Leaf)) { $Script:ShellConfig = "$HOME/.bash_profile" } - } - if(!(Test-Path -LiteralPath $Script:ShellConfig -PathType Leaf)) { $null = Add-Content $Script:ShellConfig "" } - if(!(Test-Path -LiteralPath $Script:ShellConfig -PathType Leaf)) { throw "Cannot find shell config file" } -} - -<# -.SYNOPSIS - Forces reading recent changes in PATH variable -.DESCRIPTION - Restars windows explorer so that a new process gets updated PATH variable. Does nothing on non-windows platforms. -#> -function Reset-Shell { - [CmdletBinding()] - Param() - - if ($Script:isWindowsPlatform) { - Write-Verbose "Restarting windows explorer" - $null = (Stop-Process -ProcessName "explorer") - } else { - # Do nothing on non-windows platform. It is basically a good idea to execute "source ..." command in the parent shell, but it is too complicated. - } -} - -<# -.SYNOPSIS - Compares two paths -.DESCRIPTION - Checks whether two paths are equal and retrns True or False. Properly manages relative and do-normalized paths. -.PARAMETER pathA - First path -.PARAMETER pathB - Second path -#> -function Test-PathsAreEqual { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$pathA, - [Parameter(Mandatory=$True)][string]$pathB - ) - - if (!(Test-Path -LiteralPath $pathA -PathType Container) -or !(Test-Path -LiteralPath $pathB -PathType Container)) { return $false } - [string]$Private:dirA = [System.IO.Path]::GetFullPath("$pathA/.") - [string]$Private:dirB = [System.IO.Path]::GetFullPath("$pathB/.") - - return $(if($Script:isWindowsPlatform){$Private:dirA -eq $Private:dirB}else{$Private:dirA -ceq $Private:dirB}) -} - -<# -.SYNOPSIS - Returns a collection of all paths -.DESCRIPTION - Return only valid entries (empty values are ommitted) as a collection of strings -#> -function Get-Paths { - [CmdletBinding()] - Param() - - return $env:PATH -split $Script:PathsSeparator | Where-Object{$_} -} - -<# -.SYNOPSIS - Checks whether given path is in PATH variable -.DESCRIPTION - Returns True or False depending on whether given path is in PATH variable. Properly manages relative and do-normalized paths. -#> -function Test-PathInPaths { - [CmdletBinding()] - Param([Parameter(Mandatory=$True)][string]$path) - - return !(!(Get-Paths | Where-Object{ $(Test-PathsAreEqual $_ $path)})) -} - -<# -.SYNOPSIS - Adds path to PATH variable -.DESCRIPTION - Adds a path to PATH variable if it is not there yet. Properly manages relative and do-normalized paths. Resets shell in case of changes in PATH. -#> -function Add-Path { - [CmdletBinding()] - Param([Parameter(Mandatory=$True)][string]$path) - - if (!(Test-Path -LiteralPath $path -PathType Container)) { throw "Path $path does not exist" } - if (!(Test-PathInPaths $path)) { - - if ($Script:isWindowsPlatform) { - [System.Environment]::SetEnvironmentVariable("PATH","$($env:PATH)$($Script:PathsSeparator)$path",[System.EnvironmentVariableTarget]::User) - } else { - [string]$Private:exportString = "export PATH=`$PATH:$path" - [string]$Private:escapedExportString = [System.Text.RegularExpressions.Regex]::Escape($Private:exportString) - if(!(Select-String -LiteralPath $Script:ShellConfig -Pattern $Private:escapedExportString)) { # Check whether the file already contains the string - $Private:content = Get-Content $Script:ShellConfig - $null = ($Private:content | Out-File "$($Script:ShellConfig).old") - $null = Add-Content $Script:ShellConfig $Private:exportString - } - } - - $env:PATH = "$($env:PATH)$($Script:PathsSeparator)$path" - $null = Reset-Shell - } -} - -<# -.SYNOPSIS - Removes path from PATH variable -.DESCRIPTION - Removes a path from PATH variable if it is currently there. Properly manages relative and do-normalized paths. Resets shell in case of changes in PATH. -#> -function Remove-Path { - [CmdletBinding()] - Param([Parameter(Mandatory=$True)][string]$path) - - if (!(Test-Path -LiteralPath $path -PathType Container)) { throw "Path $path does not exist" } - if (Test-PathInPaths $path) { - - if ($Script:isWindowsPlatform) { - [string]$Private:paths = ( Get-Paths | Where-Object { !(Test-PathsAreEqual $_ $path) } ) -join $($Script:PathsSeparator) - [System.Environment]::SetEnvironmentVariable("PATH",$Private:paths,[System.EnvironmentVariableTarget]::User) - } else { - [string]$Private:exportString = "export PATH=`$PATH:$path" - [string]$Private:escapedExportString = [System.Text.RegularExpressions.Regex]::Escape($Private:exportString) - if(Select-String -LiteralPath $Script:ShellConfig -Pattern $Private:escapedExportString) { # Check whether the string was already removed - $Private:content = Get-Content $Script:ShellConfig - $null = ($Private:content | Out-File "$($Script:ShellConfig).old") - $Private:content = $Private:content | Where-Object { $_ -ne $Private:exportString } - $null = ($Private:content | Out-File $Script:ShellConfig ) - } - } - - $env:PATH = ( Get-Paths | Where-Object { !(Test-PathsAreEqual $_ $path) } ) -join $($Script:PathsSeparator) - $null = Reset-Shell - } -} diff --git a/Contrib/NLManagement/NLDoc.LiveDemo.Launch.cmd b/Contrib/LiveDemo/NLDoc.LiveDemo.Launch.cmd similarity index 91% rename from Contrib/NLManagement/NLDoc.LiveDemo.Launch.cmd rename to Contrib/LiveDemo/NLDoc.LiveDemo.Launch.cmd index 947c0031..3f9458d0 100644 --- a/Contrib/NLManagement/NLDoc.LiveDemo.Launch.cmd +++ b/Contrib/LiveDemo/NLDoc.LiveDemo.Launch.cmd @@ -1,5 +1,5 @@ -@prompt $g -@echo[ -@echo ^>%CMDTOVIEW% -@echo[ -@%CMDTORUN% +@prompt $g +@echo[ +@echo ^>%CMDTOVIEW% +@echo[ +@%CMDTORUN% diff --git a/Contrib/NLManagement/NLDoc.LiveDemo.Launch.sh b/Contrib/LiveDemo/NLDoc.LiveDemo.Launch.sh similarity index 100% rename from Contrib/NLManagement/NLDoc.LiveDemo.Launch.sh rename to Contrib/LiveDemo/NLDoc.LiveDemo.Launch.sh diff --git a/Contrib/NLManagement/NLDoc.LiveDemo.config.xml b/Contrib/LiveDemo/NLDoc.LiveDemo.config.xml similarity index 98% rename from Contrib/NLManagement/NLDoc.LiveDemo.config.xml rename to Contrib/LiveDemo/NLDoc.LiveDemo.config.xml index c6f8f8d5..54ebce92 100644 --- a/Contrib/NLManagement/NLDoc.LiveDemo.config.xml +++ b/Contrib/LiveDemo/NLDoc.LiveDemo.config.xml @@ -1,429 +1,429 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Contrib/NLManagement/NLDoc.LiveDemo.ledger3.html b/Contrib/LiveDemo/NLDoc.LiveDemo.ledger3.html similarity index 98% rename from Contrib/NLManagement/NLDoc.LiveDemo.ledger3.html rename to Contrib/LiveDemo/NLDoc.LiveDemo.ledger3.html index 97eed5a1..0af99e15 100644 --- a/Contrib/NLManagement/NLDoc.LiveDemo.ledger3.html +++ b/Contrib/LiveDemo/NLDoc.LiveDemo.ledger3.html @@ -1,77 +1,77 @@ - - - - - - -Ledger: Command-Line Accounting - - - - - - - - - - - - - + + + - - + + - -

Ledger: Command-Line Accounting

- - - - - - - - - - - - - - -

Table of Contents

- -
- - -
- - - - -
-

-Next: , Previous: , Up: (dir)   [Contents][Index]

-
- -

Overview

- -

Ledger is a command-line accounting tool that provides double-entry -accounting based on a text journal. It provides no bells or whistles, -and returns the user to the days before user interfaces were even a -twinkling in their fathers’ CRTs. -

- - - - - - - - - - - - - - - - - - - - - - - -
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

1 Introduction to Ledger

- - - - - - - - -
- - - -

1.1 Fat-free Accounting

- -

Ledger is an accounting tool with the moxie to exist. It provides no -bells or whistles, and returns the user to the days before user -interfaces were even a twinkling in their father’s CRT. -

-

What it does offer is a double-entry accounting journal with all the -flexibility and muscle of its modern day cousins, without any of the -fat. Think of it as the Bran Muffin of accounting tools. -

-

To use it, you need to start keeping a journal. This is the basis of -all accounting, and if you haven’t started yet, now is the time to -learn. The little booklet that comes with your checkbook is a journal, -so we’ll describe double-entry accounting in terms of that. -

- -

A checkbook journal records debits (subtractions, or withdrawals) and -credits (additions, or deposits) with reference to a single account: -the checking account. Where the money comes from, and where it goes -to, are described in the payee field, where you write the person or -company’s name. The ultimate aim of keeping a checkbook journal is to -know how much money is available to spend. That’s really the aim of -all journals. -

- -

What computers add is the ability to walk through these postings, -and tell you things about your spending habits; to let you devise -budgets and get control over your spending; to squirrel away money -into virtual savings account without having to physically move money -around; etc. As you keep your journal, you are recording information -about your life and habits, and sometimes that information can start -telling you things you aren’t aware of. Such is the aim of all good -accounting tools. -

-

The next step up from a checkbook journal, is a journal that keeps -track of all your accounts, not just checking. In such a journal, you -record not only who gets paid—in the case of a debit—but where the -money came from. In a checkbook journal, it’s assumed that all the -money comes from your checking account. But in a general journal, you -write postings in two lines: the source account and target account. -There must always be a debit from at least one account for every -credit made to another account. This is what is meant by -“double-entry” accounting: the journal must always balance to zero, -with an equal number of debits and credits. -

-

For example, let’s say you have a checking account and a brokerage -account, and you can write checks from both of them. Rather than keep -two checkbooks, you decide to use one journal for both. In this -general journal you need to record a payment to Pacific Bell for your -monthly phone bill, and a transfer (via check) from your brokerage -account to your checking account. The Pacific Bell bill is $23.00, -let’s say, and you want to pay it from your checking account. In the -general journal you need to say where the money came from, in addition -to where it’s going to. These transactions might look like this: -

-
-
9/29        Pacific Bell                $23.00     $23.00
-            Checking                   $-23.00          0
-9/30        Checking                   $100.00    $100.00
-      (123) Brokerage                 $-100.00          0
-
- -

The posting must balance to $0: $23 went to Pacific Bell, $23 came -from Checking. The next entry shows check number 123 written against -your brokerage account, transferring money to your checking account. -There is nothing left over to be accounted for, since the money has -simply moved from one account to another in both cases. This is the -basis of double-entry accounting: money never pops in or out of -existence; it is always a posting from one account to another. -

-

Keeping a general journal is the same as keeping two separate -journals: One for Pacific Bell and one for Checking. In that case, -each time a payment is written into one, you write a corresponding -withdrawal into the other. This makes it easier to write in -a “running balance”, since you don’t have to look back at the last -time the account was referenced—but it also means having a lot of -journal books, if you deal with multiple accounts. -

- - -

Here is a good place for an aside on the use of the word “account”. -Most private people consider an account to be something that holds -money at an institution for them. Ledger uses a more general -definition of the word. An account is anywhere money can go. Other -finance programs use “categories”, Ledger uses accounts. So, for -example, if you buy some groceries at Trader Joe’s, then more groceries -at Whole Food Market, you might assign the transactions like this -

-
-
2011/03/15   Trader Joe's
-    Expenses:Groceries   $100.00
-    Assets:Checking
-2011/03/15   Whole Food Market
-    Expenses:Groceries   $75.00
-    Assets:Checking
-
- -

In both cases the money goes to the ‘Groceries’ account, even -though the payees were different. You can set up your accounts in any -way you choose. -

-

Enter the beauty of computerized accounting. The purpose of the -Ledger program is to make general journal accounting simple, by -keeping track of the balances for you. Your only job is to enter the -postings. If an individual posting does not balance, Ledger displays -an error and indicates the incorrect posting.1 -

-

In summary, there are two aspects of Ledger use: updating the journal -data file, and using the Ledger tool to view the summarized result of -your transactions. -

-

And just for the sake of example—as a starting point for those who -want to dive in head-first—here are the journal transactions from -above, formatted as the Ledger program wishes to see them: -

-
-
2004/09/29 Pacific Bell
-    Expenses:Pacific Bell              $23.00
-    Assets:Checking
-
- -

The account balances and registers in this file, if saved as -ledger.dat, could be reported using: -

-
-
$ ledger -f ledger.dat balance
-
- -
-
             $-23.00  Assets:Checking
-              $23.00  Expenses:Pacific Bell
---------------------
-                   0
-
- -

Or -

-
-
$ ledger -f ledger.dat register checking
-
- -
-
04-Sep-29 Pacific Bell          Assets:Checking             $-23.00      $-23.00
-
- -

And even: -

-
-
$ ledger -f ledger.dat register Bell
-
- -
-
04-Sep-29 Pacific Bell          Expenses:Pacific Bell        $23.00       $23.00
-
- -

An important difference between Ledger and other finance packages is -that Ledger will never alter your input file. You can create and edit -that file in any way you prefer, but Ledger is only for analyzing the -data, not for altering it. -

-
- - - -

1.2 Building the program

- -

Ledger is written in ANSI C++, and should compile on any unix platform. -The easiest way to build and install ledger is to use the prepared -acprep script, that does a lot of the footwork: -

-
-
    # to install missing dependencies
-    ./acprep dependencies
-    # building ledger
-    ./acprep update
-    # to run the actual installation
-    make install
-
- -

See the ‘help‘ subcommand to ‘acprep‘, which explains some of its many -options. You can run ‘make check‘ to confirm the result, and ‘make -install‘ to install. If these instructions do not work for you, you can check the -‘INSTALL.md‘ in the source directory for more up to date build instructions. -

-
- - - -

1.3 Getting help

- - -

Ledger has a complete online help system based on GNU Info. This manual -can be searched directly from the command-line using info ledger, -which will bring up this entire manual in your TTY. Alternatively, the -shorter man page can be accessed from the command-line either via -man ledger or ledger --help -

-

If you need help on how to use Ledger, or run into problems, you can -join the Ledger mailing list at -http://groups.google.com/group/ledger-cli. -

-

You can also find help in the #ledger channel on the IRC server -irc.freenode.net. -

-
- - - -

1.4 Third-Party Ledger Tutorials

- -

There are plenty of people using Ledger for accounting applications. -Some have documented how they use Ledger’s features to solve their -accounting problems. -

-

One such tutorial, specifically designed for non-profit charities that seek -to use Ledger, can be found at -https://k.sfconservancy.org/NPO-Accounting/npo-ledger-cli (with a copy on GitHub also -available at https://github.com/conservancy/npo-ledger-cli/). If -you’re looking for information about how to use Ledger’s tagging system to -handle invoicing, track expenses by program targets, and other such concepts, -you might find the tutorial useful. (Some of the auditor reporting scripts -that relate to the aforementioned Ledger setup can be found -contrib/non-profit-audit-reports/ in Ledger’s own source repository.) -

-
- - - -

2 Ledger Tutorial

- - - - - - - -
- - - -

2.1 Start a Journal File

- - -

A journal is a record of your financial transactions and will be central -to using Ledger. For now we just want to get a taste of what Ledger can -do. An example journal is included with the source code distribution, -called drewr3.dat (see Example Journal File). Copy it -someplace convenient and open up a terminal window in that directory. -

-

If you would rather start with your own journal right away please -see Keeping a Journal. -

-
- - - -

2.2 Run a Few Reports

- - - - - - - - -

Please note that as a command-line program, Ledger is controlled from -your shell. There are several different command shells that all -behave slightly differently with respect to some special characters. -In particular, the “bash” shell will interpret ‘$’ signs -differently than ledger and they must be escaped to reach the actual -program. Another example is “zsh”, which will interpret ‘^’ -differently than ledger expects. In all cases that follow you should -take that into account when entering the command-line arguments as given. -There are too many variations between shells to give concrete examples -for each. -

-
- - - -

2.2.1 Balance Report

- - - -

To find the balances of all of your accounts, run this command: -

-
-
$ ledger -f drewr3.dat balance
-
- -

Ledger will generate: -

-
-
         $ -3,804.00  Assets
-          $ 1,396.00    Checking
-             $ 30.00      Business
-         $ -5,200.00    Savings
-         $ -1,000.00  Equity:Opening Balances
-          $ 6,654.00  Expenses
-          $ 5,500.00    Auto
-             $ 20.00    Books
-            $ 300.00    Escrow
-            $ 334.00    Food:Groceries
-            $ 500.00    Interest:Mortgage
-         $ -2,030.00  Income
-         $ -2,000.00    Salary
-            $ -30.00    Sales
-            $ -63.60  Liabilities
-            $ -20.00    MasterCard
-            $ 200.00    Mortgage:Principal
-           $ -243.60    Tithe
---------------------
-           $ -243.60
-
- -

Showing you the balance of all accounts. Options and search terms can -pare this down to show only the accounts you want. -

-

A more useful report is to show only your Assets and Liabilities: -

-
-
$ ledger -f drewr3.dat balance Assets Liabilities
-
- -
-
         $ -3,804.00  Assets
-          $ 1,396.00    Checking
-             $ 30.00      Business
-         $ -5,200.00    Savings
-            $ -63.60  Liabilities
-            $ -20.00    MasterCard
-            $ 200.00    Mortgage:Principal
-           $ -243.60    Tithe
---------------------
-         $ -3,867.60
-
- -
- - - -

2.2.2 Register Report

- - - -

To show all transactions and a running total: -

-
-
$ ledger -f drewr3.dat register
-
- -

Ledger will generate: -

-
-
10-Dec-01 Checking balance      Assets:Checking          $ 1,000.00   $ 1,000.00
-                                Equit:Opening Balances  $ -1,000.00            0
-10-Dec-20 Organic Co-op         Expense:Food:Groceries      $ 37.50      $ 37.50
-                                Expense:Food:Groceries      $ 37.50      $ 75.00
-                                Expense:Food:Groceries      $ 37.50     $ 112.50
-                                Expense:Food:Groceries      $ 37.50     $ 150.00
-                                Expense:Food:Groceries      $ 37.50     $ 187.50
-                                Expense:Food:Groceries      $ 37.50     $ 225.00
-                                Assets:Checking           $ -225.00            0
-10-Dec-28 Acme Mortgage         Lia:Mortgage:Principal     $ 200.00     $ 200.00
-                                Expe:Interest:Mortgage     $ 500.00     $ 700.00
-                                Expenses:Escrow            $ 300.00   $ 1,000.00
-                                Assets:Checking         $ -1,000.00            0
-11-Jan-02 Grocery Store         Expense:Food:Groceries      $ 65.00      $ 65.00
-                                Assets:Checking            $ -65.00            0
-11-Jan-05 Employer              Assets:Checking          $ 2,000.00   $ 2,000.00
-                                Income:Salary           $ -2,000.00            0
-                                (Liabilities:Tithe)       $ -240.00    $ -240.00
-11-Jan-14 Bank                  Assets:Savings             $ 300.00      $ 60.00
-                                Assets:Checking           $ -300.00    $ -240.00
-11-Jan-19 Grocery Store         Expense:Food:Groceries      $ 44.00    $ -196.00
-                                Assets:Checking            $ -44.00    $ -240.00
-11-Jan-25 Bank                  Assets:Checking          $ 5,500.00   $ 5,260.00
-                                Assets:Savings          $ -5,500.00    $ -240.00
-11-Jan-25 Tom's Used Cars       Expenses:Auto            $ 5,500.00   $ 5,260.00
-                                Assets:Checking         $ -5,500.00    $ -240.00
-11-Jan-27 Book Store            Expenses:Books              $ 20.00    $ -220.00
-                                Liabilities:MasterCard     $ -20.00    $ -240.00
-11-Dec-01 Sale                  Asse:Checking:Business      $ 30.00    $ -210.00
-                                Income:Sales               $ -30.00    $ -240.00
-                                (Liabilities:Tithe)         $ -3.60    $ -243.60
-
- -

To limit this to a more useful subset, simply add the accounts you are -interested in seeing transactions for: -

- - - -
-
$ ledger -f drewr3.dat register Groceries
-
- -
-
10-Dec-20 Organic Co-op         Expense:Food:Groceries      $ 37.50      $ 37.50
-                                Expense:Food:Groceries      $ 37.50      $ 75.00
-                                Expense:Food:Groceries      $ 37.50     $ 112.50
-                                Expense:Food:Groceries      $ 37.50     $ 150.00
-                                Expense:Food:Groceries      $ 37.50     $ 187.50
-                                Expense:Food:Groceries      $ 37.50     $ 225.00
-11-Jan-02 Grocery Store         Expense:Food:Groceries      $ 65.00     $ 290.00
-11-Jan-19 Grocery Store         Expense:Food:Groceries      $ 44.00     $ 334.00
-
- -

Which matches the balance reported for the ‘Groceries’ account: -

-
-
$ ledger -f drewr3.dat balance Groceries
-
- -
-
            $ 334.00  Expenses:Food:Groceries
-
- -

If you would like to find transaction to only a certain payee use -‘payee’ or ‘@’: -

-
-
$ ledger -f drewr3.dat register payee "Organic"
-
- -
-
10-Dec-20 Organic Co-op         Expense:Food:Groceries      $ 37.50      $ 37.50
-                                Expense:Food:Groceries      $ 37.50      $ 75.00
-                                Expense:Food:Groceries      $ 37.50     $ 112.50
-                                Expense:Food:Groceries      $ 37.50     $ 150.00
-                                Expense:Food:Groceries      $ 37.50     $ 187.50
-                                Expense:Food:Groceries      $ 37.50     $ 225.00
-                                Assets:Checking           $ -225.00            0
-
- -
- - - -

2.2.3 Cleared Report

- - - -

A very useful report is to show what your obligations are versus what -expenditures have actually been recorded. It can take several days for -a check to clear, but you should treat it as money spent. The -cleared report shows just that (note that the -cleared report will not format correctly for accounts that -contain multiple commodities): -

-
-
$ ledger -f drewr3.dat cleared
-
- -
-
     $ -3,804.00            $ 775.00                 Assets
-      $ 1,396.00            $ 775.00    10-Dec-20      Checking
-         $ 30.00                   0                     Business
-     $ -5,200.00                   0                   Savings
-     $ -1,000.00         $ -1,000.00    10-Dec-01    Equity:Opening Balances
-      $ 6,654.00            $ 225.00                 Expenses
-      $ 5,500.00                   0                   Auto
-         $ 20.00                   0                   Books
-        $ 300.00                   0                   Escrow
-        $ 334.00            $ 225.00    10-Dec-20      Food:Groceries
-        $ 500.00                   0                   Interest:Mortgage
-     $ -2,030.00                   0                 Income
-     $ -2,000.00                   0                   Salary
-        $ -30.00                   0                   Sales
-        $ -63.60                   0                 Liabilities
-        $ -20.00                   0                   MasterCard
-        $ 200.00                   0                   Mortgage:Principal
-       $ -243.60                   0                   Tithe
-----------------    ----------------    ---------
-       $ -243.60                   0             
-
- -

The first column shows the outstanding balance, the second column -shows the “cleared” balance. -

-
- -
-

-Previous: , Up: Run a Few Reports   [Contents][Index]

-
- -

2.2.4 Using the Windows Command-Line

- - - -

Using ledger under the windows command shell has one significant -limitation. CMD.EXE is limited to standard ASCII characters and as -such cannot display any currency symbols other than dollar signs -‘$’. -

-
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

3 Principles of Accounting with Ledger

- - - - - - - - - - - - -
- - - -

3.1 Accounting with Ledger

- - -

Accounting is simply tracking your money. It can range from nothing, -and just waiting for automatic overdraft protection to kick in, or -not, to a full-blown double-entry accounting system. Ledger -accomplishes the latter. With ledger you can handle your personal -finances or your business’s. Double-entry accounting scales. -

-
- - - -

3.2 Stating where money goes

- - -

Accountants will talk of “credits” and “debits”, but the meaning -is often different from the layman’s understanding. To avoid -confusion, Ledger uses only subtractions and additions, although the -underlying intent is the same as standard accounting principles. -

-

Recall that every posting will involve two or more accounts. -Money is transferred from one or more accounts to one or more other -accounts. To record the posting, an amount is subtracted -from the source accounts, and added to the target accounts. -

-

In order to write a Ledger transaction correctly, you must determine -where the money comes from and where it goes to. For example, when -you are paid a salary, you must add money to your bank account and -also subtract it from an income account: -

-
-
9/29  My Employer
-    Assets:Checking                           $500.00
-    Income:Salary                            $-500.00
-
- - - - -

Why is the Income a negative figure? When you look at the balance -totals for your ledger, you may be surprised to see that Expenses are -a positive figure, and Income is a negative figure. It may take some -getting used to, but to properly use a general ledger you must think -in terms of how money moves. Rather than Ledger “fixing” the minus -signs, let’s understand why they are there. -

-

When you earn money, the money has to come from somewhere. Let’s call -that somewhere “society”. In order for society to give you an -income, you must take money away (withdraw) from society in order to -put it into (make a payment to) your bank. When you then spend that -money, it leaves your bank account (a withdrawal) and goes back to -society (a payment). This is why Income will appear negative—it -reflects the money you have drawn from society—and why Expenses will -be positive—it is the amount you’ve given back. These additions and -subtractions will always cancel each other out in the end, because you -don’t have the ability to create new money: it must always come from -somewhere, and in the end must always leave. This is the beginning of -economy, after which the explanation gets terribly difficult. -

-

Based on that explanation, here’s another way to look at your balance -report: every negative figure means that that account or person or -place has less money now than when you started your ledger; and every -positive figure means that that account or person or place has more -money now than when you started your ledger. Make sense? -

-
- - - -

3.3 Assets and Liabilities

- - - -

Assets are money that you have, and Liabilities are money that you -owe. “Liabilities” is just a more inclusive name for Debts. -

-

An Asset is typically increased by transferring money from an Income -account, such as when you get paid. Here is a typical transaction: -

-
-
2004/09/29  My Employer
-    Assets:Checking               $500.00
-    Income:Salary
-
- -

Money, here, comes from an Income account belonging to ‘My -Employer’, and is transferred to your checking account. The money is -now yours, which makes it an Asset. -

-

Liabilities track money owed to others. This can happen when you -borrow money to buy something, or if you owe someone money. Here is -an example of increasing a MasterCard liability by spending money with -it: -

-
-
2004/09/30  Restaurant
-    Expenses:Dining                $25.00
-    Liabilities:MasterCard
-
- -

The Dining account balance now shows $25 spent on Dining, and -a corresponding $25 owed on the MasterCard—and therefore shown as -$-25.00. The MasterCard liability shows up as negative because it -offsets the value of your assets. -

-

The combined total of your Assets and Liabilities is your net worth. -So to see your current net worth, use this command: -

-
-
$ ledger balance ^assets ^liabilities
-
- -
-
             $500.00  Assets:Checking
-             $-25.00  Liabilities:MasterCard
---------------------
-             $475.00
-
- -

In a similar vein, your Income accounts show up negative, because they -transfer money from an account in order to increase your -assets. Your Expenses show up positive because that is where the -money went to. The combined total of Income and Expenses is your cash -flow. A positive cash flow means you are spending more than you make, -since income is always a negative figure. To see your current cash -flow, use this command: -

-
-
$ ledger balance ^income ^expenses
-
- -
-
              $25.00  Expenses:Dining
-            $-500.00  Income:Salary
---------------------
-            $-475.00
-
- -

Another common question to ask of your expenses is: How much do I -spend each month on X? Ledger provides a simple way of displaying -monthly totals for any account. Here is an example that summarizes -your monthly automobile expenses: -

-
-
$ ledger -M register -f drewr3.dat expenses:auto
-
- -
-
11-Jan-01 - 11-Jan-31           Expenses:Auto            $ 5,500.00   $ 5,500.00
-
- -

This assumes, of course, that you use account names like -‘Expenses:Auto:Gas’ and ‘Expenses:Auto:Repair’. -

- - - - -
- - - -

3.3.1 Tracking reimbursable expenses

- - -

Sometimes you will want to spend money on behalf of someone else, which -will eventually get repaid. Since the money is still yours, it -is really an asset. And since the expenditure was for someone else, you -don’t want it contaminating your Expenses reports. You will need to -keep an account for tracking reimbursements. -

-

This is fairly easy to do in ledger. When spending the money, spend -it to your Assets:Reimbursements, using a different account for -each person or business that you spend money for. For example: -

-
-
2004/09/29  Circuit City
-    Assets:Reimbursements:Company XYZ     $100.00
-    Liabilities:MasterCard
-
- -

This shows $100.00 spent on a MasterCard at Circuit City, with the -expense was made on behalf of Company XYZ. Later, when Company XYZ -pays the amount back, the money will transfer from that reimbursement -account back to a regular asset account: -

-
-
2004/09/29  Company XYZ
-    Assets:Checking                       $100.00
-    Assets:Reimbursements:Company XYZ
-
- -

This deposits the money owed from Company XYZ into a checking account, -presumably because they paid the amount back with a check. -

-

But what to do if you run your own business, and you want to keep -track of expenses made on your own behalf, while still tracking -everything in a single ledger file? This is more complex, because you -need to track two separate things: 1) The fact that the money should -be reimbursed to you, and 2) What the expense account was, so that you -can later determine where your company is spending its money. -

-

This kind of posting is best handled with mirrored postings in -two different files, one for your personal accounts, and one for your -company accounts. But keeping them in one file involves the same -kinds of postings, so those are what is shown here. First, the -personal transaction, which shows the need for reimbursement: -

-
-
2004/09/29  Circuit City
-    Assets:Reimbursements:Company XYZ     $100.00
-    Liabilities:MasterCard
-
- -

This is the same as above, except that you own Company XYZ, and are -keeping track of its expenses in the same ledger file. This -transaction should be immediately followed by an equivalent -transaction, which shows the kind of expense, and also notes the fact -that $100.00 is now payable to you: -

-
-
2004/09/29  Circuit City
-    Company XYZ:Expenses:Computer:Software      $100.00
-    Company XYZ:Accounts Payable:Your Name
-
- -

This second transaction shows that Company XYZ has just spent $100.00 -on software, and that this $100.00 came from Your Name, which must be -paid back. -

-

These two transactions can also be merged, to make things a little -clearer. Note that all amounts must be specified now: -

-
-
2004/09/29  Circuit City
-    Assets:Reimbursements:Company XYZ         $100.00
-    Liabilities:MasterCard                   $-100.00
-    Company XYZ:Expenses:Computer:Software    $100.00
-    Company XYZ:Accounts Payable:Your Name   $-100.00
-
- -

To “pay back” the reimbursement, just reverse the order of -everything, except this time drawing the money from a company asset, -paying it to accounts payable, and then drawing it again from the -reimbursement account, and paying it to your personal asset account. -It’s easier shown than said: -

-
-
2004/10/15  Company XYZ
-    Assets:Checking                           $100.00
-    Assets:Reimbursements:Company XYZ        $-100.00
-    Company XYZ:Accounts Payable:Your Name    $100.00
-    Company XYZ:Assets:Checking              $-100.00
-
- -

And now the reimbursements account is paid off, accounts payable is paid -off, and $100.00 has been effectively transferred from the company’s -checking account to your personal checking account. The money simply -“waited”—in both ‘Assets:Reimbursements:Company XYZ’, and -‘Company XYZ:Accounts Payable:Your Name’—until such time as it -could be paid off. -

-

The value of tracking expenses from both sides like that is that you -do not contaminate your personal expense report with expenses made on -behalf of others, while at the same time making it possible to -generate accurate reports of your company’s expenditures. It is more -verbose than just paying for things with your personal assets, but it -gives you a very accurate information trail. -

-

The advantage to keep these doubled transactions together is that they -always stay in sync. The advantage to keeping them apart is that it -clarifies the transfer’s point of view. To keep the postings in -separate files, just separate the two transactions that were joined -above. For example, for both the expense and the pay-back shown -above, the following four transactions would be created. Two in your -personal ledger file: -

-
-
2004/09/29  Circuit City
-    Assets:Reimbursements:Company XYZ     $100.00
-    Liabilities:MasterCard               $-100.00
-
-2004/10/15  Company XYZ
-    Assets:Checking                       $100.00
-    Assets:Reimbursements:Company XYZ    $-100.00
-
- -

And two in your company ledger file: -

-
-
apply account Company XYZ
-
-2004/09/29  Circuit City
-    Expenses:Computer:Software            $100.00
-    Accounts Payable:Your Name           $-100.00
-
-2004/10/15  Company XYZ
-    Accounts Payable:Your Name            $100.00
-    Assets:Checking                      $-100.00
-
-end apply account
-
- -

(Note: The apply account above means that all accounts -mentioned in the file are children of that account. In this case it -means that all activity in the file relates to Company XYZ). -

-

After creating these transactions, you will always know that $100.00 -was spent using your MasterCard on behalf of Company XYZ, and that -Company XYZ spent the money on computer software and paid it back -about two weeks later. -

-
-
$ ledger balance --no-total
-
- -
-
             $100.00  Assets:Checking
-                   0  Company XYZ
-            $-100.00    Assets:Checking
-             $100.00    Expenses:Computer:Software
-            $-100.00  Liabilities:MasterCard
-
- -
- - - -

3.4 Commodities and Currencies

- -

Ledger makes no assumptions about the commodities you use; it only -requires that you specify a commodity. The commodity may be any -non-numeric string that does not contain a period, comma, forward -slash or at-sign. It may appear before or after the amount, although -it is assumed that symbols appearing before the amount refer to -currencies, while non-joined symbols appearing after the amount refer -to commodities. Here are some valid currency and commodity -specifiers: -

-
-
$20.00         ; currency: twenty US dollars
-40 AAPL        ; commodity: 40 shares of Apple stock
-60 DM          ; currency: 60 Deutsch Mark
-£50            ; currency: 50 British pounds
-50 EUR         ; currency: 50 Euros (or use appropriate symbol)
-
- -

Ledger will examine the first use of any commodity to determine how -that commodity should be printed on reports. It pays attention to -whether the name of commodity was separated from the amount, whether -it came before or after, the precision used in specifying the amount, -whether thousand marks were used, etc. This is done so that printing -the commodity looks the same as the way you use it. -

-

An account may contain multiple commodities, in which case it will -have separate totals for each. For example, if your brokerage account -contains both cash, gold, and several stock quantities, the balance -might look like: -

-
-
  $200.00
-100.00 AU
-  AAPL 40
- BORL 100
- FEQTX 50  Assets:Brokerage
-
- -

This balance report shows how much of each commodity is in your -brokerage account. -

-

Sometimes, you will want to know the current street value of your -balance, and not the commodity totals. For this to happen, you must -specify what the current price is for each commodity. The price can -be any commodity, in which case the balance will be computed in terms -of that commodity. The usual way to specify prices is with a price -history file, which might look like this: -

-
-
P 2004/06/21 02:18:01 FEQTX $22.49
-P 2004/06/21 02:18:01 BORL $6.20
-P 2004/06/21 02:18:02 AAPL $32.91
-P 2004/06/21 02:18:02 AU $400.00
-
- - - -

Specify the price history to use with the --price-db FILE -option, with the --market (-V) option to report in terms of -current market value: -

-
-
$ ledger --price-db prices.db -V balance brokerage
-
- -

The balance for your brokerage account will be reported in US dollars, -since the prices database uses that currency. -

-
-
$40880.00  Assets:Brokerage
-
- -

You can convert from any commodity to any other commodity. Let’s say -you had $5000 in your checking account, and for whatever reason you -wanted to know how many ounces of gold that would buy, in terms of the -current price of gold: -

-
-
$ ledger -T "{1 AU}*(O/P{1 AU})" balance checking
-
- -

Although the total expression appears complex, it is simply saying -that the reported total should be in multiples of AU units, where the -quantity is the account total divided by the price of one AU. Without -the initial multiplication, the reported total would still use the -dollars commodity, since multiplying or dividing amounts always keeps -the left value’s commodity. The result of this command might be: -

-
-
14.01 AU  Assets:Checking
-
- - - - - - -
- - - -

3.4.1 Commodity price histories

- -

Whenever a commodity is purchased using a different commodity (such as -a share of common stock using dollars), it establishes a price for -that commodity on that day. It is also possible, by recording price -details in a ledger file, to specify other prices for commodities at -any given time. Such price transactions might look like those below: -

-
-
P 2004/06/21 02:17:58 TWCUX $27.76
-P 2004/06/21 02:17:59 AGTHX $25.41
-P 2004/06/21 02:18:00 OPTFX $39.31
-P 2004/06/21 02:18:01 FEQTX $22.49
-P 2004/06/21 02:18:02 AAPL $32.91
-
- -

By default, ledger will not consider commodity prices when generating -its various reports. It will always report balances in terms of the -commodity total, rather than the current value of those commodities. -To enable pricing reports, use one of the commodity reporting options. -

-
- - - -

3.4.2 Commodity equivalences

- -

Sometimes a commodity has several forms which are all equivalent. An -example of this is time. Whether tracked in terms of minutes, hours -or days, it should be possible to convert between the various forms. -Doing this requires the use of commodity equivalences. -

-

For example, you might have the following two postings, one which -transfers an hour of time into a ‘Billable’ account, and another -which decreases the same account by ten minutes. The resulting report -will indicate that fifty minutes remain: -

-
-
2005/10/01 Work done for company
-    Billable:Client                 1h
-    Project:XYZ
-
-2005/10/02 Return ten minutes to the project
-    Project:XYZ                    10m
-    Billable:Client
-
- -

Reporting the balance for this ledger file produces: -

-
-
$ ledger --no-total balance Billable Project
-
- -
-
               50.0m  Billable:Client
-              -50.0m  Project:XYZ
-
- - - -

This example works because ledger already knows how to handle seconds, -minutes and hours, as part of its time tracking support. Defining -other equivalences is simple. The following is an example that -creates data equivalences, helpful for tracking bytes, kilobytes, -megabytes, and more: -

-
-
C 1.00 Kb = 1024 b
-C 1.00 Mb = 1024 Kb
-C 1.00 Gb = 1024 Mb
-C 1.00 Tb = 1024 Gb
-
- -

Each of these definitions correlates a commodity (such as ‘Kb’) -and a default precision, with a certain quantity of another commodity. -In the above example, kilobytes are reported with two decimal places -of precision and each kilobyte is equal to 1024 bytes. -

-

Equivalence chains can be as long as desired. Whenever a commodity -would report as a decimal amount (less than ‘1.00’), the next -smallest commodity is used. If a commodity could be reported in terms -of a higher commodity without resulting to a partial fraction, then -the larger commodity is used. -

-
- - - -

3.5 Accounts and Inventories

- -

Since Ledger’s accounts and commodity system is so flexible, you can -have accounts that don’t really exist, and use commodities that no one -else recognizes. For example, let’s say you are buying and selling -various items in EverQuest, and want to keep track of them using a -ledger. Just add items of whatever quantity you wish into your -EverQuest account: -

-
-
9/29  Get some stuff at the Inn
-    Places:Black's Tavern                   -3 Apples
-    Places:Black's Tavern                   -5 Steaks
-    EverQuest:Inventory
-
- -

Now your EverQuest:Inventory has 3 apples and 5 steaks in it. The -amounts are negative, because you are taking from Black’s -Tavern in order to add to your Inventory account. Note that you don’t -have to use ‘Places:Black's Tavern’ as the source account. You -could use ‘EverQuest:System’ to represent the fact that you -acquired them online. The only purpose for choosing one kind of -source account over another is to generate more informative reports -later on. The more you know, the better the analysis you can perform. -

-

If you later sell some of these items to another player, the -transaction would look like: -

-
-
10/2  Sturm Brightblade
-    EverQuest:Inventory                     -2 Steaks
-    EverQuest:Inventory                     15 Gold
-
- -

Now you’ve turned 2 steaks into 15 gold, courtesy of your customer, -Sturm Brightblade. -

-
-
$ ledger balance EverQuest
-
- -
-
            3 Apples
-             15 Gold
-            3 Steaks  EverQuest:Inventory
-
- -
- - - -

3.6 Understanding Equity

- -

The most confusing transaction in any ledger will be your equity -account—because starting balances can’t come out of nowhere. -

-

When you first start your ledger, you will likely already have money -in some of your accounts. Let’s say there’s $100 in your checking -account; then add a transaction to your ledger to reflect this amount. -Where will the money come from? The answer: your equity. -

-
-
10/2  Opening Balance
-    Assets:Checking                         $100.00
-    Equity:Opening Balances
-
- -

But what is equity? You may have heard of equity when people talked -about house mortgages, as “the part of the house that you own”. -Basically, equity is like the value of something. If you own a car -worth $5000, then you have $5000 in equity in that car. In order to -turn that car (a commodity) into a cash flow, or a credit to your bank -account, you will have to debit the equity by selling it. -

-

When you start a ledger, you probably already have a net worth. -Your net worth is your current equity. By transferring the money in -the ledger from your equity to your bank accounts, you are crediting -the ledger account based on your prior equity. That is why, when you -look at the balance report, you will see a large negative number for -Equity that never changes: Because that is what you were worth (what -you debited from yourself in order to start the ledger) before the -money started moving around. If the total positive value of your -assets is greater than the absolute value of your starting equity, it -means you are making money. -

-

Clear as mud? Keep thinking about it. Until you figure it out, put -not Equity at the end of your balance command, to remove the -confusing figure from the total. -

-
- - - -

3.7 Dealing with Petty Cash

- -

Something that stops many people from keeping a ledger at all is the -insanity of tracking small cash expenses. They rarely generate a -receipt, and there are often a lot of small postings, rather than -a few large ones, as with checks. -

-

One solution is: don’t bother. Move your spending to a debit card, -but in general ignore cash. Once you withdraw it from the ATM, mark -it as already spent to an ‘Expenses:Cash’ category: -

-
-
2004/03/15 ATM
-    Expenses:Cash                      $100.00
-    Assets:Checking
-
- -

If at some point you make a large cash expense that you want to track, -just move the amount of the expense from ‘Expenses:Cash’ -into the target account: -

-
-
2004/03/20 Somebody
-    Expenses:Food                       $65.00
-    Expenses:Cash
-
- -

This way, you can still track large cash expenses, while ignoring all -of the smaller ones. -

-
- - - -

3.8 Working with multiple funds and accounts

- -

There are situations when the accounts you’re tracking are different -between your clients and the financial institutions where money is -kept. An example of this is working as the treasurer for a religious -institution. From the secular point of view, you might be working -with three different accounts: -

-
    -
  • Checking -
  • Savings -
  • Credit Card -
- -

From a religious point of view, the community expects to divide its -resources into multiple “funds”, from which it makes purchases or -reserves resources for later: -

-
    -
  • School fund -
  • Building fund -
  • Community fund -
- -

The problem with this kind of setup is that, when you spend money, it -comes from two or more places at once: the account and the fund. And -yet, the correlation of amounts between funds and accounts is rarely -one-to-one. What if the school fund has ‘$500.00’, but -‘$400.00’ of that comes from Checking, and ‘$100.00’ from -Savings? -

-

Traditional finance packages require that the money reside in only one -place. But there are really two “views” of the data: from the -account point of view and from the fund point of view—yet both sets -should reflect the same overall expenses and cash flow. It’s simply -where the money resides that differs. -

-

This situation can be handled in one of two ways. The first is using -virtual postings to represent the fact that money is moving to and -from two kind of accounts at the same time: -

-
-
2004/03/20 Contributions
-    Assets:Checking                    $500.00
-    Income:Donations
-
-2004/03/25 Distribution of donations
-    [Funds:School]                     $300.00
-    [Funds:Building]                   $200.00
-    [Assets:Checking]                 $-500.00
-
- -

The use of square brackets in the second transaction ensures that the -virtual postings balance to zero. Now money can be spent directly -from a fund at the same time as money is drawn from a physical -account: -

-
-
2004/03/25 Payment for books (paid from Checking)
-    Expenses:Books                    $100.00
-    Assets:Checking                  $-100.00
-    (Funds:School)                   $-100.00
-
- -

The use of round brackets creates a virtual posting without ensuring -a balance to zero. When reports are generated, by default they’ll -appear in terms of the funds. In this case, you will likely want to -mask out your ‘Assets’ account, because otherwise the balance -won’t make much sense: -

-
-
$ ledger --no-total bal not ^Assets
-
- -
-
             $100.00  Expenses:Books
-             $400.00  Funds
-             $200.00    Building
-             $200.00    School
-            $-500.00  Income:Donations
-
- - -

If the --real option is used, the report will be in terms of -the real accounts: -

-
-
$ ledger --real --no-total bal
-
- -
-
             $400.00  Assets:Checking
-             $100.00  Expenses:Books
-            $-500.00  Income:Donations
-
- -

If more asset accounts are needed as the source of a posting, just -list them as you would normally, for example: -

-
-
2004/03/25 Payment for books (paid from Checking)
-    Expenses:Books                    $100.00
-    Assets:Checking                   $-50.00
-    Liabilities:Credit Card           $-50.00
-    (Funds:School)                   $-100.00
-
- -

The second way of tracking funds is to use transaction codes. In this -respect the codes become like virtual accounts that embrace the entire -set of postings. Basically, we are associating a transaction with a -fund by setting its code. Here are two transactions that deposit money -into, and spend money from, the ‘Funds:School’ fund: -

-
-
2004/03/25 (Funds:School) Donations
-    Assets:Checking                   $100.00
-    Income:Donations
-
-2004/03/25 (Funds:Building) Donations
-    Assets:Checking                   $20.00
-    Income:Donations
-
-2004/04/25 (Funds:School) Payment for books
-    Expenses:Books                     $50.00
-    Assets:Checking
-
- -

Note how the accounts now relate only to the real accounts, and any -balance or register reports will reflect this. That the transactions -relate to a particular fund is kept only in the code. -

- - -

How does this become a fund report? By using the ---payee=code option, you can generate a register report -where the payee for each posting shows the code. Alone, this is not -terribly interesting; but when combined with the --by-payee -(-P) option, you will now see account subtotals for any postings -related to a specific fund. So, to see the current monetary balances of -all funds, the command would be: -

-
-
$ ledger --payee=code -P reg ^Assets
-
- -
-
04-Mar-25 Funds:Building        Assets:Checking              $20.00       $20.00
-04-Mar-25 Funds:School          Assets:Checking              $50.00       $70.00
-
- -

Or to see a particular fund’s expenses, the ‘School’ fund in this -case: -

-
-
$ ledger --payee=code -P reg ^Expenses and code School
-
- -
-
04-Apr-25 Funds:School          Expenses:Books               $50.00       $50.00
-
- -

Both approaches yield different kinds of flexibility, depending on how -you prefer to think of your funds: as virtual accounts, or as tags -associated with particular transactions. Your own tastes will decide -which is best for your situation. -

-
- - - -

4 Keeping a Journal

- -

The most important part of accounting is keeping a good journal. If -you have a good journal, tools can be written to work whatever -mathematical tricks you need to better understand your spending -patterns. Without a good journal, no tool, however smart, can help -you. -

-

The Ledger program aims at making journal transactions as simple as -possible. Since it is a command-line tool, it does not provide a user -interface for keeping a journal. If you require an user interface to -maintain journal transactions GnuCash is a good alternative. -

-

If you are not using GnuCash, but a text editor to maintain your -journal, read on. Ledger has been designed to make data transactions -as simple as possible, by keeping the journal format easy, and also by -automagically determining as much information as possible based on the -nature of your transactions. -

-

For example, you do not need to tell Ledger about the accounts you -use. Any time Ledger sees a posting involving an account it knows -nothing about, it will create it2. If you -use a commodity that is new to Ledger, it will create that commodity, -and determine its display characteristics (placement of the symbol -before or after the amount, display precision, etc.) based on how you -used the commodity in the posting. -

- - - - - - - - - - - - -
- - - -

4.1 The Most Basic Entry

- -

Here is the Pacific Bell example from above, given as a Ledger -posting, with the addition of a check number: -

-
-
9/29 (1023) Pacific Bell
-    Expenses:Utilities:Phone                   $23.00
-    Assets:Checking                           $-23.00
-
- -

As you can see, it is very similar to what would be written on paper, -minus the computed balance totals, and adding in account names that -work better with Ledger’s scheme of things. In fact, since Ledger is -smart about many things, you don’t need to specify the balanced -amount, if it is the same as the first line: -

-
-
9/29 (1023) Pacific Bell
-    Expenses:Utilities:Phone                   $23.00
-    Assets:Checking
-
- -

For this transaction, Ledger will figure out that $-23.00 must come -from ‘Assets:Checking’ in order to balance the transaction. -

-

Also note the structure of the account entries. There is an implied -hierarchy established by separating with colons (see Structuring your Accounts). -

- - - -

The format is very flexible and it isn’t necessary that you -indent and space out things exactly as shown. The only requirements -are that the start of the transaction (the date typically) is at the -beginning of the first line of the transaction, and the accounts are -indented by at least one space. If you omit the leading spaces in the -account lines Ledger will generate an error. There must be at least -two spaces, or a tab, between the amount and the account. If you do -not have adequate separation between the amount and the account Ledger -will give an error and stop calculating. -

-
- - - -

4.2 Starting up

- - - - -

Unless you have recently arrived from another planet, you already have -a financial state. You need to capture that financial state so that -Ledger has a starting point. -

-

At some convenient point in time you knew the balances and outstanding -obligation of every financial account you have. Those amounts form the -basis of the opening entry for ledger. For example if you chose the -beginning of 2011 as the date to start tracking finances with ledger, -your opening balance entry could look like this: -

-
-
2011/01/01 * Opening Balance
-    Assets:Joint Checking                   $800.14
-    Assets:Other Checking                    $63.44
-    Assets:Savings                         $2805.54
-    Assets:Investments:401K:Deferred         100.0000 VIFSX @ $80.5227
-    Assets:Investments:401K:Matching          50.0000 VIFSX @ $83.7015
-    Assets:Investments:IRA                   250.0000 VTHRX @ $20.5324
-    Liabilities:Mortgage                $-175634.88
-    Liabilities:Car Loan                  $-3494.26
-    Liabilities:Visa                      -$1762.44
-    Equity:Opening Balances
-
- -

There is nothing special about the name “Opening Balances” as the -payee of the account name, anything convenient that you understand will -work. -

-
- - - -

4.3 Structuring your Accounts

- - - -

There really are no requirements for how you do this, but to preserve -your sanity we suggest some very basic structure to your accounting -system. -

-

At the highest level you have five sorts of accounts: -

-
    -
  1. Expenses: where money goes, -
  2. Assets: where money sits, -
  3. Income: where money comes from, -
  4. Liabilities: money you owe, -
  5. Equity: the real value of your property. -
- -

Starting the structure off this way will make it simpler for you to get -answers to the questions you really need to ask about your finances. -

-

Beneath these top level accounts you can have any level of detail you -desire. For example, if you want to keep specific track of how much -you spend on burgers and fries, you could have the following: -

-
-
Expenses:Food:Hamburgers and Fries
-
- -
- - - -

4.4 Commenting on your Journal

- - - - -

Comments are generally started using a ‘;’. However, in order to -increase compatibility with other text manipulation programs and -methods, four additional comment characters are valid if used at the -beginning of a line: ‘#’, ‘|’, and ‘*’ and ‘%’. -

-

Block comments can be made by use comment ... end -comment. -

-
-
; This is a single line comment,
-#  and this,
-%   and this,
-|    and this,
-*     and this.
-
-comment
-    This is a block comment with
-    multiple lines
-end comment
-
- -

There are several forms of comments within a transaction, for example: -

-
-
; this is a global comment that is not applied to a specific transaction
-; it can start with any of the five characters but is not included in the
-; output from 'print' or 'output'
-
-2011/12/11  Something Sweet
-    ; German Chocolate Cake
-    ; :Broke Diet:
-    Expenses:Food                  $10.00 ; Friends: The gang
-    Assets:Credit Union:Checking
-
- -

The first comment is global and Ledger will not attach it to any -specific transactions. The comments within the transaction must all -start with ‘;’ and are preserved as part of the transaction. The -‘:’ indicates meta-data and tags (see Metadata). -

-
- - - -

4.5 Currency and Commodities

- - - -

Ledger is agnostic when it comes to how you value your accounts. -Dollars, Euros, Pounds, Francs, Shares etc. are all just “commodities”. -Holdings in stocks, bonds, mutual funds and other financial -instruments can be labeled using whatever is convenient for you (stock -ticker symbols are suggested for publicly traded assets).3 -

-

For the rest of this manual, we will only use the word “commodities” -when referring to the units on a transaction value. -

-

This is fundamentally different than many common accounting packages, -which assume the same currency throughout all of your accounts. This -means if you typically operate in Euros, but travel to the US and have -some expenses, you would have to do the currency conversion -before you made the entry into your financial system. With -ledger this is not required. In the same journal you can have entries -in any or all commodities you actually hold. You can use the -reporting capabilities to convert all commodities to a single -commodity for reporting purposes without ever changing the underlying -entry. -

-

For example, the following entries reflect transactions made for a -business trip to Europe from the US: -

-
-
2011/09/23 Cash in Munich
-    Assets:Cash                               €50.00
-    Assets:Checking                          $-66.00
-
-2011/09/24 Dinner in Munich
-    Expenses:Business:Travel                  €35.00
-    Assets:Cash
-
- -

This says that $66.00 came out of checking and turned into 50 -Euros. The implied exchange rate was $1.32. Then 35.00 Euros were -spent on Dinner in Munich. -

-

Running a ledger balance report shows: -

-
-
$ ledger -f example.dat bal
-
- -
-
             $-66.00
-              €15.00  Assets
-              €15.00    Cash
-             $-66.00    Checking
-              €35.00  Expenses:Business:Travel
---------------------
-             $-66.00
-              €50.00
-
- -

The top two lines show my current assets as $-66.00 in checking (in -this very short example I didn’t establish opening an opening balance -for the checking account) and €15.00. After spending on dinner I have -€15.00 in my wallet. The bottom line balances to zero, but is shown -in two lines since we haven’t told ledger to convert commodities. -

- - - - - - - -
- - - -

4.5.1 Naming Commodities

- -

Commodity names can have any character, including white-space. -However, if you include white-space or numeric characters, the -commodity name must be enclosed in double quotes ‘"’: -

-
-
1999/06/09 ! Achat
-    Actif:SG PEE STK         49.957 "Arcancia Équilibre 454"
-    Actif:SG PEE STK      $-234.90
-
-2000/12/08 ! Achat
-    Actif:SG PEE STK        215.796 "Arcancia Équilibre 455"
-    Actif:SG PEE STK    $-10742.54
-
- -
- - - -

4.5.2 Buying and Selling Stock

- - -

Buying stock is a typical example that many will use that involves -multiple commodities in the same transaction. The type of the share -(AAPL for Apple Inc.) and the share purchase price in the currency -unit you made the purchase in ($ for AAPL). Yes, the typical -convention is as follows: -

-
-
2004/05/01 Stock purchase
-    Assets:Broker                     50 AAPL @ $30.00
-    Expenses:Broker:Commissions        $19.95
-    Assets:Broker                  $-1,519.95
-
- -

This assumes you have a brokerage account that is capable of managing -both liquid and commodity assets. Now, on the day of the sale: -

-
-
2005/08/01 Stock sale
-    Assets:Broker                    -50 AAPL {$30.00} @ $50.00
-    Expenses:Broker:Commissions        $19.95
-    Income:Capital Gains           $-1,000.00
-    Assets:Broker                   $2,480.05
-
- -

You can, of course, elide the amount of the last posting. It is there -for clarity’s sake. -

-

The ‘{$30.00}’ is a lot price. You can also use a lot date, -‘[2004/05/01]’, or both, in case you have several lots of the -same price/date and your taxation model is based on -longest-held-first. -

-
- - - -

4.5.3 Fixing Lot Prices

- - - -

Commodities that you keep in order to sell at a later time have -a variable value that fluctuates with the market prices. Commodities -that you consume should not fluctuate in value, but stay at the lot -price they were purchased at. As an extension of “lot pricing”, you -can fix the per-unit price of a commodity. -

-

For example, say you buy 10 gallons of gas at $1.20. In future -“value” reports, you don’t want these gallons reported in terms of -today’s price, but rather the price when you bought it. At the same -time, you also want other kinds of commodities—like stocks— -reported in terms of today’s price. -

-

This is supported as follows: -

-
-
2009/01/01 Shell
-    Expenses:Gasoline             11 GAL {=$2.299}
-    Assets:Checking
-
- -

This transaction actually introduces a new commodity, ‘GAL -{=$2.29}’, whose market value disregards any future changes in the -price of gasoline. -

-

If you do not want price fixing, you can specify this same transaction -in one of two ways, both equivalent (note the lack of the equal sign -compared to the transaction above): -

-
-
2009/01/01 Shell
-    Expenses:Gasoline             11 GAL {$2.299}
-    Assets:Checking
-
-2009/01/01 Shell
-    Expenses:Gasoline             11 GAL @ $2.299
-    Assets:Checking
-
- -

There is no difference in meaning between these two forms. Why do -both exist, you ask? To support things like this: -

-
-
2009/01/01 Shell
-    Expenses:Gasoline             11 GAL {=$2.299} @ $2.30
-    Assets:Checking
-
- -

This transaction says that you bought 11 gallons priced at $2.299 per -gallon at a cost to you of $2.30 per gallon. Ledger -auto-generates a balance posting in this case to Equity:Capital Losses -to reflect the 1.1 cent difference, which is then balanced by -Assets:Checking because its amount is null. -

-
- - - -

4.5.4 Complete control over commodity pricing

- - - -

Ledger allows you to have very detailed control over how your -commodities are valued. You can fine tune the results given using the ---market or --exchange COMMODITY options. There -are now several points of interception; you can specify the valuation -method: -

-
    -
  1. on a commodity itself, -
  2. on a posting, via metadata (effect is largely the same as #1), -
  3. on an xact, which then applies to all postings in that xact, -
  4. on any posting via an automated transaction, -
  5. on a per-account basis, -
  6. on a per-commodity basis, -
  7. by changing the journal default of market. -
- -

Fixated pricing (such as ‘{=$20}’) still plays a role in this -scheme. As far as valuation goes, it’s shorthand for writing -‘((s,d,t -> market($20,d,t)))’. -

-

A valuation function receives three arguments: -

-
-
source
-

A string identifying the commodity whose price is being asked for -(example: ‘EUR’). -

-
-
date
-

The reference date the price should be relative. -

-
-
target
-

A string identifying the “target” commodity, or the commodity the -returned price should be in. This argument is null if --market -was used instead of --exchange COMMODITY. -

-
-
- -

The valuation function should return an amount. If you’ve written -your function in Python, you can return something like -‘Amount("$100")’. If the function returns an explicit value, -that value is always used, regardless of the commodity, the date, or -the desired target commodity. For example, -

-
-
define myfunc_seven(s, d, t) = 7 EUR
-
- -

In order to specify a fixed price, but still valuate that price into -the target commodity, use something like this: -

-
-
define myfunc_five(s, d, t) = market(5 EUR, d, t)
-
- -

The value directive sets the valuation used for all commodities -used in the rest of the data stream. This is the fallback, if nothing -more specific is found. -

-
-
value myfunc_seven
-
- -

You can set a specific valuation function on a per-commodity basis. -Instead of defining a function, you can also pass a lambda. -

-
-
commodity $
-    value s, d, t -> 6 EUR
-
- -

Each account can also provide a default valuation function for any -commodities transferred to that account. -

-
-
account Expenses:Food5
-    value myfunc_five
-
- -

The metadata field ‘Value’, if found, overrides the valuation -function on a transaction-wide or per-posting basis. -

-
-
= @XACT and Food
-    ; Value:: 8 EUR
-    (Equity)                     $1
-
-= @POST and Dining
-    (Expenses:Food9)             $1
-        ; Value:: 9 EUR
-
- -

Lastly, you can specify the valuation function/value for any specific -amount using the ‘(( ))’ commodity annotation. -

-
-
2012-03-02 KFC
-    Expenses:Food2               $1 ((2 EUR))
-    Assets:Cash2
-
-2012-03-03 KFC
-    Expenses:Food3               $1
-        ; Value:: 3 EUR
-    Assets:Cash3
-
-2012-03-04 KFC
-    ; Value:: 4 EUR
-    Expenses:Food4               $1
-    Assets:Cash4
-
-2012-03-05 KFC
-    Expenses:Food5               $1
-    Assets:Cash5
-
-2012-03-06 KFC
-    Expenses:Food6               $1
-    Assets:Cash6
-
-2012-03-07 KFC
-    Expenses:Food7                1 CAD
-    Assets:Cash7
-
-2012-03-08 XACT
-    Expenses:Food8               $1
-    Assets:Cash8
-
-2012-03-09 POST
-    Expenses:Dining9             $1
-    Assets:Cash9
-
- -
-
$ ledger reg -V food
-
- -
-
12-Mar-02 KFC                   Expenses:Food2                2 EUR        2 EUR
-12-Mar-03 KFC                   Expenses:Food3                3 EUR        5 EUR
-12-Mar-04 KFC                   Expenses:Food4                4 EUR        9 EUR
-12-Mar-05 KFC                   Expenses:Food5                   $1           $1
-                                                                           9 EUR
-12-Mar-06 KFC                   Expenses:Food6                   $1           $2
-                                                                           9 EUR
-12-Mar-07 KFC                   Expenses:Food7                1 CAD           $2
-                                                                           1 CAD
-                                                                           9 EUR
-12-Mar-08 XACT                  Expenses:Food8                   $1           $3
-                                                                           1 CAD
-                                                                           9 EUR
-
- -
- - - -

4.6 Keeping it Consistent

- - - -

Sometimes Ledger’s flexibility can lead to difficulties. Using a -freeform text editor to enter transactions makes it easy to keep the -data, but also easy to enter accounts or payees inconsistently or with -spelling errors. -

-

In order to combat inconsistency you can define allowable accounts and -payees. For simplicity, create a separate text file and define accounts -and payees like -

-
-
account Expenses
-account Expenses:Utilities
-
- -

Using the --strict option will cause Ledger to complain if any -accounts are not previously defined: -

-
-
$ ledger bal --strict
-Warning: "FinanceData/Master.dat", line 6: Unknown account 'Liabilities:Tithe Owed'
-Warning: "FinanceData/Master.dat", line 8: Unknown account 'Liabilities:Tithe Owed'
-Warning: "FinanceData/Master.dat", line 15: Unknown account 'Allocation:Equities:Domestic'
-
- -

If you have a large Ledger register already created use the -accounts command to get started: -

-
-
$ ledger accounts >> Accounts.dat
-
- -

You will have to edit this file to add the account directive in -front of every line. -

-
- - - -

4.7 Journal Format

- -

The ledger file format is quite simple, but also very flexible. It -supports many options, though typically the user can ignore most of -them. They are summarized below. -

- - - - - -
- - - -

4.7.1 Transactions and Comments

- -

The initial character of each line determines what the line means, and -how it should be interpreted. Allowable initial characters are: -

-
-
NUMBER
-

A line beginning with a number denotes a transaction. It may be -followed by any number of lines, each beginning with white-space, to -denote the transaction’s account postings. The format of the first -line is: -

-
-
DATE[=EDATE] [*|!] [(CODE)] DESC
-
- -

If ‘*’ appears after the date (with optional effective date), it -indicates the transaction is “cleared”, which can mean whatever the -user wants it to mean. If ‘!’ appears after the date, it -indicates the transaction is “pending”; i.e., tentatively cleared -from the user’s point of view, but not yet actually cleared. If -a CODE appears in parentheses, it may be used to indicate -a check number, or the type of the posting. Following these is the -payee, or a description of the posting. -

-

The format of each following posting is: -

-
-
  ACCOUNT  AMOUNT  [; NOTE]
-
- -

The ACCOUNT may be surrounded by parentheses if it is a virtual -posting, or square brackets if it is a virtual posting that -must balance. The AMOUNT can be followed by a per-unit -posting cost, by specifying @ AMOUNT, or a complete -posting cost with @@ AMOUNT. Lastly, the NOTE may -specify an actual and/or effective date for the posting by using -the syntax [ACTUAL_DATE] or [=EFFECTIVE_DATE] or -[ACTUAL_DATE=EFFECTIVE_DATE] (see Virtual postings). -

-
-
P
-
- - -

Specifies a historical price for a commodity. These are usually found -in a pricing history file (see the --download (-Q) option). -The syntax is: -

-
-
P DATE SYMBOL PRICE
-
- -
-
=
-
- - -

An automated transaction. A value expression must appear after the -equal sign. -

-

After this initial line there should be a set of one or more postings, -just as if it were a normal transaction. If the amounts of the postings -have no commodity, they will be applied as multipliers to whichever real -posting is matched by the value expression (see Automated Transactions). -

-
-
~
-
- - -

A periodic transaction. A period expression must appear after the tilde. -

-

After this initial line there should be a set of one or more -postings, just as if it were a normal transaction. -

-
-
; # % | *
-
- -

A line beginning with a semicolon, pound, percent, bar or asterisk -indicates a comment, and is ignored. Comments will not be returned in -a “print” response. -

-
-
indented ;
-
-

If the semicolon is indented and occurs inside a transaction, it is -parsed as a persistent note for its preceding category. These notes or -tags can be used to augment the reporting and filtering capabilities of -Ledger. -

-
-
- -
- - - -

4.7.2 Command Directives

- - - -
-
beginning of line
-

Command directives must occur at the beginning of a line. Use of -‘!’ and ‘@’ is deprecated. -

-
-
account
-
- -

Pre-declare valid account names. This only has an effect if ---strict or --pedantic is used (see below). The -account directive supports several optional sub-directives, if -they immediately follow the account directive and if they begin with -whitespace: -

-
-
account Expenses:Food
-    note This account is all about the chicken!
-    alias food
-    payee ^(KFC|Popeyes)$
-    check commodity == "$"
-    assert commodity == "$"
-    eval print("Hello!")
-    default
-
- -

The note sub-directive associates a textual note with the -account. This can be accessed later using the note value -expression function in any account context. -

-

The alias sub-directive, which can occur multiple times, allows -the alias to be used in place of the full account name anywhere that -account names are allowed. -

-

The payee sub-directive, which can occur multiple times, -provides regexes that identify the account if that payee is -encountered and an account within its transaction ends in the name -"Unknown". Example: -

-
-
2012-02-27 KFC
-    Expenses:Unknown      $10.00  ; Read now as "Expenses:Food"
-    Assets:Cash
-
- -

The check and assert directives warn or raise an error -(respectively) if the given value expression evaluates to false within -the context of any posting. -

-

The eval directive evaluates the value expression in the -context of the account at the time of definition. At the moment this -has little value. -

-

The default directive specifies that this account should be -used as the “balancing account” for any future transactions that -contain only a single posting. -

-
-
apply account
-
-

Sets the root for all accounts following this directive. Ledger -supports a hierarchical tree of accounts. It may be convenient to -keep two “root accounts”. For example you may be tracking your -personal finances and your business finances. In order to keep them -separate you could preface all personal accounts with ‘personal:’ -and all business accounts with ‘business:’. You can easily split -out large groups of transactions without manually editing them using -the account directive. For example: -

-
-
apply account Personal
-2011/11/15  Supermarket
-    Expenses:Groceries      $ 50.00
-    Assets:Checking
-
- -

Would result in all postings going into -‘Personal:Expenses:Groceries’ and ‘Personal:Assets:Checking’ -until an ‘end apply account’ directive was found. -

-
-
apply fixed
-
- - -

A fixed block is used to set fixated prices (see Fixated prices and costs) for a series of transactions. It’s purely a typing saver, for -use when entering many transactions with fixated prices. -

-

Thus, the following: -

-
-
apply fixed CAD $0.90
-2012-04-10 Lunch in Canada
-    Assets:Wallet            -15.50 CAD
-    Expenses:Food            15.50 CAD
-
-2012-04-11 Second day Dinner in Canada
-    Assets:Wallet            -25.75 CAD
-    Expenses:Food            25.75 CAD
-end apply fixed
-
- -

is equivalent to this: -

-
-
2012-04-10 Lunch in Canada
-    Assets:Wallet            -15.50 CAD {=$0.90}
-    Expenses:Food            15.50 CAD  {=$0.90}
-
-2012-04-11 Second day Dinner in Canada
-    Assets:Wallet            -25.75 CAD  {=$0.90}
-    Expenses:Food            25.75 CAD   {=$0.90}
-
- -
-
alias
-
- -

Define an alias for an account name. If you have a deeply nested tree -of accounts, it may be convenient to define an alias, for example: -

-
-
alias Dining=Expenses:Entertainment:Dining
-alias Checking=Assets:Credit Union:Joint Checking Account
-
-2011/11/28 YummyPalace
-    Dining        $10.00
-    Checking
-
- -

The aliases are only in effect for transactions read in after the alias -is defined and are affected by account directives that precede -them. -

-
-
$ ledger bal --no-total ^Exp
-
- -
-
              $10.00  Expenses:Entertainment:Dining
-
- -

With the option --recursive-aliases, aliases can refer to other -aliases, the following example produces exactly the same transactions -and account names as the preceding one: -

-
-
alias Entertainment=Expenses:Entertainment
-alias Dining=Entertainment:Dining
-alias Checking=Assets:Credit Union:Joint Checking Account
-
-2011/11/30 ChopChop
-  Dining          $10.00
-  Checking
-
- -
-
$ ledger balance --no-total --recursive-aliases ^Exp
-
- -
-
              $10.00  Expenses:Entertainment:Dining
-
- -

The option --no-aliases completely disables alias expansion. -All accounts are read verbatim as they are in the ledger file. -

-
-
assert
-
- -

An assertion can throw an error if a condition is not met during -Ledger’s run. -

-
-
assert <VALUE EXPRESSION BOOLEAN RESULT>
-
- -
-
bucket
-
- -

Defines the default account to use for balancing transactions. -Normally, each transaction has at least two postings, which must -balance to zero. Ledger allows you to leave one posting with no -amount and automatically balance the transaction in the -posting. The bucket allows you to fill in all postings and -automatically generate an additional posting to the bucket account -balancing the transaction. If any transaction is unbalanced, it -will automatically be balanced against the bucket account. -The following example sets ‘Assets:Checking’ as the bucket: -

-
-
bucket Assets:Checking
-2011/01/25 Tom's Used Cars
-    Expenses:Auto                    $ 5,500.00
-
-2011/01/27 Book Store
-    Expenses:Books                       $20.00
-
-2011/12/01 Sale
-    Assets:Checking:Business            $ 30.00
-
- -
-
capture
-
- - - -

Directs Ledger to replace any account matching a regex with the given -account. For example: -

-
-
capture  Expenses:Deductible:Medical  Medical
-
- -

Would cause any posting with ‘Medical’ in its name to be replaced -with ‘Expenses:Deductible:Medical’. -

-

Ledger will display the mapped payees in print and -register reports. -

-
-
check
-
- -

A check issues a warning if a condition is not met during Ledger’s -run. -

-
-
check <VALUE EXPRESSION BOOLEAN RESULT>
-
- -
-
comment
-
- -

Start a block comment, closed by end comment. -

-
-
commodity
-
- -

Pre-declare commodity names. This only has an effect if ---strict or --pedantic is used (see below). -

-
-
commodity $
-commodity CAD
-
- -

The commodity directive supports several optional -sub-directives, if they immediately follow the commodity directive -and—if they are on successive lines—begin with whitespace: -

-
-
commodity $
-   note American Dollars
-   format $1,000.00
-   nomarket
-   alias USD
-   default
-
- -

The note sub-directive associates a textual note with the -commodity. At present this has no value other than documentation. -

-

The format sub-directive gives you a way to tell Ledger how to -format this commodity. In the future, using this directive will disable -Ledger’s observation of other ways that commodity is used, and will -provide the “canonical” representation. -

-

The nomarket sub-directive states that the commodity’s price -should never be auto-downloaded. -

-

The alias sub-directive states that any commodity matching this -symbol is to use the commodity declared in this block. -

-

The default sub-directive marks this as the “default” commodity. -

-
-
define
-
-

Allows you to define value expressions for future use. For example: -

-
-
define var_name=$100
-
-2011/12/01 Test
-    Expenses  (var_name*4)
-    Assets
-
- -

The posting will have a cost of $400. -

-
-
end
-
-

Closes block commands like apply or comment. -

-
-
expr
-
- -
-
include
-
-

Include the stated file as if it were part of the current file. The file -name can contain a wildcard (‘*’) to refer to multiple files (e.g. -‘bank/*.ledger’). -

-
-
payee
-
- - - -

The payee directive supports two optional sub-directives, if they -immediately follow the payee directive and—if it is on a successive -line—begins with whitespace: -

-
-
payee KFC
-    alias KENTUCKY FRIED CHICKEN
-    uuid 2a2e21d434356f886c84371eebac6e44f1337fda
-
- -

The alias sub-directive provides a regex which, if it matches -a parsed payee, the declared payee name is substituted: -

-
-
2012-02-27 KENTUCKY FRIED CHICKEN  ; will be read as being 'KFC'
-
- -

The uuid sub-directive specifies that a transaction with exactly -the uuid given should have the declared payee name substituted: -

-
-
2014-05-13 UNHELPFUL PAYEE  ; will be read as being 'KFC'
-    ; UUID: 2a2e21d434356f886c84371eebac6e44f1337fda
-
- -

Ledger will display the mapped payees in print and -register reports. -

-
-
apply tag
-
-

Allows you to designate a block of transactions and assign the same -tag to all. Tags can have values and may be nested. -

-
-
apply tag hastag
-apply tag nestedtag: true
-
-2011/01/25 Tom's Used Cars
-    Expenses:Auto                    $ 5,500.00
-    ; :nobudget:
-    Assets:Checking
-
-2011/01/27 Book Store
-    Expenses:Books                       $20.00
-    Liabilities:MasterCard
-
-end apply tag
-
-2011/12/01 Sale
-    Assets:Checking:Business            $ 30.00
-    Income:Sales
-
-end apply tag
-
- -

is the equivalent of: -

-
-
2011/01/25 Tom's Used Cars
-    ; :hastag:
-    ; nestedtag: true
-    Expenses:Auto                    $ 5,500.00
-    ; :nobudget:
-    Assets:Checking
-
-2011/01/27 Book Store
-    ; :hastag:
-    ; nestedtag: true
-    Expenses:Books                       $20.00
-    Liabilities:MasterCard
-
-2011/12/01 Sale
-    ; :hastag:
-    Assets:Checking:Business            $ 30.00
-    Income:Sales
-
- - - -
-
tag
-
- -

Pre-declares tag names. This only has an effect if --strict or ---pedantic is used (see below). -

-
-
tag Receipt
-tag CSV
-
- -

The tag directive supports two optional sub-directives, if they -immediately follow the tag directive and—if on a successive -line—begin with whitespace: -

-
-
tag Receipt
-  check value =~ /pattern/
-  assert value != "foobar"
-
- -

The check and assert sub-directives warn or error -(respectively) if the given value expression evaluates to false within -the context of any use of the related tag. In such a context, -“value” is bound to the value of the tag (which may be something else -but a string if typed metadata is used!). Such checks or assertions are -not called if no value is given. -

-
-
test
-
- -

This is a synonym for comment and must be closed by an -end tag. -

-
-
year
-
-

Denotes the year used for all subsequent transactions that give a date -without a year. The year should appear immediately after the -directive, for example: year 2004. This is useful at the -beginning of a file, to specify the year for that file. If all -transactions specify a year, however, this command has no effect. -

-
-
- -

The following single letter commands may be at the beginning of a line -alone, for backwards compatibility with older Ledger versions. -

-
-
A
-
- -

See bucket. -

-
-
Y
-
- -

See year. -

-
-
N SYMBOL
-
-

Indicates that pricing information is to be ignored for a given -symbol, nor will quotes ever be downloaded for that symbol. Useful -with a home currency, such as the dollar ‘$’. It is recommended -that these pricing options be set in the price database file, which -defaults to ~/.pricedb. The syntax for this command is: -

-
-
N SYMBOL
-
- -
-
D AMOUNT
-
- -

Specifies the default commodity to use, by specifying an amount in the -expected format. The xact command will use this commodity as -the default when none other can be determined. This command may be used -multiple times, to set the default flags for different commodities; -whichever is seen last is used as the default commodity. For example, -to set US dollars as the default commodity, while also setting the -thousands flag and decimal flag for that commodity, use: -

-
-
D $1,000.00
-
- -
-
C AMOUNT1 = AMOUNT2
-
-

Specifies a commodity conversion, where the first amount is given to -be equivalent to the second amount. The first amount should use the -decimal precision desired during reporting: -

-
-
C 1.00 Kb = 1024 bytes
-
- -
-
I, i, O, o, b, h
-
- - - - - -

These four relate to timeclock support, which permits Ledger to read -timelog files. See timeclock’s documentation for more info on the -syntax of its timelog files. -

-
-
- -
- - - -

4.8 Converting from other formats

- - -

There are numerous tools to help convert various formats to a Ledger -file. Most banks will generate a comma separated values file that can -easily be parsed into Ledger format using one of those tools. Some of -the most popular tools are: -

- - -

Directly pulling information from banks is outside the scope of -Ledger’s function. -

-
- - - -

4.9 Archiving Previous Years

- - - -

After a while, your journal can get to be pretty large. While this -will not slow down Ledger—it’s designed to process journals very -quickly—things can start to feel “messy”; and it’s a universal -complaint that when finances feel messy, people avoid them. -

-

Thus, archiving the data from previous years into their own files can -offer a sense of completion, and freedom from the past. But how to -best accomplish this with the ledger program? There are two commands -that make it very simple: print, and equity. -

-

Let’s take an example file, with data ranging from year 2000 until -2004. We want to archive years 2000 and 2001 to their own file, -leaving 2002–2004 in the current file. So, use print to -output all the earlier transactions to a file called -ledger-old.dat: -

-
-
$ ledger -f ledger.dat -b 2000 -e 2002 print > ledger-old.dat
-
- -

Note that -e limits output to transactions before the -date specified. -

-

To delete older data from the current ledger file, use print -again, this time specifying year 2002 as the starting date: -

-
-
$ ledger -f ledger.dat -b 2002 print > x
-$ mv x ledger.dat
-
- -

However, now the current file contains only postings from 2002 -onward, which will not yield accurate present-day balances, because the -net income from previous years is no longer being tallied. To -compensate for this, we must append an equity report for the old ledger -at the beginning of the new one: -

-
-
$ ledger -f ledger-old.dat equity > equity.dat
-$ cat equity.dat ledger.dat > x
-$ mv x ledger.dat
-$ rm equity.dat
-
- -

Now the balances reported from ledger.dat are identical to what -they were before the data was split. -

-

How often should you split your ledger? You never need to, if you -don’t want to. Even eighty years of data will not slow down ledger -much, and that’s just using present day hardware! Or, you can keep -the previous and current year in one file, and each year before that -in its own file. It’s really up to you, and how you want to organize -your finances. For those who also keep an accurate paper trail, it -might be useful to archive the older years to their own files, then -burn those files to a CD to keep with the paper records—along with -any electronic statements received during the year. In the arena of -organization, just keep in mind this maxim: Do whatever keeps you -doing it. -

-
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

5 Transactions

- - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.1 Basic format

- -

The most basic form of transaction is: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash                 $-20.00
-
- -

This transaction has a date, a payee or description, a target account -(the first posting), and a source account (the second posting). Each -posting specifies what action is taken related to that account. -

-

A transaction can have any number of postings: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash                 $-10.00
-    Liabilities:Credit          $-10.00
-
- -
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.2 Eliding amounts

- -

The first thing you can do to make things easier is elide amounts. -That is, if exactly one posting has no amount specified, Ledger will -infer the inverse of the other postings’ amounts: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash                 $-10.00
-    Liabilities:Credit                   ; same as specifying $-10
-
- -

If the other postings use multiple commodities, Ledger will copy the -empty posting N times and fill in the negated values of the various -commodities: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Expenses:Tips                 $2.00
-    Assets:Cash              EUR -10.00
-    Assets:Cash              GBP -10.00
-    Liabilities:Credit
-
- -

This transaction is identical to writing: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Expenses:Tips                 $2.00
-    Assets:Cash              EUR -10.00
-    Assets:Cash              GBP -10.00
-    Liabilities:Credit          $-22.00
-    Liabilities:Credit        EUR 10.00
-    Liabilities:Credit        GBP 10.00
-
- -
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.3 Auxiliary dates

- - -

You can associate a second date with a transaction by following the -primary date with an equals sign: -

-
-
2012-03-10=2012-03-08 KFC
-    Expenses:Food                $20.00
-    Assets:Cash                 $-20.00
-
- -

What this auxiliary date means is entirely up to you. The only use -Ledger has for it is that if you specify --aux-date, then all -reports and calculations (including pricing) will use the auxiliary -date as if it were the primary date. -

-
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.4 Codes

- -

A transaction can have a textual “code”. This has no meaning and is -only displayed by the print command. Checking accounts often use -codes like DEP, XFER, etc., as well as check numbers. This is to give -you a place to put those codes: -

-
-
2012-03-10 (#100) KFC
-    Expenses:Food                $20.00
-    Assets:Checking
-
- -
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.5 Transaction state

- - - - -

A transaction can have a “state”: cleared, pending, or uncleared. The -default is uncleared. To mark a transaction cleared, put an asterisk -‘*’ after the date, before the code or payee: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

To mark it pending, use a ‘!’: -

-
-
2012-03-10 ! KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

What these mean is entirely up to you. The --cleared option -limits reports to only cleared items, while --uncleared -shows both uncleared and pending items, and --pending shows -only pending items. -

-

I use cleared to mean that I’ve reconciled the transaction with my -bank statement, and pending to mean that I’m in the middle of -a reconciliation. -

-

When you clear a transaction, that’s really just shorthand for -clearing all of its postings. That is: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

Is the same as writing: -

-
-
2012-03-10 KFC
-    * Expenses:Food                $20.00
-    * Assets:Cash
-
- -

You can mark individual postings as cleared or pending, in case one -“side” of the transaction has cleared, but the other hasn’t yet: -

-
-
2012-03-10 KFC
-    Liabilities:Credit            $100.00
-    * Assets:Checking
-
- -
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.6 Transaction notes

- -

After the payee, and after at least one tab or two spaces (or a space -and a tab), which Ledger calls a “hard separator”, you may -introduce a note about the transaction using the ‘;’ character: -

-
-
2012-03-10 * KFC                ; yum, chicken...
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

Notes can also appear on the next line, so long as that line begins -with whitespace: -

-
-
2012-03-10 * KFC                ; yum, chicken...
-    ; and more notes...
-    Expenses:Food                $20.00
-    Assets:Cash
-
-2012-03-10 * KFC
-    ; just these notes...
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

A transaction’s note is shared by all its postings. This becomes -significant when querying for metadata (see below). To specify that -a note belongs only to one posting, place it after a hard separator -after the amount, or on its own line preceded by whitespace: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00  ; posting #1 note
-    Assets:Cash
-      ; posting #2 note, extra indentation is optional
-
- -
- - - -

5.7 Metadata

- -

One of Ledger’s more powerful features is the ability to associate -typed metadata with postings and transactions (by which I mean all of -a transaction’s postings). This metadata can be queried, displayed, -and used in calculations. -

-

The are two forms of metadata: plain tags, and tag/value pairs. -

- - - - - - -
- -
-

-Next: , Previous: , Up: Metadata   [Contents][Index]

-
- -

5.7.1 Metadata tags

- -

To tag an item, put any word not containing whitespace between two -colons inside a comment: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-      ; :TAG:
-
- -

You can gang up multiple tags by sharing colons: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-      ; :TAG1:TAG2:TAG3:
-
- - - - - -
- -
-

-Previous: , Up: Metadata tags   [Contents][Index]

-
- -

5.7.1.1 Payee metadata tag

- - - - - -

“Payee” is a special metadata field. If set on a posting, it will be -used as the payee name for that posting. This affects the -register report, the payees report, and the ---by-payee option. -

-

This is useful when for example you deposit 4 checks at a time to the -bank. On the bank statement, there is just one amount ‘$400’, but -you can specify from whom each check came, as shown by example -below: -

-
-
2010-06-17 Sample
-    Assets:Bank        $400.00
-    Income:Check1     $-100.00  ; Payee: Person One
-    Income:Check2     $-100.00  ; Payee: Person Two
-    Income:Check3     $-100.00  ; Payee: Person Three
-    Income:Check4     $-100.00  ; Payee: Person Four
-
- -

When reporting with -

-
-
$ ledger reg
-
- -

it appears as: -

-
-
10-Jun-17 Sample                Assets:Bank                 $400.00      $400.00
-          Person One            Income:Check1              $-100.00      $300.00
-          Person Two            Income:Check2              $-100.00      $200.00
-          Person Three          Income:Check3              $-100.00      $100.00
-          Person Four           Income:Check4              $-100.00            0
-
- -

This shows that they are all in the same transaction (which is why the -date is not repeated), but they have different payees now. -

-

If using the --strict or --pedantic options, you must -declare this tag to avoid warnings and errors. -

-

The payee name used with the tag is not enforced by the ---check-payees option, due to a bug: -https://github.com/ledger/ledger/issues/556. -

-
- -
-

-Next: , Previous: , Up: Metadata   [Contents][Index]

-
- -

5.7.2 Metadata values

- -

To associate a value with a tag, use the syntax “Key: Value”, where -the value can be any string of characters. Whitespace is needed after -the colon, and cannot appear in the Key: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-      ; MyTag: This is just a bogus value for MyTag
-
- -
- -
-

-Previous: , Up: Metadata   [Contents][Index]

-
- -

5.7.3 Typed metadata

- -

If a metadata tag ends in ::, its value will be parsed as a value -expression and stored internally as a value rather than as a string. -For example, although I can specify a date textually like so: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-      ; AuxDate: 2012/02/30
-
- -

This date is just a string, and won’t be parsed as a date unless its -value is used in a date-context (at which time the string is parsed -into a date automatically every time it is needed as a date). If on -the other hand I write this: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-      ; AuxDate:: [2012/02/30]
-
- -

Then it is parsed as a date only once, and during parsing of the -journal file, which would let me know right away that it is an invalid -date. -

-
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.8 Virtual postings

- - -

Ordinarily, the amounts of all postings in a transaction must balance -to zero. This is non-negotiable. It’s what double-entry accounting -is all about! But there are some tricks up Ledger’s sleeve... -

-

You can use virtual accounts to transfer amounts to an account on the -sly, bypassing the balancing requirement. The trick is that these -postings are not considered “real”, and can be removed from all -reports using --real. -

-

To specify a virtual account, surround the account name with -parentheses: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-    (Budget:Food)               $-20.00
-
- -

If you want, you can state that virtual postings should balance -against one or more other virtual postings by using brackets (which -look “harder”) rather than parentheses: -

-
-
2012-03-10 * KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-    [Budget:Food]               $-20.00
-    [Equity:Budgets]             $20.00
-
- -
- - - -

5.9 Expression amounts

- -

An amount is a numerical figure with a commodity, but it can also be -any value expression. To indicate this, surround the amount -expression with parentheses: -

-
-
2012-03-10 * KFC
-    Expenses:Food      ($10.00 + $20.00)  ; Ledger adds it up for you
-    Assets:Cash
-
- -
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.10 Balance verification

- - - - - - - - - -

If at the end of a posting’s amount (and after the cost too, if there -is one) there is an equals sign, then Ledger will verify that the -total value for that account as of that posting matches the amount -specified. See --permissive option to relax the balance assertions checks. -

-

There are two forms of this features: balance assertions, and balance -assignments. -

-
- - - -

5.10.1 Balance assertions

- -

A balance assertion has this general form: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash                 $-20.00 = $500.00
-
- -

This simply asserts that after subtracting $20.00 from Assets:Cash, -that the resulting total matches $500.00. If not, it is an error. -

-

The assertion has an effect only on the specified commodity. If an account has -multiple commodities, then only the one asserted is verified: -

-
-
2012-03-10 KFC New York
-    Expenses:Food                $20.00
-    Assets:Cash                 $-20.00 = $500.00
-
-2012-03-11 KFC Montreal
-    Expenses:Food                 15.00 CAD
-    Assets:Cash                  -15.00 CAD = $500.00
-
- -

In this case, the amount in USD of cash (which has not changed) is validated. -Nothing is asserted about the current amount of Canadian dollars in ‘Asset:Cash’. -

- -

5.10.1.1 Special assertion value 0

- -

The only value that can be asserted without a commodity is ‘0’. -This results in a cross-commodities assertion, which makes it possible to -assert that an account is totally empty. -

-
-
2012-03-09 Fill Wallet
-    Revenue                      $20.00
-    Revenue                       15.00 CAD
-    Assets:Cash
-
-2012-03-10 KFC New York
-    Expenses:Food                $20.00
-    Assets:Cash                 $-20.00
-
-2012-03-11 KFC Montreal
-    Expenses:Food                 15.00 CAD
-    Assets:Cash                  -15.00 CAD = 0
-
- -

The last transaction will assert that we are out of cash of any sort. -

-
- - - -

5.10.2 Balance assignments

- -

A balance assignment has this form: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash                         = $500.00
-
- -

This sets the amount of the second posting to whatever it would need to -be for the total in ‘Assets:Cash’ to be $500.00 after the posting. -If the resulting amount is not $-20.00 in this case, it is an error. -

-
- - - -

5.10.3 Resetting a balance

- -

Say your book-keeping has gotten a bit out of date, and your Ledger -balance no longer matches your bank balance. You can create an -adjustment transaction using balance assignments: -

-
-
2012-03-10 Adjustment
-    Assets:Cash                         = $500.00
-    Equity:Adjustments
-
- -

Since the second posting is also null, its value will become the -inverse of whatever amount is generated for the first posting. -

-

This is the only time in ledger when more than one posting’s amount -may be empty—and then only because it’s not truly empty, it is -indirectly provided by the balance assignment’s value. -

-
- - - -

5.10.4 Balancing transactions

- - -

As a consequence of all the above, consider the following transaction: -

-
-
2012-03-10 My Broker
-    [Assets:Brokerage]            = 10 AAPL
-
- -

What this says is: set the amount of the posting to whatever value is -needed so that ‘Assets:Brokerage’ contains 10 AAPL. Then, because -this posting must balance, ensure that its value is zero. This can only -be true if Assets:Brokerage does indeed contain 10 AAPL at that point in -the input file. -

-

A balanced virtual transaction is used simply to indicate to Ledger that -this is not a “real” transaction. It won’t appear in any reports -anyway (unless you use a register report with --empty). -

-
- - - -

5.11 Posting cost

- -

When you transfer a commodity from one account to another, sometimes -it gets transformed during the transaction. This happens when you -spend money on gas, for example, which transforms dollars into gallons -of gasoline, or dollars into stocks in a company. -

-

In those cases, Ledger will remember the “cost” of that transaction -for you, and can use it during reporting in various ways. Here’s an -example of a stock purchase: -

-
-
2012-03-10 My Broker
-    Assets:Brokerage             10 AAPL
-    Assets:Brokerage:Cash       $-500.00
-
- -

This is different from transferring 10 AAPL shares from one account to -another, in this case you are exchanging one commodity for -another. The resulting posting’s cost is $50.00 per share. -

-
- - - -

5.12 Explicit posting costs

- -

You can make any posting’s cost explicit using the ‘@’ symbol -after the amount or amount expression: -

-
-
2012-03-10 My Broker
-    Assets:Brokerage             10 AAPL @ $50.00
-    Assets:Brokerage:Cash       $-500.00
-
- -

When you do this, since Ledger can now figure out the balancing amount -from the first posting’s cost, you can elide the other amount: -

-
-
2012-03-10 My Broker
-    Assets:Brokerage             10 AAPL @ $50.00
-    Assets:Brokerage:Cash
-
- - - - - -
- - - -

5.12.1 Primary and secondary commodities

- - - -

It is a general convention within Ledger that the “top” postings in -a transaction contain the target accounts, while the final posting -contains the source account. Whenever a commodity is exchanged like -this, the commodity moved to the target account is considered -“secondary”, while the commodity used for purchasing and tracked in -the cost is “primary”. -

-

Said another way, whenever Ledger sees a posting cost of the form -"AMOUNT @ AMOUNT", the commodity used in the second amount is marked -“primary”. -

-

The only meaning a primary commodity has is that the --market -(-V) flag will never convert a primary commodity into any other -commodity. --exchange COMMODITY (-X) still will, -however. -

-
- - - -

5.13 Posting cost expressions

- -

Just as you can have amount expressions, you can have posting -expressions: -

-
-
2012-03-10 My Broker
-    Assets:Brokerage             10 AAPL @ ($500.00 / 10)
-    Assets:Brokerage:Cash
-
- -

You can even have both: -

-
-
2012-03-10 My Broker
-    Assets:Brokerage             (5 AAPL * 2) @ ($500.00 / 10)
-    Assets:Brokerage:Cash
-
- -
- - - -

5.14 Total posting costs

- -

The cost figure following the ‘@’ character specifies the -per-unit price for the commodity being transferred. If you’d -like to specify the total cost instead, use ‘@@’: -

-
-
2012-03-10 My Broker
-    Assets:Brokerage             10 AAPL @@ $500.00
-    Assets:Brokerage:Cash
-
- -

Ledger reads this as if you had written: -

-
-
2012-03-10 My Broker
-    Assets:Brokerage             10 AAPL @ ($500.00 / 10)
-    Assets:Brokerage:Cash
-
- -
- - - -

5.15 Virtual posting costs

- -

Normally whenever a commodity exchange like this happens, the price of -the exchange (such as $50 per share of AAPL, above) is recorded in -Ledger’s internal price history database. To prevent this from -happening in the case of an exceptional transaction, surround the -‘@’ or ‘@@’ with parentheses: -

-
-
2012-03-10 My Brother
-    Assets:Brokerage            1000 AAPL (@) $1
-    Income:Gifts Received
-
- -
- - - -

5.16 Commodity prices

- - -

When a transaction occurs that exchanges one commodity for another, -Ledger records that commodity price not only within its internal price -database, but also attached to the commodity itself. Usually this fact -remains invisible to the user, unless you turn on --lot-prices -to show these hidden price figures. -

-

For example, consider the stock sale given above: -

-
-
2012-03-10 My Broker
-    Assets:Brokerage             10 AAPL @ $50.00
-    Assets:Brokerage:Cash
-
- -

The commodity transferred into ‘Assets:Brokerage’ is not actually 10 -AAPL, but rather 10 AAPL {$50.00}. The figure in braces after the -amount is called the “lot price”. It’s Ledger’s way of remembering -that this commodity was transferred through an exchange, and that -$50.00 was the price of that exchange. -

-

This becomes significant if you later sell that commodity again. For -example, you might write this: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage:Cash
-    Assets:Brokerage            -10 AAPL @ $75.00
-
- -

And that would be perfectly fine, but how do you track the capital -gains on the sale? It could be done with a virtual posting: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage:Cash
-    Assets:Brokerage            -10 AAPL @ $75.00
-    (Income:Capital Gains)      $-250.00
-
- -

But this gets messy since capital gains income is very real, and not -quite appropriate for a virtual posting. -

-

Instead, if you reference that same hidden price annotation, Ledger -will figure out that the price of the shares you’re selling, and the -cost you’re selling them at, don’t balance: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage:Cash       $750.00
-    Assets:Brokerage            -10 AAPL {$50.00} @ $75.00
-
- -

This transaction will fail because the $250.00 price difference -between the price you bought those shares at, and the cost you’re -selling them for, does not match. The lot price also identifies which -shares you purchased on that prior date. -

- - - - -
- -
-

-Previous: , Up: Commodity prices   [Contents][Index]

-
- -

5.16.1 Total commodity prices

- -

As a shorthand, you can specify the total price instead of the -per-share price in doubled braces. This goes well with total costs, -but is not required to be used with them: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage:Cash       $750.00
-    Assets:Brokerage            -10 AAPL {{$500.00}} @@ $750.00
-    Income:Capital Gains       $-250.00
-
- -

It should be noted that this is a convenience only for cases where you -buy and sell whole lots. The {{$500.00}} is not an attribute -of the commodity, whereas {$50.00} is. In fact, when you write -{{$500.00}}, Ledger just divides that value by 10 and sees -{$50.00}. So if you use the print command to look at this -transaction, you’ll see the single braces form in the output. The -double braces price form is a shorthand only. -

-

Plus, it comes with dangers. This works fine: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage            10 AAPL @ $50.00
-    Assets:Brokerage:Cash      $-500.00
-
-2012-04-10 My Broker
-    Assets:Brokerage:Cash       $375.00
-    Assets:Brokerage            -5 AAPL {$50.00} @@ $375.00
-    Income:Capital Gains       $-125.00
-
-2012-04-10 My Broker
-    Assets:Brokerage:Cash       $375.00
-    Assets:Brokerage            -5 AAPL {$50.00} @@ $375.00
-    Income:Capital Gains       $-125.00
-
- -

But this does not do what you might expect: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage            10 AAPL @ $50.00
-    Assets:Brokerage:Cash      $-500.00
-
-2012-04-10 My Broker
-    Assets:Brokerage:Cash       $375.00
-    Assets:Brokerage            -5 AAPL {{$500.00}} @@ $375.00
-    Income:Capital Gains       $-125.00
-
-2012-04-10 My Broker
-    Assets:Brokerage:Cash       $375.00
-    Assets:Brokerage            -5 AAPL {{$500.00}} @@ $375.00
-    Income:Capital Gains       $-125.00
-
- -

And in cases where the amounts do not divide into whole figures and -must be rounded, the capital gains figure could be off by a cent. Use -with caution. -

-
- - - -

5.17 Prices versus costs

- -

Because lot pricing provides enough information to infer the cost, the -following two transactions are equivalent: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage            10 AAPL @ $50.00
-    Assets:Brokerage:Cash      $-500.00
-
-2012-04-10 My Broker
-    Assets:Brokerage            10 AAPL {$50.00}
-    Assets:Brokerage:Cash      $-500.00
-
- -

However, note that what you see in some reports may differ, for -example in the print report. Functionally, however, there is no -difference, and neither the register nor the balance report are -sensitive to this difference. -

-
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.18 Fixated prices and costs

- -

If you bought a stock last year, and ask for its value today, Ledger -will consult its price database to see what the most recent price for -that stock is. You can short-circuit this lookup by “fixing” the -price at the time of a transaction. This is done using -‘{=AMOUNT}’: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage            10 AAPL {=$50.00}
-    Assets:Brokerage:Cash      $-500.00
-
- -

These 10 AAPL will now always be reported as being worth $50, no -matter what else happens to the stock in the meantime. -

-

Fixated prices are a special case of using lot valuation expressions -(see below) to fix the value of a commodity lot. -

-

Since price annotations and costs are largely interchangeable and -a matter of preference, there is an equivalent syntax for specified -fixated prices by way of the cost: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage            10 AAPL @ =$50.00
-    Assets:Brokerage:Cash      $-500.00
-
- -

This is the same as the previous transaction, with the same caveats -found in Prices versus costs. -

-
- - - -

5.19 Lot dates

- - -

In addition to lot prices, you can specify lot dates and reveal them -with --lot-dates. Other than that, however, they have no -special meaning to Ledger. They are specified after the amount in -square brackets (the same way that dates are parsed in value -expressions): -

-
-
2012-04-10 My Broker
-    Assets:Brokerage:Cash       $375.00
-    Assets:Brokerage            -5 AAPL {$50.00} [2012-04-10] @@ $375.00
-    Income:Capital Gains       $-125.00
-
- -
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.20 Lot notes

- - - -

You can also associate arbitrary notes for your own record keeping in -parentheses, and reveal them with --lot-notes. One caveat is -that the note cannot begin with an ‘@’ character, as that would -indicate a virtual cost: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage:Cash       $375.00
-    Assets:Brokerage            -5 AAPL {$50.00} [2012-04-10] (Oh my!) @@ $375.00
-    Income:Capital Gains       $-125.00
-
- -

You can specify any combination of lot prices, dates or notes, in any -order. They are all optional. -

-

To show all lot information in a report, use --lots. -

-
- -
-

-Next: , Previous: , Up: Transactions   [Contents][Index]

-
- -

5.21 Lot value expressions

- -

Normally when you ask Ledger to display the values of commodities held, -it uses a value expression called “market” to determine the most -recent value from its price database—even downloading prices from the -Internet, if --download (-Q) was specified and a suitable -getquote script is found on your system. -

-

However, you can override this valuation logic by providing -a commodity valuation expression in doubled parentheses. This -expression must result in one of two values: either an amount to -always be used as the per-share price for that commodity; or -a function taking three arguments, which is called to determine that -price. -

-

If you use the functional form, you can either specify a function -name, or a lambda expression. Here’s a function that yields the price -as $10 in whatever commodity is being requested: -

-
-
define ten_dollars(s, date, t) = market($10, date, t)
-
- -

I can now use that in a lot value expression as follows: -

-
-
2012-04-10 My Broker
-    Assets:Brokerage:Cash       $375.00
-    Assets:Brokerage            -5 AAPL {$50.00} ((ten_dollars)) @@ $375.00
-    Income:Capital Gains       $-125.00
-
- -

Alternatively, I could do the same thing without pre-defining -a function by using a lambda expression taking three arguments: -

-
-
2012-04-10 My Broker
-    A:B:Cash       $375.00
-    A:B     -5 AAPL {$50.00} ((s, d, t -> market($10, date, t))) @@ $375.00
-    Income:Capital Gains       $-125.00
-
- -

The arguments passed to these functions have the following meaning: -

-
    -
  • source -The source commodity string, or an amount object. If it is a string, -the return value must be an amount representing the price of the -commodity identified by that string (example: ‘$’). If it is an -amount, return the value of that amount as a new amount (usually -calculated as commodity price times source amount). - -
  • date -The date to use for determining the value. If null, it means no date -was specified, which can mean whatever you want it to mean. - -
  • target -If not null, a string representing the desired target commodity that the -commodity price, or repriced amount, should be valued in. Note that -this string can be a comma-separated list, and that some or all of the -commodities in that list may be suffixed with an exclamation mark, to -indicate what is being desired. - -
- -

In most cases, it is simplest to either use explicit amounts in your -valuation expressions, or just pass the arguments down to ‘market’ -after modifying them to suit your needs. -

-
- - - -

5.22 Automated Transactions

- -

An automated transaction is a special kind of transaction which adds -its postings to other transactions any time one of that other -transactions’ postings matches its predicate. The predicate uses the -same query syntax as the Ledger command-line. -

-

Consider this posting: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

If I write this automated transaction before it in the file: -

-
-
= expr true
-    Foo                          $50.00
-    Bar                         $-50.00
-
- -

Then the first transaction will be modified during parsing as if I’d -written this: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Foo                          $50.00
-    Bar                         $-50.00
-    Assets:Cash                 $-20.00
-    Foo                          $50.00
-    Bar                         $-50.00
-
- -

Despite this fancy logic, automated transactions themselves follow -most of the same rules as regular transactions: their postings must -balance (unless you use a virtual posting), you can have metadata, -etc. -

-

One thing you cannot do, however, is elide amounts in an automated -transaction. -

- - - - - - - - - - - - -
- - - -

5.22.1 Amount multipliers

- -

As a special case, if an automated transaction’s posting’s amount -(phew) has no commodity, it is taken as a multiplier upon the matching -posting’s cost. For example: -

-
-
= expr true
-    Foo                           50.00
-    Bar                          -50.00
-
-2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

Then the latter transaction turns into this during parsing: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    Foo                        $1000.00
-    Bar                       $-1000.00
-    Assets:Cash                 $-20.00
-    Foo                        $1000.00
-    Bar                       $-1000.00
-
- -
- - - -

5.22.2 Accessing the matching posting’s amount

- -

If you use an amount expression for an automated transaction’s -posting, that expression has access to all the details of the matched -posting. For example, you can refer to that posting’s amount using -the “amount” value expression variable: -

-
-
= expr true
-    (Foo)                  (amount * 2)  ; same as just "2" in this case
-
-2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

This becomes: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    (Foo)                        $40.00
-    Assets:Cash                 $-20.00
-    (Foo)                       $-40.00
-
- -
- - - -

5.22.3 Referring to the matching posting’s account

- -

Sometimes you want to refer to the account that was matched -in some way within the automated transaction itself. This is -done by using the string ‘$account’, anywhere within the -account part of the automated posting: -

-
-
= food
-    (Budget:$account)                10
-
-2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

Becomes: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    (Budget:Expenses:Food)      $200.00
-    Assets:Cash                 $-20.00
-
- -

Keep in mind that if you are using --strict or --pedantic you will have to explicitly define an account ‘$account’ to avoid errors. -

-
-
account $account
-
- -
- - - -

5.22.4 Applying metadata to every matched posting

- -

If the automated transaction has a transaction note, that note is -copied (along with any metadata) to every posting that matches the -predicate: -

-
-
= food
-    ; Foo: Bar
-    (Budget:$account)                10
-
-2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

Becomes: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-      ; Foo: Bar
-    (Budget:Expenses:Food)      $200.00
-    Assets:Cash                 $-20.00
-
- -
- - - -

5.22.5 Applying metadata to the generated posting

- -

If the automated transaction’s posting has a note, that note is -carried to the generated posting within the matched transaction: -

-
-
= food
-    (Budget:$account)                10
-      ; Foo: Bar
-
-2012-03-10 KFC
-    Expenses:Food                $20.00
-    Assets:Cash
-
- -

Becomes: -

-
-
2012-03-10 KFC
-    Expenses:Food                $20.00
-    (Budget:Expenses:Food)      $200.00
-      ; Foo: Bar
-    Assets:Cash                 $-20.00
-
- -

This is slightly different from the rules for regular transaction -notes, in that an automated transaction’s note does not apply to every -posting within the automated transaction itself, but rather to every -posting it matches. -

-
- - - -

5.22.6 State flags

- -

Although you cannot mark an automated transaction as a whole as -cleared or pending, you can mark its postings with a ‘*’ or -‘!’ before the account name, and that state flag gets carried to -the generated posting. -

-
- - - -

5.22.7 Effective Dates

- - - -

In the real world, transactions do not take place instantaneously. -Purchases can take several days to post to a bank account. And you may -pay ahead for something for which you want to distribute costs. With -Ledger you can control every aspect of the timing of a transaction. -

-

Say you’re in business. If you bill a customer, you can enter -something like -

- - -
-
2008/01/01=2008/01/14 Client invoice  ;  estimated date you'll be paid
-    Assets:Accounts Receivable            $100.00
-    Income: Client name
-
- -

Then, when you receive the payment, you change it to -

-
-
2008/01/01=2008/01/15 Client invoice ;  actual date money received
-    Assets:Accounts Receivable            $100.00
-    Income: Client name
-
- -

and add something like -

-
-
2008/01/15 Client payment
-    Assets:Checking                       $100.00
-    Assets:Accounts Receivable
-
- -

Now -

-
-
$ ledger --begin 2008/01/01 --end 2008/01/14 bal Income
-
- -

gives you your accrued income in the first two weeks of the year, and -

-
-
$ ledger --effective --begin 2008/01/01 --end 2008/01/14 bal Income
-
- -

gives you your cash basis income in the same two weeks. -

-

Another use is distributing costs out in time. As an example, suppose -you just prepaid into a local vegetable co-op that sustains you -through the winter. It costs $225 to join the program, so you write -a check. You don’t want your October grocery budget to be blown -because you bought food ahead, however. What you really want is for -the money to be evenly distributed over the next six months so that -your monthly budgets gradually take a hit for the vegetables you’ll -pick up from the co-op, even though you’ve already paid for them. -

-
-
2008/10/16 * (2090) Bountiful Blessings Farm
-    Expenses:Food:Groceries                  $ 37.50  ; [=2008/10/01]
-    Expenses:Food:Groceries                  $ 37.50  ; [=2008/11/01]
-    Expenses:Food:Groceries                  $ 37.50  ; [=2008/12/01]
-    Expenses:Food:Groceries                  $ 37.50  ; [=2009/01/01]
-    Expenses:Food:Groceries                  $ 37.50  ; [=2009/02/01]
-    Expenses:Food:Groceries                  $ 37.50  ; [=2009/03/01]
-    Assets:Checking
-
- -

This entry accomplishes this. Every month you’ll see an -automatic $37.50 deficit like you should, while your checking account -really knows that it debited $225 this month. -

-

And using the --effective option, the initial date will be -overridden by the effective dates. -

-
-
$ ledger --effective register Groceries
-
- -
-
08-Oct-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50      $ 37.50
-08-Nov-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50      $ 75.00
-08-Dec-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50     $ 112.50
-09-Jan-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50     $ 150.00
-09-Feb-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50     $ 187.50
-09-Mar-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50     $ 225.00
-
- -
- - - -

5.22.8 Periodic Transactions

- - -

A periodic transaction starts with a tilde ‘~’ followed by a period -expression (see Period Expressions). Periodic transactions are used for budgeting and -forecasting only, they have no effect without the --budget -option specified. For examples and details, see Budgeting and Forecasting. -

-
- - - -

5.22.9 Concrete Example of Automated Transactions

- -

As a Bahá’í, I need to compute Huqúqu’lláh whenever I acquire assets. -It is similar to tithing for Jews and Christians, or to Zakát for -Muslims. The exact details of computing Huqúqu’lláh are somewhat -complex, but if you have further interest, please consult the Web. -

-

Ledger makes this otherwise difficult law very easy. Just set up an -automated posting at the top of your ledger file: -

-
-
; This automated transaction will compute Huqúqu'lláh based on this
-; journal's postings.  Any accounts that match will affect the
-; Liabilities:Huququ'llah account by 19% of the value of that posting.
-
-= /^(?:Income:|Expenses:(?:Business|Rent$|Furnishings|Taxes|Insurance))/
-  (Liabilities:Huququ'llah)               0.19
-
- -

This automated posting works by looking at each posting in the -ledger file. If any match the given value expression, 19% of the -posting’s value is applied to the ‘Liabilities:Huququ'llah’ -account. So, if $1000 is earned from ‘Income:Salary’, $190 is -added to ‘Liabilities:Huqúqu'lláh’; if $1000 is spent on Rent, -$190 is subtracted. -

-
-
2003/01/01 (99) Salary
-  Income:Salary  -$1000
-  Assets:Checking
-
-2003/01/01 (100) Rent
-  Expenses:Rent  $500
-  Assets:Checking
-
- -

The ultimate balance of Huqúqu’lláh reflects how -much is owed in order to fulfill one’s obligation to Huqúqu’lláh. -When ready to pay, just write a check to cover the amount shown in -‘Liabilities:Huququ'llah’. That transaction would look like: -

-
-
2003/01/01 (101) Baha'i Huqúqu'lláh Trust
-    Liabilities:Huququ'llah          $1,000.00
-    Assets:Checking
-
- -

That’s it. To see how much Huqúq is currently owed based on your -ledger transactions, use: -

-
-
$ ledger balance Liabilities:Huquq
-
- -
-
                $-95  Liabilities:Huququ'llah
-
- -

This works fine, but omits one aspect of the law: that Huqúq is only -due once the liability exceeds the value of 19 mithqáls of gold (which -is roughly 2.22 ounces). So what we want is for the liability to -appear in the balance report only when it exceeds the present day -value of 2.22 ounces of gold. This can be accomplished using the -command: -

-
-
$ ledger -Q -t "/Liab.*Huquq/?(a/P{2.22 AU}<={-1.0}&a):a" bal liab
-
- -

With this command, the current price for gold is downloaded, and the -Huqúqu’lláh is reported only if its value exceeds that of 2.22 ounces -of gold. If you wish the liability to be reflected in the parent -subtotal either way, use this instead: -

-
-
$ ledger -Q -T "/Liab.*Huquq/?(O/P{2.22 AU}<={-1.0}&O):O" bal liab
-
- -

In some cases, you may wish to refer to the account of whichever posting -matched your automated transaction’s value expression. To do this, use -the special account name ‘$account’: -

-
-
= /^Some:Long:Account:Name/
-    [$account]  -0.10
-    [Savings]    0.10
-
- -

This example causes 10% of the matching account’s total to be deferred -to the ‘Savings’ account—as a balanced virtual posting, which -may be excluded from reports by using --real. -

-
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

6 Building Reports

- - - - - - - - -
- - - -

6.1 Introduction

- -

The power of Ledger comes from the incredible flexibility in its -reporting commands, combined with formatting commands. Some options -control what is included in the calculations, and formatting controls -how it is displayed. The combinations are infinite. This chapter will -show you the basics of combining various options and commands. In the -next chapters you will find details about the specific commands and -options. -

-
- -
-

-Next: , Previous: , Up: Building Reports   [Contents][Index]

-
- -

6.2 Balance Reports

- - - - - - -
- - - -

6.2.1 Controlling the Accounts and Payees

- -

The balance report is the most commonly used report. The simplest -invocation is: -

-
-
$ ledger balance -f drewr3.dat
-
- -

which will print the balances of every account in your journal. -

-
-
         $ -3,804.00  Assets
-          $ 1,396.00    Checking
-             $ 30.00      Business
-         $ -5,200.00    Savings
-         $ -1,000.00  Equity:Opening Balances
-          $ 6,654.00  Expenses
-          $ 5,500.00    Auto
-             $ 20.00    Books
-            $ 300.00    Escrow
-            $ 334.00    Food:Groceries
-            $ 500.00    Interest:Mortgage
-         $ -2,030.00  Income
-         $ -2,000.00    Salary
-            $ -30.00    Sales
-            $ -63.60  Liabilities
-            $ -20.00    MasterCard
-            $ 200.00    Mortgage:Principal
-           $ -243.60    Tithe
---------------------
-           $ -243.60
-
- -

Most times, this is more than you want. Limiting the results to -specific accounts is as easy as entering the names of the accounts -after the command: -

-
-
$ ledger balance -f drewr3.dat Auto MasterCard
-
- -
-
          $ 5,500.00  Expenses:Auto
-            $ -20.00  Liabilities:MasterCard
---------------------
-          $ 5,480.00
-
- -

Note the implicit logical or between ‘Auto’ and -‘Mastercard’. -

-

If you want the entire contents of a branch of your account tree, use -the highest common name in the branch: -

-
-
$ ledger balance -f drewr3.dat Income
-
- -
-
         $ -2,030.00  Income
-         $ -2,000.00    Salary
-            $ -30.00    Sales
---------------------
-         $ -2,030.00
-
- -

You can use general regular expressions in nearly any place Ledger -needs a string: -

-
-
$ ledger balance -f drewr3.dat ^Bo
-
- -

This first example looks for any account starting with ‘Bo’, of -which there are none. -

-
-
$ ledger balance -f drewr3.dat Bo
-
- -
-
             $ 20.00  Expenses:Books
-
- -

This second example looks for any account containing ‘Bo’, which is -‘Expenses:Books’. -

- - - -

If you want to know exactly how much you have spent in a particular -account on a particular payee, the following are equivalent: -

-
-
$ ledger balance Auto:Fuel and Chevron
-
- -
-
$ ledger balance --limit 'account=~/Fuel/' and 'payee=~/Chev/'
-
- -

will show you the amount expended on gasoline at Chevron. The second -example is the first example of the very powerful expression language -available to shape reports. The first example may be easier to -remember, but learning to use the second will open up far more -possibilities. -

-

If you want to exclude specific accounts from the report, you can -exclude multiple accounts with parentheses: -

-
-
$ ledger bal Expenses and not (Expenses:Drinks or Expenses:Candy or Expenses:Gifts)
-
- -
- - - -

6.2.2 Controlling Formatting

- -

These examples all use the default formatting for the balance report. -Customizing the formatting allows you to see only what you want, or -interface Ledger with other programs. For examples and details, -see Format Strings and Asset Allocation. -

-
- - - -

6.3 Typical queries

- -

A query such as the following shows all expenses since last -October, sorted by total: -

-
-
$ ledger -b "last oct" -S T bal ^expenses
-
- -

From left to right the options mean: Show transactions since last -October; sort by the absolute value of the total; and report the balance -for all accounts that begin with ‘expenses’. -

- - - - -
- -
-

-Previous: , Up: Typical queries   [Contents][Index]

-
- -

6.3.1 Reporting monthly expenses

- - - - - - -

The following query makes it easy to see monthly expenses, with each -month’s expenses sorted by the amount: -

-
-
$ ledger -M --period-sort "(amount)" reg ^expenses
-
- -

Now, you might wonder where the money came from to pay for these things. -To see that report, add --related (-r), which shows the -“related account” postings: -

-
-
$ ledger -M --period-sort "(amount)" -r reg ^expenses
-
- -

But maybe this prints too much information. You might just want to -see how much you’re spending with your MasterCard. That kind of query -requires the use of a display predicate, since the postings -calculated must match ‘^expenses’, while the postings -displayed must match ‘mastercard’. The command would be: -

-
-
$ ledger -M -r --display 'account=~/mastercard/' reg ^expenses
-
- -

This query says: Report monthly subtotals; report the “related -account” postings; display only related postings whose -account matches ‘mastercard’, and base the calculation on -postings matching ‘^expenses’. -

-

This works just as well for reporting the overall total, too: -

-
-
$ ledger -s -r --display "account=~/mastercard/" reg ^expenses
-
- -

The --subtotal (-s) option subtotals all postings, just as ---monthly (-M) subtotaled by the month. The running total in -both cases is off, however, since a display expression is being used. -

-
- -
-

-Previous: , Up: Building Reports   [Contents][Index]

-
- -

6.4 Advanced Reports

- - - - - - -
- - - -

6.4.1 Asset Allocation

- -

A very popular method of managing portfolios is to control the -percent allocation of assets by certain categories. The mix of -categories and the weights applied to them vary by investing -philosophy, but most follow a similar pattern. Tracking asset -allocation in ledger is not difficult but does require some additional -effort to describe how the various assets you own contribute to the -asset classes you want to track. -

-

In our simple example we assume you want to apportion your assets into -the general categories of domestic and international equities (stocks) -and a combined category of bonds and cash. For illustrative purposes, -we will use several publicly available mutual funds from Vanguard. -The three funds we will track are the Vanguard 500 IDX FD Signal -(VIFSX), the Vanguard Target Retirement 2030 (VTHRX), and the Vanguard -Short Term Federal Fund (VSGBX). Each of these funds allocates assets -to different categories of the investment universe and in different -proportions. When you buy a share of VTHRX, that share is partially -invested in equities, and partially invested in bonds and cash. Below -is the asset allocation for each of the instruments listed above: -

- - - - - - -
DomesticGlobal
SymbolEquityEquitybonds/cash
VIFSX100%
VTHRX24.0%56.3%19.7%
VSGBX100%
- -

These numbers are available from the prospectus of any publicly -available mutual fund. Of course a single stock issue is 100% equity -and a single bond issue is 100% bonds. -

-

We track purchases of specific investments using the symbol of that -investment as its commodity. How do we tell Ledger that a share of -VTHRX is 24% Domestic equity? Enter automatic transactions and -virtual accounts. -

-

At the top of our ledger we enter automatic transactions that describe -these proportions to Ledger. In the same entries we set up virtual -accounts that let us separate these abstract calculations from our -actual balances. -

-

For the three instruments listed above, those automatic transactions -would look like: -

-
-
= expr ( commodity == 'VIFSX' )
-    (Allocation:Equities:Domestic)             1.000
-
-= expr ( commodity == 'VTHRX' )
-    (Allocation:Equities:Global)               0.240
-    (Allocation:Equities:Domestic)             0.563
-    (Allocation:Bonds/Cash)                    0.197
-
-= expr ( commodity == 'VBMFX')
-    (Allocation:Bonds/Cash)                    1.000
-
-2015-01-01 Buy VIFSX
-    Assets:Broker                                100 VIFSX
-    Assets:Cash                              $-10000
-
-2015-01-01 Buy VTHRX
-    Assets:Broker                                 10 VTHRX
-    Assets:Cash                              $-10000
-
-2015-01-01 Buy VBMFX
-    Assets:Broker                                  1 VBMFX
-    Assets:Cash                              $-10000
-
- -

How do these work? First the ‘=’ sign at the beginning of the -line tells ledger this is an automatic transaction to be applied when -the condition following the ‘=’ is true. After the ‘=’ sign -is a value expression (see Value Expressions) that returns true -any time a posting contains the commodity of interest. -

-

The following line gives the proportions (not percentages) of each unit -of commodity that belongs to each asset class. Whenever Ledger sees a -buy or sell of a particular commodity it will credit or debit these -virtual accounts with that proportion of the number of shares moved. -

-

Now that Ledger understands how to distribute the commodities amongst -the various asset classes how do we get a report that tells us our -current allocation? Using the balance command and some tricky -formatting! -

-
-
ledger bal Allocation --current --format "\
-        %-17((depth_spacer)+(partial_account))\
-        %10(percent(market(display_total), market(parent.total)))\
-        %16(market(display_total))\n%/"
-
- -

Which yields: -

-
-
        Allocation                  100.00%                  $30000
-          Bonds/Cash                 39.90%                  $11970
-          Equities                   60.10%                  $18030
-            Domestic                 86.69%                  $15630
-            Global                   13.31%                   $2400
-
- -

Let’s look at the Ledger invocation a bit closer. The command above is -split into lines for clarity. The first line is very vanilla Ledger -asking for the current balances of the account in the “Allocation” -tree, using a special formatter. -

- - - -

The magic is in the formatter. The second line simply tells Ledger to -print the partial account name indented by its depth in the tree. The -third line is where we calculate and display the percentages. The -display_total command gives the values of the total calculated -for the account in this line. The parent.total command gives -the total for the next level up in the tree. percent formats -their ratio as a percentage. The fourth line tells ledger to display -the current market value of the line. The last two characters -‘%/’ tell Ledger what to do for the last line, in this case, -nothing. -

-
- -
-

-Previous: , Up: Advanced Reports   [Contents][Index]

-
- -

6.4.2 Visualizing with Gnuplot

- - - - - - - -

If you have the “Gnuplot” program installed, you can graph any of the -above register reports. The script to do this is included in the ledger -distribution, and is named contrib/report. Install report -anywhere along your PATH, and then use report instead of -ledger when doing a register report. The only thing to keep in -mind is that you must specify --amount-data (-j) or ---total-data (-J) to indicate whether “Gnuplot” should plot -the amount, or the running total. For example, this command plots total -monthly expenses made on your MasterCard. -

-
-
$ report -j -M -r --display "account =~ /mastercard/" reg ^expenses
-
- -

The report script is a very simple Bourne shell script, that -passes a set of scripted commands to “Gnuplot”. Feel free to modify -the script to your liking, since you may prefer histograms to line -plots, for example. -

-

Here are some useful plots: -

-
-
report -j -M reg ^expenses         # monthly expenses
-report -J reg checking             # checking account balance
-report -J reg ^income ^expenses    # cash flow report
-
-# net worth report, ignoring non-$ postings
-
-report -J -l "Ua>={\$0.01}" reg ^assets ^liab
-
-# net worth report starting last February. the use of a display
-# predicate (-d) is needed, otherwise the balance will start at
-# zero, and thus the y-axis will not reflect the true balance
-
-report -J -l "Ua>={\$0.01}" -d "d>=[last feb]" reg ^assets ^liab
-
- -

The last report uses both a calculation predicate --limit -EXPR (-l) and a display predicate --display EXPR -(-d). The calculation predicate limits the report to postings whose -amount is greater than or equal to $1 (which can only happen if the -posting amount is in dollars). The display predicate limits the -transactions displayed to just those since last February, even -though those transactions from before will be computed as part of the -balance. -

-
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

7 Reporting Commands

- - - - - - - -
- - - -

7.1 Primary Financial Reports

- - - - - - - - -
- - - -

7.1.1 The balance command

- - -

The balance command reports the current balance of all -accounts. It accepts a list of optional regexes, which confine the -balance report to the matching accounts. If an account contains -multiple types of commodities, each commodity’s total is reported -separately. -

-
- - - -

7.1.2 The equity command

- - -

The equity command prints out account balances as if they -were transactions. This makes it easy to establish the starting -balances for an account, such as when Archiving Previous Years. -

-
- - - -

7.1.3 The register command

- - - - -

The register command displays all the postings occurring in -a single account, line by line. The account regex must be specified as -the only argument to this command. If any regexes occur after the -required account name, the register will contain only those postings -that match, which makes it very useful for hunting down a particular -posting. -

-

The output from register is very close to what a typical -checkbook, or single-account ledger, would look like. It also shows a -running balance. The final running balance of any register should -always be the same as the current balance of that account. -

-

If you have “Gnuplot” installed, you may plot the amount or running -total of any register by using the script report, which is -included in the Ledger distribution. The only requirement is that you -add either --amount-data (-j) or --total-data (-J) to -your register command, in order to plot either the amount or -total column, respectively. -

-
- - - -

7.1.4 The print command

- - -

The print command prints out ledger transactions in a textual -format that can be parsed by Ledger. They will be properly formatted, -and output in the most economic form possible. The print -command also takes a list of optional regexes, which will cause only -those postings which match in some way to be printed. -

-

The print command can be a handy way to clean up a ledger -file whose formatting has gotten out of hand. -

-
- - - -

7.2 Reports in other Formats

- - - - - - - - - - - -
- - - -

7.2.1 Comma Separated Values files

- - - - - - -
- - - -

7.2.1.1 The csv command

- - -

The csv command prints the desired ledger -transactions in a csv format suitable for importing into other programs. -You can specify the transactions to print using all the normal -limiting and searching functions. -

-
- - - -

7.2.1.2 The convert command

- - - - - -

The convert command parses a comma separated value (csv) file -and prints Ledger transactions. Many banks offer csv file downloads. -Unfortunately, the file formats, aside from the commas, are all -different. The ledger convert command tries to help as much -as it can. -

-

Your bank’s csv files will have fields in different orders from other -banks, so there must be a way to tell Ledger what to expect. Insert -a line at the beginning of the csv file that describes the fields to -Ledger. -

-

For example, this is a portion of a csv file downloaded from a credit -union in the United States: -

-
-
Account Name: VALUFIRST CHECKING
-Account Number: 71
-Date Range: 11/13/2011 - 12/13/2011
-
-Transaction Number,Date,Description,Memo,Amount Debit,Amount Credit,Balance,Check Number,Fees
-767718,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-8.80,,00001640.04,,
-767406,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-1.03,,00001648.84,,
-683342,12/13/2011,"Visa Checking","NetFlix Date 12/12/11 000326585896 5968",-21.85,,00001649.87,,
-639668,12/13/2011,"Withdrawal","ID: 1741472662 CO: XXAA.COM PAYMNT",-236.65,,00001671.72,,
-1113648,12/12/2011,"Withdrawal","Tuscan IT #00037657",-29.73,,00001908.37,,
-
- -

Unfortunately, as it stands Ledger cannot read it, but you can. Ledger -expects the first line to contain a description of the fields on each -line of the file. The fields ledger can recognize contain these -case-insensitive strings date, posted, code, -payee or desc or description, amount, -cost, total, and note. -

-

Delete the account description lines at the top, and replace the first -line in the data above with: -

-
-
,date,payee,note,amount,,,code,
-
- -

Then execute ledger like this: -

-
-
$ ledger convert download.csv --input-date-format "%m/%d/%Y"
-
- -

Where the --input-date-format DATE_FORMAT option tells -ledger how to interpret the dates. -

-

Importing csv files is a lot of work, but is very amenable to -scripting. -

-

If there are columns in the bank data you would like to keep in your -ledger data, besides the primary fields described above, you can name -them in the field descriptor list and Ledger will include them in the -transaction as meta data if it doesn’t recognize the field name. For -example, if you want to capture the bank transaction number and it -occurs in the first column of the data use: -

-
-
transid,date,payee,note,amount,,,code,
-
- -

Ledger will include ‘; transid: 767718’ in the first transaction -from the file above. -

- - - - - -

The convert command accepts four options. They are ---invert which inverts the amount field, --auto-match -which automatically matches an account from the Ledger journal for every -CSV line, --account STR which you can use to specify the -account to balance against, and --rich-data which stores -additional tag/value pairs. -

-

Using the two first lines of the above csv file, -

-
-
,date,payee,note,amount,,,code,
-767718,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-8.80,,00001640.04,,
-767406,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-1.03,,00001648.84,,
-
- -

and launching the below command, -

-
-
$ ledger convert download.csv --input-date-format "%m/%d/%Y" \
-  --invert --account Assets:MyBank --rich-data \
-  --file sample.dat --now=2012/01/13
-
- -

you will get the result: -

-
-
2011/12/13 * Withdrawal  ;ACE HARDWARE 16335 S HOUGHTON RD
-    ; CSV: 767718,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-8.80,,00001640.04,,
-    ; Imported: 2012/01/13
-    ; UUID: dfdc3c3d5c54c6967dd39d5b4e4fd1ea76e87233
-    Expenses:Unknown                             8.8
-    Assets:MyBank
-
-2011/12/13 * Withdrawal  ;ACE HARDWARE 16335 S HOUGHTON RD
-    ; CSV: 767406,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-1.03,,00001648.84,,
-    ; Imported: 2012/01/13
-    ; UUID: 63086448b1f29f7fd6efb11ea40660185a213f9d
-    Expenses:Unknown                            1.03
-    Assets:MyBank
-
- -

The three added metadata are: ‘CSV’ as the original line from csv -file, ‘Imported’ as the date when the csv file was imported into -Ledger, and ‘UUID’ as a checksum of original csv line. -

-

If an entry with the same ‘UUID’ tag is already included in the -normal ledger file (specified via --file FILE (-f) or via -the environment variable LEDGER_FILE) this entry will not be -printed again. -

-

In the output above, the account is ‘Expenses:Unknown’ for CSV -lines. You can use the --auto-match option to automatically -match an account from your Ledger journal. -

-

You can also use convert with payee and account -directives. First, you can use the payee and alias -directive to rewrite the payee field based on some rules. Then -you can use the account and its payee directive to specify the -account. I use it like this, for example: -

-
-
payee Aldi
-    alias ^ALDI SUED SAGT DANKE
-account Aufwand:Einkauf:Lebensmittel
-    payee ^(Aldi|Alnatura|Kaufland|REWE)$
-
- -

Note that it may be necessary for the output of ‘ledger convert’ -to be passed through ledger print a second time if you want to -match on the new payee field. During the ledger convert run, -only the original payee name as specified in the csv data seems to be -used. -

-
- - - -

7.2.2 The lisp command

- - - -

The lisp command prints results in a form that can be read -directly by Emacs Lisp. The format of the sexp is: -

-
-
((BEG-POS CLEARED DATE CODE PAYEE
-  (ACCOUNT AMOUNT)...)  ; list of postings
- ...)                   ; list of transactions
-
- -

emacs can also be used as a synonym for lisp. -

-
- - - -

7.2.3 Emacs org Mode

- - -

Org mode has a sub-system known as Babel which allows for literate -programming. This allows you to mix text and code within the same -document and automatically execute code which may generate results -which will then appear in the text. -

-

One of the languages supported by Babel is Ledger, so that you can have -ledger commands embedded in a text file and have the output of ledger -commands also appear in the text file. The output can be updated -whenever any new ledger entries are added. -

-

For instance, the following Org mode text document snippet illustrates -a very naive but still useful application of the Babel system: -

-
-
* A simple test of ledger in an org file
-The following are some entries and I have requested that ledger be run
-to generate a balance on the accounts.  I could have asked for
-a register or, in fact, anything at all the ledger can do through
-command-line options.
-
-#+begin_src ledger :cmdline bal :results value
-2010/01/01 * Starting balance
-  assets:bank:savings       £1300.00
-  income:starting balances
-2010/07/22 * Got paid
-  assets:bank:chequing      £1000.00
-  income:salary
-2010/07/23 Rent
-  expenses:rent              £500.00
-  assets:bank:chequing
-#+end_src
-
-#+results:
-:            £1800.00  assets:bank
-:             £500.00    chequing
-:            £1300.00    savings
-:             £500.00  expenses:rent
-:           £-2300.00  income
-:           £-1000.00    salary
-:           £-1300.00    starting balances
-
- -

Typing C-c C-c anywhere in the “ledger source code block” will -invoke ledger on the contents of that block and generate a “results” -block. The results block can appear anywhere in the file but, by -default, will appear immediately below the source code block. -

-

You can combine multiple source code blocks before executing ledger and -do all kinds of other wonderful things with Babel (and Org mode). -

-
- - - -

7.2.4 Org mode with Babel

- -

Using Babel, it is possible to record financial transactions -conveniently in an org file and subsequently generate the financial -reports required. -

-

As of Org mode 7.01, Ledger support is provided. Check the Babel -documentation on Worg for instructions on how to achieve this but -I currently do this directly as follows: -

-
-
(org-babel-do-load-languages
- 'org-babel-load-languages
- '((ledger . t)         ;this is the important one for this tutorial
-  ))
-
- -

Once Ledger support in Babel has been enabled, we can proceed to -include Ledger entries within an org file. There are three ways (at -least) in which these can be included: -

-
    -
  1. place all Ledger entries within one single source block and execute this -block with different arguments to generate the appropriate reports, - -
  2. place Ledger entries in more than one source block and use the -noweb literary programming approach, supported by Babel, to -combine these into one block elsewhere in the file for processing by -Ledger, - -
  3. place Ledger entries in different source blocks and use tangle to -generate a Ledger file which you can subsequently process using Ledger -directly. -
- -

The first two are described in more detail in this short tutorial. -

- - - - - - - - - - - -
- - - -

7.2.4.1 Embedded Ledger example with single source block

- -

The easiest, albeit possibly least useful, way in which to use Ledger -within an org file is to use a single source block to record all Ledger -entries. The following is an example source block: -

-
-
#+name: allinone
-#+begin_src ledger
-2010/01/01 * Starting balance
-  assets:bank:savings       £1300.00
-  income:starting balances
-2010/07/22 * Got paid
-  assets:bank:chequing      £1000.00
-  income:salary
-2010/07/23 Rent
-  expenses:rent              £500.00
-  assets:bank:chequing
-2010/07/24 Food
-  expenses:food              £150.00
-  assets:bank:chequing
-2010/07/31 * Interest on bank savings
-  assets:bank:savings          £3.53
-  income:interest
-2010/07/31 * Transfer savings
-  assets:bank:savings        £250.00
-  assets:bank:chequing
-2010/08/01 got paid again
-  assets:bank:chequing      £1000.00
-  income:salary
-#+end_src
-
- -

In this example, we have combined both expenses and income into one set -of Ledger entries. We can now generate register and balance reports (as -well as many other types of reports) using Babel to invoke Ledger with -specific arguments. The arguments are passed to Ledger using the -:cmdline header argument. In the code block above, there is no -such argument so the system takes the default. For Ledger code blocks, -the default :cmdline argument is bal and the result of -evaluating this code block (C-c C-c) would be: -

-
-
#+results: allinone()
-:            £2653.53  assets:bank
-:            £1100.00    chequing
-:            £1553.53    savings
-:             £650.00  expenses
-:             £150.00    food
-:             £500.00    rent
-:           £-3303.53  income
-:              £-3.53    interest
-:           £-2000.00    salary
-:           £-1300.00    starting balances
-
- -

If, instead, you wished to generate a register of all the transactions, -you would change the #+begin_src line for the code block to -include the required command-line option: -

-
-
#+begin_src ledger :cmdline reg
-
- -

Evaluating the code block again would generate a different report. -

-

Having to change the actual directive on the code block and re-evaluate -makes it difficult to have more than one view of your transactions and -financial state. Eventually, Babel will support passing arguments to -#+call evaluations of code blocks but this support is missing -currently. Instead, we can use the concepts of literary programming, as -implemented by the noweb features of Babel, to help us. -

-
- - - -

7.2.4.2 Multiple Ledger source blocks with noweb

- -

The noweb feature of Babel allows us to expand references to -other code blocks within a code block. For Ledger, this can be used to -group transactions according to type, say, and then bring various sets -of transactions together to generate reports. -

-

Using the same transactions used above, we could consider splitting -these into expenses and income, as follows: -

-
- - - -

7.2.4.3 Income Entries

- -

The first set of entries relates to income, either monthly pay or -interest, all typically going into one of my bank accounts. Here, I have -placed several entries, but we could have had each entry in a separate -src block. Note that all code blocks you wish to refer to later -must have the :noweb yes header argument specified. -

-
-
#+name: income
-#+begin_src ledger :noweb yes
-2010/01/01 * Starting balance
-  assets:bank:savings       £1300.00
-  income:starting balances
-2010/07/22 * Got paid
-  assets:bank:chequing      £1000.00
-  income:salary
-2010/07/31 * Interest on bank savings
-  assets:bank:savings          £3.53
-  income:interest
-2010/07/31 * Transfer savings
-  assets:bank:savings        £250.00
-  assets:bank:chequing
-2010/08/01 got paid again
-  assets:bank:chequing      £1000.00
-  income:salary
-#+end_src
-
- -
- - - -

7.2.4.4 Expenses

- -

The following entries relate to personal expenses, such as rent and -food. Again, these have all been placed in a single src block but -could have been done individually. -

-
-
#+name: expenses
-#+begin_src ledger :noweb yes
-2010/07/23 Rent
-  expenses:rent              £500.00
-  assets:bank:chequing
-2010/07/24 Food
-  expenses:food              £150.00
-  assets:bank:chequing
-#+end_src
-
- -
- - - -

7.2.4.5 Financial Summaries

- -

Given the ledger entries defined above in the income and expenses code -blocks, we can now refer to these using the noweb expansion directives, -<<name>>. We can now define different code blocks to generate -specific reports for those transactions. Below are two examples, one to -generate a balance report and one to generate a register report of all -transactions. -

-
- - - -

7.2.4.6 An overall balance summary

- - -

The overall balance of your account and expenditure with a breakdown -according to category is specified by passing the :cmdline bal -argument to Ledger. This code block can now be evaluated (C-c C-c) -and the results generated by incorporating the transactions referred to -by the <<income>> and <<expenses>> lines. -

-
-
#+name: balance
-#+begin_src ledger :cmdline bal :noweb yes
-<<income>>
-<<expenses>>
-#+end_src
-
-#+results: balance
-:            £2653.53  assets:bank
-:            £1100.00    chequing
-:            £1553.53    savings
-:             £650.00  expenses
-:             £150.00    food
-:             £500.00    rent
-:           £-3303.53  income
-:              £-3.53    interest
-:           £-2000.00    salary
-:           £-1300.00    starting balances
-
- -

If you want a less detailed breakdown of where your money is, you can -specify the --collapse (-n) flag (i.e. ‘:cmdline -n bal’) -to tell Ledger to exclude sub-accounts in the report. -

-
-
#+begin_src ledger :cmdline -n bal :noweb yes
-<<income>>
-<<expenses>>
-#+end_src
-
-#+results:
-:            £2653.53  assets
-:             £650.00  expenses
-:           £-3303.53  income
-
- -
- - - -

7.2.4.7 Generating a monthly register

- - - -

You can also generate a monthly register (the reg command) by -executing the following src block. This presents a summary of -transactions for each monthly period (the --monthly (-M) -argument) with a running total in the final column (which should be 0 at -the end if all the entries are correct). -

-
-
#+name: monthlyregister
-#+begin_src ledger :cmdline -M reg :noweb yes
-<<income>>
-<<expenses>>
-#+end_src
-
-#+results: monthlyregister
-:2010/01/01 - 2010/01/31         assets:bank:savings       £1300.00    £1300.00
-:                                in:starting balances     £-1300.00           0
-:2010/07/01 - 2010/07/31         assets:bank:chequing       £100.00     £100.00
-:                                assets:bank:savings        £253.53     £353.53
-:                                expenses:food              £150.00     £503.53
-:                                expenses:rent              £500.00    £1003.53
-:                                income:interest             £-3.53    £1000.00
-:                                income:salary            £-1000.00           0
-:2010/08/01 - 2010/08/01         assets:bank:chequing      £1000.00    £1000.00
-:                                income:salary            £-1000.00           0
-
- -

We could also generate a monthly report on our assets showing how these -are increasing (or decreasing!). In this case, the final column will be -the running total of the assets in our ledger. -

-
-
#+name: monthlyassetsregister
-#+begin_src ledger :cmdline -M reg assets :noweb yes
-<<income>>
-<<expenses>>
-#+end_src
-
-#+results: monthlyassetsregister
-: 2010/01/01 - 2010/01/31         assets:bank:savings       £1300.00    £1300.00
-: 2010/07/01 - 2010/07/31         assets:bank:chequing       £100.00    £1400.00
-:                                 assets:bank:savings        £253.53    £1653.53
-: 2010/08/01 - 2010/08/01         assets:bank:chequing      £1000.00    £2653.53
-
- -
- - - -

7.2.4.8 Summary

- -

This short tutorial shows how Ledger entries can be embedded in an org -file and manipulated using Babel. However, only simple Ledger features -have been illustrated; please refer to the Ledger documentation for -examples of more complex operations on a ledger. -

-
- - - -

7.2.5 The pricemap command

- - -

If you have the graphviz graph visualization package installed, -ledger can generate a graph of the relationship between your various -commodities. The output file is in the “dot” format. -

-

This is probably not very interesting, unless you have many different -commodities valued in terms of each other. For example, multiple -currencies and multiple investments valued in those currencies. -

-
- - - -

7.2.6 The xml command

- - -

By default, Ledger uses a human-readable data format, and displays its -reports in a manner meant to be read on screen. For the purpose of -writing tools which use Ledger, however, it is possible to read and -display data using XML. This section documents that format. -

-

The general format used for Ledger data is: -

-
-
<?xml version="1.0"?>
-<ledger>
-  <xact>...</xact>
-  <xact>...</xact>
-  <xact>...</xact>...
-</ledger>
-
- -

The data stream is enclosed in a ledger tag, which contains a -series of one or more transactions. Each xact describes one -transaction and contains a series of one or more postings: -

-
-
<xact>
-  <en:date>2004/03/01</en:date>
-  <en:cleared/>
-  <en:code>100</en:code>
-  <en:payee>John Wiegley</en:payee>
-  <en:postings>
-    <posting>...</posting>
-    <posting>...</posting>
-    <posting>...</posting>...
-  </en:postings>
-</xact>
-
- -

The date format for en:date is always YYYY/MM/DD. The -en:cleared tag is optional, and indicates whether the posting has -been cleared or not. There is also an en:pending tag, for -marking pending postings. The en:code and en:payee tags -both contain whatever text the user wishes. -

-

After the initial transaction data, there must follow a set of postings -marked with en:postings. Typically these postings will all -balance each other, but if not they will be automatically balanced into -an account named ‘Unknown’. -

-

Within the en:postings tag is a series of one or more -posting’s, which have the following form: -

-
-
<posting>
-  <tr:account>Expenses:Computer:Hardware</tr:account>
-  <tr:amount>
-    <value type="amount">
-      <amount>
-        <commodity flags="PT">$</commodity>
-        <quantity>90.00</quantity>
-      </amount>
-    </value>
-  </tr:amount>
-</posting>
-
- -

This is a basic posting. It may also begin with -tr:virtual and/or tr:generated tags, to indicate virtual -and auto-generated postings. Then follows the tr:account -tag, which contains the full name of the account the posting is -related to. Colons separate parent from child in an account name. -

-

Lastly follows the amount of the posting, indicated by -tr:amount. Within this tag is a value tag, of which -there are four different kinds, each with its own format: -

-
    -
  1. Boolean, -
  2. integer, -
  3. amount, -
  4. balance. -
- -

The format of a Boolean value is true or false -surrounded by a boolean tag, for example: -

-
-
<boolean>true</boolean>
-
- -

The format of an integer value is the numerical value surrounded by an -integer tag, for example: -

-
-
<integer>12036</integer>
-
- -

The format of an amount contains two members, the commodity and the -quantity. The commodity can have a set of flags that indicate how to -display it. The meaning of the flags (all of which are optional) are: -

-
-
P
-

The commodity is prefixed to the value. -

-
-
S
-

The commodity is separated from the value by a space. -

-
-
T
-

Thousands markers are used to display the amount. -

-
-
E
-

The format of the amount is European, with period used as a thousands -marker, and comma used as the decimal point. -

-
-
- -

The actual quantity for an amount is an integer of arbitrary size. -Ledger uses the GNU multiple precision arithmetic library to handle -such values. The XML format assumes the reader to be equally capable. -Here is an example amount: -

-
-
<value type="amount">
-  <amount>
-    <commodity flags="PT">$</commodity>
-    <quantity>90.00</quantity>
-  </amount>
-</value>
-
- -

Lastly, a balance value contains a series of amounts, each with a -different commodity. Unlike the name, such a value does need to -balance. It is called a balance because it sums several amounts. For -example: -

-
-
<value type="balance">
-  <balance>
-    <amount>
-      <commodity flags="PT">$</commodity>
-      <quantity>90.00</quantity>
-    </amount>
-    <amount>
-      <commodity flags="TE">DM</commodity>
-      <quantity>200.00</quantity>
-    </amount>
-  </balance>
-</value>
-
- -

That is the extent of the XML data format used by Ledger. It will -output such data if the xml command is used, and can read -the same data. -

-
- - - -

7.2.7 prices and pricedb commands

- - - - -

The prices command displays the price history for matching -commodities. The --average (-A) option is useful with this -report, to display the running average price, or --deviation -(-D) to show each price’s deviation from that average. -

-

There is also a pricedb command which outputs the same -information as prices, but does so in a format that can be -parsed by Ledger. This is useful for generating and tidying up -pricedb database files. -

-
- - - -

7.3 Reports about your Journals

- - - - - - - - - - - - -
- - - -

7.3.1 accounts

- - -

The accounts command reports all of the accounts in the -journal. Following the command with a regular expression will limit the -output to accounts matching the regex. The output is sorted by name. -Using the --count option will tell you how many entries use -each account. -

-
- - - -

7.3.2 payees

- - -

The payees command reports all of the unique payees in the -journal. Using the --count option will tell you how many -entries use each payee. To filter the payees displayed you must use the -prefix @: -

-
-
$ ledger payees @Nic
-
-
-
Nicolas
-Nicolas BOILABUS
-Oudtshoorn Municipality
-Vaca Veronica
-
- -
- -
-

-Next: , Previous: , Up: Reports about your Journals   [Contents][Index]

-
- -

7.3.3 commodities

- - -

Report all commodities present in the journals under consideration. The -output is sorted by name. Using the --count option will tell -you how many entries use each commodity. -

-
- -
-

-Next: , Previous: , Up: Reports about your Journals   [Contents][Index]

-
- -

7.3.4 tags

- - - -

The tags command reports all of the tags in the journal. The -output is sorted by name. Using the --count option will tell -you how many entries use each tag. Using the --values option -will report the values used by each tag. -

-
- -
-

-Next: , Previous: , Up: Reports about your Journals   [Contents][Index]

-
- -

7.3.5 xact

- - - - -

The xact command simplifies the creation of new transactions. -It works on the principle that 80% of all postings are variants of -earlier postings. Here’s how it works: -

-

Say you currently have this posting in your ledger file: -

-
-
2004/03/15 * Viva Italiano
-    Expenses:Food                       $12.45
-    Expenses:Tips                        $2.55
-    Liabilities:MasterCard             $-15.00
-
- -

Now it’s ‘2004/4/9’, and you’ve just eaten at ‘Viva Italiano’ -again. The exact amounts are different, but the overall form is the -same. With the xact command you can type: -

-
-
$ ledger xact 2004/4/9 viva food 11 tips 2.50
-
- -

This produces the following output: -

-
-
2004/04/09 Viva Italiano
-    Expenses:Food                             $11.00
-    Expenses:Tips                              $2.50
-    Liabilities:MasterCard
-
- -

It works by finding a past posting matching the regular expression -‘viva’, and assuming that any accounts or amounts specified will be -similar to that earlier posting. If Ledger does not succeed in -generating a new transaction, an error is printed and the exit code is -set to ‘1’. -

-

Here are a few more examples of the xact command, assuming -the above journal transaction: -

-
-
$ ledger xact 4/9 viva 11.50
-$ ledger xact 4/9 viva 11.50 checking # (from `checking')
-$ ledger xact 4/9 viva food 11.50 tips 8
-$ ledger xact 4/9 viva food 11.50 tips 8 cash
-$ ledger xact 4/9 viva food $11.50 tips $8 cash
-$ ledger xact 4/9 viva dining "DM 11.50"
-
- -

draft and entry are both synonyms of -xact. entry is provided for backwards compatibility -with Ledger 2.X. -

-
- -
-

-Next: , Previous: , Up: Reports about your Journals   [Contents][Index]

-
- -

7.3.6 stats

- - - -

UNDOCUMENTED! Please help by contributing documentation for this feature. -

-
- -
-

-Previous: , Up: Reports about your Journals   [Contents][Index]

-
- -

7.3.7 select

- - -

UNDOCUMENTED! Please help by contributing documentation for this feature. -

-
- - - -

8 Command-Line Syntax

- - - - - - - - -
- - - -

8.1 Basic Usage

- -

This chapter describes Ledger’s features and options. You may wish to -survey this to get an overview before diving into the Ledger Tutorial and more detailed examples that follow. -

-

Ledger has a very simple command-line interface, named—enticingly -enough—ledger. It supports a few reporting commands, and -a large number of options for refining the output from those commands. -The basic syntax of any ledger command is: -

-
-
$ ledger [OPTIONS...] COMMAND [ARGS...]
-
- -

After the command word there may appear any number of arguments. For -most commands, these arguments are regular expressions that cause the -output to relate only to postings matching those regular expressions. -For the xact command, the arguments have a special meaning, -described below. -

-

The regular expressions arguments always match the account name that -a posting refers to. To match on the payee of the transaction -instead, precede the regular expression with ‘payee’ or -‘@’. For example, the following balance command reports account -totals for rent, food and movies, but only those whose payee matches -Freddie: -

-
-
$ ledger bal rent food movies payee freddie
-
- -

or -

-
-
$ ledger bal rent food movies @freddie
-
- -

There are many, many command options available with the ledger -program, and it takes a while to master them. However, none of them are -required to use the basic reporting commands. -

-
- - - -

8.2 Command-Line Quick Reference

- - - - - - - - - - - -
- - - -

8.2.1 Basic Reporting Commands

- -
-
balance - -
-
bal - -
-

Show account balances. -

-
-
register - -
-
reg - -
-

Show all transactions with running total. -

-
-
csv - -
-
-

Show transactions in csv format, for exporting to other programs. -

-
-
print - -
-

Print transactions in a format readable by ledger. -

-
-
xml - -
-

Produce XML output of the register command. -

-
-
lisp - -
-
emacs - -
-

Produce s-expression output, suitable for Emacs. -

-
-
equity - -
-

Print account balances as transactions. -

-
-
prices - -
-

Print price history for matching commodities. -

-
-
pricedb - -
-

Print price history for matching commodities in a format readable by -ledger. -

-
-
xact - -
-

Generate transactions based on previous postings. -

-
-
- -
- - - -

8.2.2 Basic Options

- -
-
--help - -
-
-h - -
-

Display the man page for ledger. -

-
-
--version - -
-

Print version information and exit. -

-
-
--file FILE - -
-
-f FILE - -
-

Read FILE as a ledger file. -

-
-
--output FILE - -
-
-o FILE - -
-

Redirect output to FILE. -

-
-
--init-file FILE - -
-
-i FILE - -
-

Specify an options file. -

-
-
--import FILE - -
-

Import FILE as Python module. -

-
-
--account STR - -
-
-a STR - -
-

Specify default account STR for QIF file postings. -

-
-
- -
- - - -

8.2.3 Report Filtering

- -
-
--current - -
-
-c - -
-

Display only transactions on or before the current date. -

-
-
--begin DATE - -
-
-b DATE - -
-

Limit the processing to transactions on or after DATE. -

-
-
--end DATE - -
-
-e DATE - -
-

Limit the processing to transactions before DATE. -

-
-
--period PERIOD_EXPRESSION - -
-
-p PERIOD_EXPRESSION - -
-

Limit the processing to transactions in PERIOD_EXPRESSION. -

-
-
--period-sort VEXPR - -
-

Sort postings within each period according to VEXPR. -

-
-
--cleared - -
-
-C - -
-

Display only cleared postings. -

-
-
--dc - -
-

Display register or balance in debit/credit format. -

-
-
--uncleared - -
-
-U - -
-

Display only uncleared postings. -

-
-
--real - -
-
-R - -
-

Display only real postings. -

-
-
--actual - -
-
-L - -
-

Display only actual postings, not automated ones. -

-
-
--related - -
-
-r - -
-

Display related postings. -

-
-
--budget - -
-

Display how close your postings meet your budget. -

-
-
--add-budget - -
-

Show unbudgeted postings. -

-
-
--unbudgeted - -
-

Show only unbudgeted postings. -

-
-
--forecast-while VEXPR - -
-
--forecast VEXPR - -
-

Project balances into the future. -

-
-
--limit EXPR - -
-
-l EXPR - -
-

Limit which postings are used in calculations by EXPR. -

-
-
--amount EXPR - -
-
-t EXPR - -
-

Change value expression reported in register report. -

-
-
--total VEXPR - -
-
-T VEXPR - -
-

Change the value expression used for “totals” column in -register and balance reports. -

-
-
- -
- - - -

8.2.4 Error Checking and Calculation Options

- -
-
--strict - -
-

Accounts, tags or commodities not previously declared will cause -warnings. -

-
-
--pedantic - -
-

Accounts, tags or commodities not previously declared will cause errors. -

-
-
--check-payees - -
-

Enable strict and pedantic checking for payees as well as accounts, -commodities and tags. This only works in conjunction with ---strict or --pedantic. -

-
-
--immediate - -
-

Instruct ledger to evaluate calculations immediately rather than lazily. -

-
-
- -
- - - -

8.2.5 Output Customization

- -
-
--collapse - -
-
-n - -
-

Collapse transactions with multiple postings. -

-
-
--subtotal - -
-
-s - -
-

Report register as a single subtotal. -

-
-
--by-payee - -
-
-P - -
-

Report subtotals by payee. -

-
-
--empty - -
-
-E - -
-

Include empty accounts in the report. -

-
-
--weekly - -
-
-W - -
-

Report posting totals by week. -

-
-
--quarterly - -
-

Report posting totals by quarter. -

-
-
--yearly - -
-
-Y - -
-

Report posting totals by year. -

-
-
--dow - -
-

Report posting totals by day of week. -

-
-
--sort VEXPR - -
-
-S VEXPR - -
-

Sort a report using VEXPR. -

-
-
--wide - -
-
-w - -
-

Assume 132 columns instead of 80. -

-
-
--head INT - -
-

Report the first INT postings. -

-
-
--tail INT - -
-

Report the last INT postings. -

-
-
--pager FILE - -
-

Direct output to FILE pager program. -

-
-
--no-pager - -
-

Direct output to stdout, avoiding pager program. -

-
-
--average - -
-
-A - -
-

Report the average posting value. -

-
-
--deviation - -
-
-D - -
-

Report each posting’s deviation from the average. -

-
-
--percent - -
-
-% - -
-

Show subtotals in the balance report as percentages. -

-
-
--pivot TAG - -
-

Produce a pivot table of the TAG type specified. -

-
-
--amount-data - -
-
-j - -
-

Show only the date and value columns to format the output for plots. -

-
-
--plot-amount-format FORMAT_STRING - -
-

Specify the format for the plot output. -

-
-
--total-data - -
-
-J - -
-

Show only the date and total columns to format the output for plots. -

-
-
--plot-total-format FORMAT_STRING - -
-

Specify the format for the plot output. -

-
-
--display EXPR - -
-
-d EXPR - -
-

Display only postings that meet the criteria in the EXPR. -

-
-
--date-format DATE_FORMAT - -
-
-y DATE_FORMAT - -
-

Change the basic date format used in reports. -

-
-
--format FORMAT_STRING - -
-
--balance-format FORMAT_STRING - -
-
--register-format FORMAT_STRING - -
-
--prices-format FORMAT_STRING - -
-
-F FORMAT_STRING - -
-

Set the reporting format for various reports. -

-
-
--anon - -
-

Print the ledger register with anonymized accounts and payees, useful -for filing bug reports. -

-
-
- -
- - - -

8.2.6 Grouping Options

- -
-
--by-payee - -
-
-P - -
-

Group postings by common payee names. -

-
-
--daily - -
-
-D - -
-

Group postings by day. -

-
-
--weekly - -
-
-W - -
-

Group postings by week. -

-
-
--monthly - -
-
-M - -
-

Group postings by month. -

-
-
--quarterly - -
-

Group postings by quarter. -

-
-
--yearly - -
-
-Y - -
-

Group postings by year. -

-
-
--dow - -
-

Group by day of weeks. -

-
-
--subtotal - -
-
-s - -
-

Group postings together, similar to the balance report. -

-
-
- -
- - - -

8.2.7 Commodity Reporting

- -
-
--price-db FILE - -
-

Use FILE for retrieving stored commodity prices. -

-
-
--price-exp INT - -
-
--leeway INT - -
-
-Z INT - -
-

Set expected freshness of prices in INT minutes. -

-
-
--download - -
-
-Q - -
-

Download quotes using the script named getquote. -

- -
-
--quantity - -
-
-O - -
-

Report commodity totals without conversion. -

-
-
--basis - -
-
-B - -
-

Report cost basis. -

-
-
--market - -
-
-V - -
-

Report last known market value. -

-
-
--gain - -
-
-G - -
-

Report net gain or loss for commodities that have a price history. -

-
-
- -
- - - -

8.3 Detailed Option Description

- - - - - - - - - - - - -
- - - -

8.3.1 Global Options

- -

Options for Ledger reports affect three separate scopes of operation: -Global, Session, and Report. In practice there is very little -difference between these scopes. Ledger 3.0 contains provisions for -GUIs, which would make use of the different scopes by keeping an -instance of Ledger running in the background and running multiple -sessions with multiple reports per session. -

-
-
--args-only - -
-

Ignore all environment and init-file settings and -use only command-line arguments to control Ledger. Useful for debugging -or testing small journal files not associated with your main financial -database. -

-
-
--debug CODE - -
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -If ledger has been built with debug options this will provide extra data during -the run. -

-
-
--help - -
-
-h - -
-

Display the man page for ledger. -

-
-
--init-file FILE - -
-

Specify the location of the init file. The default is home directory -~/.ledgerrc, or current directory ./.ledgerrc if not found -in home directory. -

-
-
--options - -
-

Display the options in effect for this Ledger invocation, along with -their values and the source of those values, for example: -

-
-
$ ledger --options bal --cleared
-
- -
-
===============================================================================
-[Global scope options]
-             --args-only                                             --args-only
-
-[Session scope options]
-                  --file = A9349E4.dat                               --file
-
-[Report scope options]
-               --cleared                                             --cleared
-               --columns = 80                                        --columns
-                 --limit = cleared                                   --cleared
-===============================================================================
-              $15.00  Expenses
-              $12.45    Food
-               $2.55    Tips
-             $-15.00  Liabilities:MasterCard
---------------------
-                   0
-
- -

For the source column, a value starting with a ‘-’ or ‘--’ -indicated the source was a command-line argument. If the entry starts -with a ‘$’, the source was an environment variable. If the source -is ?normalize the value was set internally by ledger, in -a function called normalize_options. -

-
-
--script FILE - -
-

Execute a ledger script. -

-
-
--trace INT - -
-

Enable tracing. The INT specifies the level of trace desired. -

-
-
--verbose - -
-
-v - -
-

Print detailed information on the execution of Ledger. -

-
-
--verify - -
-

Enable additional assertions during run-time. This causes a significant -slowdown. When combined with --debug CODE ledger will -produce memory trace information. -

-
-
--verify-memory - -
-

Verify that every constructed object is properly destructed. This is for -debugging purposes only. -

-
-
--version - -
-

Print version information and exit. -

-
-
- -
- - - -

8.3.2 Session Options

- -

Options for Ledger reports affect three separate scopes of operation: -Global, Session, and Report. In practice there is very little -difference between these scopes. Ledger 3.0 contains provisions for -GUIs, which would make use of the different scopes by keeping an -instance of Ledger running in the background and running multiple -sessions with multiple reports per session. -

-
-
--check-payees - -
-

Enable strict and pedantic checking for payees as well as accounts, -commodities and tags. This only works in conjunction with ---strict or --pedantic. -

-
-
--day-break - -
-

Break up register report of timelog entries that span multiple -days by day. -

-
-
--decimal-comma - -
-

Direct Ledger to parse journals using the European standard comma as -a decimal separator, not the usual period. -

-
-
--download - -
-
-Q - -
-

Direct Ledger to download prices. -

-
-
--explicit - -
-

Direct Ledger to require pre-declarations for entities (such as accounts, -commodities and tags) rather than taking entities from cleared -transactions as defined. This option is useful in combination with ---strict or --pedantic. -

-
-
--file FILE - -
-
-f FILE - -
-

Specify the input FILE for this invocation. -

- -
-
--input-date-format DATE_FORMAT - -
-

Specify the input date format for journal entries. For example, -

-
-
$ ledger convert Export.csv --input-date-format "%m/%d/%Y"
-
- -

Would convert the Export.csv file to ledger format, assuming -the dates in the CSV file are like 12/23/2009 (see Date and Time Format Codes). -

-
-
--master-account STR - -
-

Prepend all account names with the argument. -

-
-
$ ledger -f drewr3.dat bal --no-total --master-account HUMBUG
-
- -
-
                   0  HUMBUG
-         $ -3,804.00    Assets
-          $ 1,396.00      Checking
-             $ 30.00        Business
-         $ -5,200.00      Savings
-         $ -1,000.00    Equity:Opening Balances
-          $ 6,654.00    Expenses
-          $ 5,500.00      Auto
-             $ 20.00      Books
-            $ 300.00      Escrow
-            $ 334.00      Food:Groceries
-            $ 500.00      Interest:Mortgage
-         $ -2,030.00    Income
-         $ -2,000.00      Salary
-            $ -30.00      Sales
-            $ 180.00    Liabilities
-            $ -20.00      MasterCard
-            $ 200.00      Mortgage:Principal
-
- -
-
--no-aliases - -
-

Ledger does not expand any aliases if this option is specified. -

-
-
--pedantic - -
-

Accounts, tags or commodities not previously declared will cause errors. -

-
-
--permissive - -
-

Quiet balance assertions. -

-
-
--price-db FILE - -
-

Specify the location of the price entry data file. -

-
-
--price-exp INT - -
-
--leeway INT - -
-
-Z INT - -
-

Set the expected freshness of price quotes, in INT minutes. That -is, if the last known quote for any commodity is older than this value, -and if --download is being used, then the Internet will be -consulted again for a newer price. Otherwise, the old price is still -considered to be fresh enough. -

-
-
--strict - -
-

Ledger normally silently accepts any account or commodity in a posting, -even if you have misspelled a commonly used one. The option ---strict changes that behavior. While running with ---strict, Ledger interprets all cleared transactions as -correct, and if it encounters a new account or commodity (same as -a misspelled commodity or account) it will issue a warning giving you -the file and line number of the problem. -

-
-
--recursive-aliases - -
-

Normally, ledger only expands aliases once. With this option, ledger -tries to expand the result of alias expansion recursively, until no more -expansions apply. -

-
-
--time-colon - -
-

The --time-colon option will display the value for a seconds -based commodity as real hours and minutes. -

-

For example 8100 seconds by default will be displayed as 2.25 whereas -with the --time-colon option they will be displayed as 2:15. -

-
-
--value-expr VEXPR - -
-

Set a global value expression annotation. -

-
-
- -
- - - -

8.3.3 Report Options

- -

Options for Ledger reports affect three separate scopes of operation: -Global, Session, and Report. In practice there is very little -difference between these scopes. Ledger 3.0 contains provisions for -GUIs, which would make use of the different scopes by keeping an -instance of Ledger running in the background and running multiple -sessions with multiple reports per session. -

-
-
--abbrev-len INT - -
-

Set the minimum length an account can be abbreviated to if it doesn’t -fit inside the account-width. If INT is zero, then the -account name will be truncated on the right. If INT is greater -than account-width then the account will be truncated on the -left, with no shortening of the account names in order to fit into the -desired width. -

-
-
--account STR - -
-

Prepend STR to all accounts reported. That is, the option -‘--account Personal’ would tack ‘Personal:’ to the beginning -of every account reported in a balance report or register report. -

-
-
--account-width INT - -
-

Set the width of the account column in the register report -to INT characters. -

-
-
--actual - -
-
-L - -
-

Report only real transactions, ignoring all automated or virtual -transactions. -

-
-
--add-budget - -
-

Show only unbudgeted postings. -

-
-
--amount EXPR - -
-
-t EXPR - -
-

Apply the given value expression to the posting amount (see Value Expressions). Using --amount EXPR you can apply an -arbitrary transformation to the postings. -

-
-
--amount-data - -
-
-j - -
-

On a register report print only the date and amount of postings. -Useful for graphing and spreadsheet applications. -

-
-
--amount-width INT - -
-

Set the width in characters of the amount column in the -register report. -

-
-
--anon - -
-

Anonymize registry output, mostly for sending in bug reports. -

-
-
--auto-match - -
-

When generating a ledger transaction from a CSV file using the -convert command, automatically match an account from the -Ledger journal. -

-
-
--aux-date - -
-
--effective - -
-

Show auxiliary dates for all calculations (see Effective Dates). -

-
-
--average - -
-
-A - -
-

Print average values over the number of transactions instead of -running totals. -

-
-
--balance-format FORMAT_STRING - -
-

Specify the format to use for the balance report (see Format Strings). The default is: -

-
-
"%(justify(scrub(display_total), 20, -1, true, color))"
-"  %(!options.flat ? depth_spacer : \"\")"
-"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
-"%$1\n%/"
-"--------------------\n"
-
- -
-
--base - -
-

Reduce convertible commodities down the bottom of the conversion, e.g. -display time in seconds. This also applies to custom commodity -conversions (see Commodity equivalences). -

-
-
--basis - -
-
-B - -
-
--cost - -
-

Report the cost basis on all posting. -

-
-
--begin DATE - -
-

Specify the start DATE of all calculations. Transactions before -that date will be ignored. -

-
-
--bold-if VEXPR - -
-

Print the entire line in bold if the given value expression is true -(see Value Expressions). -

-
-
$ ledger reg Expenses --begin Dec --bold-if "amount>100"
-
- -

list all transactions since the beginning of December and print in -bold any posting greater than $100. -

-
-
--budget - -
-

Only display budgeted items. In a register report this -displays transactions in the budget, in a balance report this displays -accounts in the budget (see Budgeting and Forecasting). -

-
-
--budget-format FORMAT_STRING - -
-

Specify the format to use for the budget report (see Format Strings). The default is: -

-
-
"%(justify(scrub(get_at(display_total, 0)), 12, -1, true, color))"
-" %(justify(-scrub(get_at(display_total, 1)), 12, "
-"           12 + 1 + 12, true, color))"
-" %(justify(scrub(get_at(display_total, 1) + "
-"                 get_at(display_total, 0)), 12, "
-"           12 + 1 + 12 + 1 + 12, true, color))"
-" %(ansify_if("
-"   justify((get_at(display_total, 1) ? "
-"            (100% * quantity(scrub(get_at(display_total, 0)))) / "
-"             -quantity(scrub(get_at(display_total, 1))) : 0), "
-"           5, -1, true, false),"
-"   magenta if (color and get_at(display_total, 1) and "
-"               (abs(quantity(scrub(get_at(display_total, 0))) / "
-"                    quantity(scrub(get_at(display_total, 1)))) >= 1))))"
-"  %(!options.flat ? depth_spacer : \"\")"
-"%-(ansify_if(partial_account(options.flat), blue if color))\n"
-"%/%$1 %$2 %$3 %$4\n%/"
-"%(prepend_width ? \" \" * int(prepend_width) : \"\")"
-"------------ ------------ ------------ -----\n"
-
- -
-
--by-payee - -
-
-P - -
-

Group the register report by payee. -

-
-
--cleared - -
-
-C - -
-

Consider only transactions that have been cleared for display and -calculation. -

-
-
--cleared-format FORMAT_STRING - -
-

Specify the format to use for the cleared report (see Format Strings). The default is: -

-
-
"%(justify(scrub(get_at(total_expr, 0)), 16, 16 + prepend_width, "
-" true, color))  %(justify(scrub(get_at(total_expr, 1)), 18, "
-" 36 + prepend_width, true, color))"
-"    %(latest_cleared ? format_date(latest_cleared) : \"         \")"
-"    %(!options.flat ? depth_spacer : \"\")"
-"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
-"%$1  %$2    %$3\n%/"
-"%(prepend_width ? \" \" * prepend_width : \"\")"
-"----------------    ----------------    ---------\n"
-
- -
-
--collapse - -
-
-n - -
-

By default ledger prints all accounts in an account tree. With ---collapse it prints only the top level account specified. -

-
-
--collapse-if-zero - -
-

Collapse the account display only if it has a zero balance. -

-
-
--color - -
-
--ansi - -
-

Use color if the terminal supports it. -

-
-
--columns INT - -
-

Specify the width of the register report in characters. -

-
-
--count - -
-

Direct ledger to report the number of items when appended to the -commodities, accounts or payees command. -

-
-
--csv-format FORMAT_STRING - -
-

Specify the format to use for the csv report (see Format Strings). The default is: -

-
-
"%(quoted(date)),"
-"%(quoted(code)),"
-"%(quoted(payee)),"
-"%(quoted(display_account)),"
-"%(quoted(commodity(scrub(display_amount)))),"
-"%(quoted(quantity(scrub(display_amount)))),"
-"%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\"))),"
-"%(quoted(join(note | xact.note)))\n"
-
- -
-
--current - -
-

Shorthand for ‘--limit "date <= today"’. -

-
-
--daily - -
-
-D - -
-

Shorthand for ‘--period "daily"’. -

-
-
--date EXPR - -
-

Transform the date of the transaction using EXPR. -

-
-
--date-format DATE_FORMAT - -
-
-y DATE_FORMAT - -
-

Specify the format ledger should use to read and print dates -(see Date and Time Format Codes). -

-
-
--date-width INT - -
-

Specify the width, in characters, of the date column in the -register report. -

-
-
--datetime-format DATETIME_FORMAT - -
-

Specify the format ledger should use to print datetimes. -

-
-
--dc - -
-

Display register or balance in debit/credit format If you use ---dc with either the register (reg) or -balance (bal) commands, you will now get extra columns. -The register goes from this: -

-
-
12-Mar-10 Employer           Assets:Cash                $100        $100
-                             Income:Employer           $-100           0
-12-Mar-10 KFC                Expenses:Food               $20         $20
-                             Assets:Cash                $-20           0
-12-Mar-10 KFC - Rebate       Assets:Cash                  $5          $5
-                             Expenses:Food               $-5           0
-12-Mar-10 KFC - Food & Reb.. Expenses:Food               $20         $20
-                             Expenses:Food               $-5         $15
-                             Assets:Cash                $-15           0
-
- -

To this: -

-
-
12-Mar-10 Employer       Assets:Cash        $100           0        $100
-                         In:Employer           0        $100           0
-12-Mar-10 KFC            Expens:Food         $20           0         $20
-                         Assets:Cash           0         $20           0
-12-Mar-10 KFC - Rebate   Assets:Cash          $5           0          $5
-                         Expens:Food           0          $5           0
-12-Mar-10 KFC - Food &.. Expens:Food         $20           0         $20
-                         Expens:Food           0          $5         $15
-                         Assets:Cash           0         $15           0
-
- -

Where the first column is debits, the second is credits, and the third -is the running total. Only the running total may contain negative -values. -

-

For the balance report without --dc: -

-
-
                 $70  Assets:Cash
-                 $30  Expenses:Food
-               $-100  Income:Employer
---------------------
-                   0
-
- -

And with --dc it becomes this: -

-
-
          $105            $35            $70  Assets:Cash
-           $40            $10            $30  Expenses:Food
-             0           $100          $-100  Income:Employer
---------------------------------------------
-          $145           $145              0
-
- -
-
--depth INT - -
-

Limit the depth of the account tree. In a balance report, for example, -a ‘--depth 2’ statement will print balances only for accounts with -two levels, i.e. ‘Expenses:Entertainment’ but not -‘Expenses:Entertainment:Dining’. This is a display predicate, which -means it only affects display, not the total calculations. -

-
-
--deviation - -
-

Report each posting’s deviation from the average. It is only meaningful -in the register and prices reports. -

-
-
--display EXPR - -
-

Display only lines that satisfy the expression EXPR. -

-
-
--display-amount EXPR - -
-

Apply a transformation to the displayed amount. This happens -after calculations occur. -

-
-
--display-total EXPR - -
-

Apply a transformation to the displayed total. This happens after -calculations occur. -

-
-
--dow - -
-
--days-of-week - -
-

Group transactions by the day of the week. -

-
-
$ ledger reg Expenses --dow --collapse
-
- -

Will print all Expenses totaled for each day of the week. -

-
-
--empty - -
-
-E - -
-

Include empty accounts in the report and in average calculations. -

-
-
--end DATE - -
-

Specify the end DATE for a transaction to be considered in the -report. All transactions on or after this date are ignored. -

-
-
--equity - -
-

Related to the equity command (see The equity command). Gives current account balances in the form of a register -report. -

-
-
--exact - -
-

Report beginning and ending of periods by the date of the first and last -posting occurring in that period. -

-
-
--exchange COMMODITY - -
-
-X COMMODITY - -
-

Display values in terms of the given COMMODITY. The latest -available price is used. The syntax --X COMMODITY1:COMMODITY2 displays values in COMMODITY1 -in terms of COMMODITY2 using the latest available price, but -will not automatically covert any other commodities to -COMMODITY2. Multiple -X arguments may be used on a -single command-line (as in --X COMMODITY1:COMMODITY2 -X COMMODITY3:COMMODITY2), -which is particularly useful for situations where many prices are -available for reporting in terms of COMMODITY2, but only a few -should be displayed that way. -

-
-
--flat - -
-

Force the full names of accounts to be used in the balance report. The -balance report will not use an indented tree. -

-
-
--force-color - -
-

Output TTY color codes even if the TTY doesn’t support them. Useful -for TTYs that don’t advertise their capabilities correctly. -

-
-
--force-pager - -
-

Force Ledger to paginate its output. -

-
-
--forecast-while VEXPR - -
-
--forecast VEXPR - -
-

Continue forecasting while VEXPR is true. -

-
-
--forecast-years INT - -
-

Forecast at most INT years into the future. -

-
-
--format FORMAT_STRING - -
-
-F FORMAT_STRING - -
-

Use the given format string to print output. -

-
-
--gain - -
-
-G - -
-
--change - -
-

Report on gains using the latest available prices. -

-
-
--generated - -
-

Include auto-generated postings (such as those from automated -transactions) in the report, in cases where you normally wouldn’t want -them. -

-
-
--group-by EXPR - -
-

Group transactions together in the register report. -EXPR can be anything, although most common would be payee -or commodity. The tags() function is also useful here. -

-
-
--group-title-format FORMAT_STRING - -
-

Set the format for the headers that separates the report sections of -a grouped report. Only has an effect with a --group-by -EXPR register report. -

-
-
$ ledger reg Expenses --group-by "payee" --group-title-format "------------------------ %-20(value) ---------------------\n"
-
-
-
------------------------ 7-Eleven             ---------------------
-2011/08/13 7-Eleven              Expenses:Auto:Misc          $ 5.80       $ 5.80
-
------------------------- AAA Dues             ---------------------
-2011/06/02 AAA Dues              Expenses:Auto:Misc        $ 215.00     $ 215.00
-
------------------------- ABC Towing and Wrecking ---------------------
-2011/03/17 ABC Towing and Wrec..  Expenses:Auto:Hobbies      $ 48.20      $ 48.20
-...
-
- -
-
--head INT - -
-
--first INT - -
-

Print the first INT entries. Opposite of --tail -INT. -

-
-
--historical - -
-
-H - -
-

Value commodities at the time of their acquisition. -

-
-
--immediate - -
-

Evaluate calculations immediately rather than lazily. -

-
-
--inject - -
-

Use Expected amounts in calculations. In case you know -what amount a transaction should be, but the actual transaction has the -wrong value you can use metadata to specify the expected amount: -

-
-
2012-03-12  Paycheck
-    Income  $-990;  Expected:: $-1000.00
-    Checking
-
- -

Then using the command ledger reg --inject=Expected Income would -treat the transaction as if the “Expected Value” was actual. -

-
-
--invert - -
-

Change the sign of all reported values. -

-
-
--limit EXPR - -
-
-l EXPR - -
-

Only transactions that satisfy EXPR are considered in -calculations and for display. -

-
-
--lot-dates - -
-

Report the date on which each commodity in a balance report was -purchased. -

-
-
--lot-notes - -
-
--lot-tags - -
-

Report the tag attached to each commodity in a balance report. -

-
-
--lot-prices - -
-

Report the price at which each commodity in a balance report was -purchased. -

-
-
--lots - -
-

Report the date and price at which each commodity was purchased in -a balance report. -

-
-
--lots-actual - -
-

Preserve the uniqueness of commodities so they aren’t merged during -reporting without printing the lot annotations. -

-
-
--market - -
-
-V - -
-

Use the latest market value for all commodities. -

-
-
--meta TAG - -
-

In the register report, prepend the transaction with the value of the -given TAG. -

-
-
--meta-width INT - -
-

Specify the width of the Meta column used for the --meta -TAG options. -

-
-
--monthly - -
-
-M - -
-

Synonym for ‘--period "monthly"’. -

-
-
--no-aliases - -
-

Aliases are completely ignored. -

-
-
--no-color - -
-

Suppress any color TTY output. -

-
-
--no-pager - -
-

Direct output to stdout, avoiding pager program. -

-
-
--no-revalued - -
-

Stop Ledger from showing <Revalued> postings. This option is useful -in combination with the --exchange or --market option. -

-
-
--no-rounding - -
-

Don’t output ‘<Adjustment>’ postings. Note that this will cause the -running total to often not add up! Its main use is for ---amount-data (-j) and --total-data (-J) reports. -

-
-
--no-titles - -
-

Suppress the output of group titles. -

-
-
--no-total - -
-

Suppress printing the final total line in a balance report. -

-
-
--now DATE - -
-

Define the current date in case you want to calculate in the past or -future using --current. -

-
-
--only FIXME - -
-

This is a postings predicate that applies after certain transforms have -been executed, such as periodic gathering. -

-
-
--output FILE - -
-

Redirect the output of ledger to the file defined in FILE. -

-
-
--pager FILE - -
-

Direct output to FILE pager program. -

-
-
--payee VEXPR - -
-

Sets a value expression for formatting the payee. In the -register report this prevents the second entry from having -a date and payee for each transaction. -

-
-
--payee-width INT - -
-

Set the number of columns dedicated to the payee in the register -report to INT. -

-
-
--pending - -
-

Use only postings that are marked pending. -

-
-
--percent - -
-
-% - -
-

Calculate the percentage value of each account in balance reports. -Only works for accounts that have a single commodity. -

-
-
--period PERIOD_EXPRESSION - -
-

Define a period expression that sets the time period during which -transactions are to be accounted. For a register report only -the transactions that satisfy the period expression with be displayed. -For a balance report only those transactions will be accounted -in the final balances. -

-
-
--pivot TAG - -
-

Produce a balance pivot report around the given TAG. For -example, if you have multiple cars and track each fuel purchase in -‘Expenses:Auto:Fuel’ and tag each fuel purchase with a tag -identifying which car the purchase was for ‘; Car: Prius’, then the -command: -

-
-
$ ledger bal Fuel --pivot "Car" --period "this year"
-
-
-
           $ 3491.26  Car
-           $ 1084.22    M3:Expenses:Auto:Fuel
-            $ 149.65    MG V11:Expenses:Auto:Fuel
-            $ 621.89    Prius:Expenses:Auto:Fuel
-           $ 1635.50    Sienna:Expenses:Auto:Fuel
-             $ 42.69  Expenses:Auto:Fuel
---------------------
-           $ 3533.95
-
- -

See Metadata values. -

-
-
--plot-amount-format FORMAT_STRING - -
-

Define the output format for an amount data plot. See Visualizing with Gnuplot. -

-
-
--plot-total-format FORMAT_STRING - -
-

Define the output format for a total data plot. See Visualizing with Gnuplot. -

-
-
--prepend-format FORMAT_STRING - -
-

Prepend STR to every line of the output. -

-
-
--prepend-width INT - -
-

Reserve INT spaces at the beginning of each line of the output. -

-
-
--price - -
-
-I - -
-

Use the price of the commodity purchase for performing calculations. -

-
-
--pricedb-format FORMAT_STRING - -
-

Set the format expected for the historical price file. -

-
-
--prices-format FORMAT_STRING - -
-

Set the format for the prices report. -

-
-
--primary-date - -
-
--actual-dates - -
-

Show primary dates for all calculations (see Effective Dates). -

-
-
--quantity - -
-
-O - -
-

Report commodity totals (this is the default). -

-
-
--quarterly - -
-

Synonym for ‘--period "quarterly"’. -

-
-
--raw - -
-

In the print report, show transactions using the exact same -syntax as specified by the user in their data file. Don’t do any -massaging or interpreting. This can be useful for minor cleanups, like -just aligning amounts. -

-
-
--real - -
-
-R - -
-

Account using only real transactions ignoring virtual and automatic -transactions. -

-
-
--register-format FORMAT_STRING - -
-

Define the output format for the register report. -

-
-
--related - -
-

In a register report show the related account. This is the -other side of the transaction. -

-
-
--related-all - -
-

Show all postings in a transaction, similar to --related but -show both sides of each transaction. -

-
-
--revalued - -
-

Report discrepancy in values for manual reports by inserting <Revalued> -postings. This is implied when using the --exchange or ---market option. -

-
-
--revalued-only - -
-

Show only <Revalued> postings. -

-
-
--revalued-total FIXME - -
-

Display the sum of the revalued postings as the running total, which serves -to show unrealized capital in a gain/losses report. -

-
-
--rich-data - -
-
--detail - -
-

When generating a ledger transaction from a CSV file using the -convert command, add CSV, Imported, and UUID metadata. -

-
-
--seed INT - -
-

Set the random seed to INT for the generate command. -Used as part of development testing. -

-
-
--sort VEXPR - -
-
-S VEXPR - -
-

Sort the register report based on the value expression given -to sort. -

-
-
--sort-all FIXME - -
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

-
-
--sort-xacts VEXPR - -
-
--period-sort VEXPR - -
-

Sort the postings within transactions using the given value expression. -

-
-
--start-of-week INT - -
-

Tell ledger to use a particular day of the week to start its “weekly” -summary. ‘--start-of-week=1’ specifies Monday as the start of the -week. -

-
-
--subtotal - -
-
-s - -
-

Cause all transactions in a register report to be collapsed -into a single, subtotaled transaction. -

-
-
--tail INT - -
-
--last INT - -
-

Report only the last INT entries. Only useful in -a register report. -

-
-
--time-report - -
-

Add two columns to the balance report to show the earliest checkin and -checkout times for timelog entries. -

-
-
--total VEXPR - -
-
-T VEXPR - -
-

Define a value expression used to calculate the total in reports. -

-
-
--total-data - -
-
-J - -
-

Show only dates and totals to format the output for plots. -

-
-
--total-width INT - -
-

Set the width of the total field in the register report. -

-
-
--truncate CODE - -
-

Indicates how truncation should happen when the contents of columns -exceed their width. Valid arguments are ‘leading’, ‘middle’, -and ‘trailing’. The default is smarter than any of these three, -as it considers sub-names within the account name (that style is -called “abbreviate”). -

-
-
--unbudgeted - -
-

Show only unbudgeted postings. -

-
-
--uncleared - -
-
-U - -
-

Use only uncleared transactions in calculations and reports. -

-
-
--unrealized - -
-

Show generated unrealized gain and loss accounts in the balance -report. -

-
-
--unrealized-gains STR - -
-

Allow the user to specify what account name should be used for -unrealized gains. Defaults to ‘"Equity:Unrealized Gains"’. -Often set in one’s ~/.ledgerrc file to change the default. -

-
-
--unrealized-losses STR - -
-

Allow the user to specify what account name should be used for -unrealized losses. Defaults to ‘"Equity:Unrealized Losses"’. -Often set in one’s ~/.ledgerrc file to change the default. -

-
-
--unround - -
-

Perform all calculations without rounding and display results to full -precision. -

-
-
--values - -
-

Shows the values used by each tag when used in combination with the -tags command. -

-
-
--weekly - -
-
-W - -
-

Synonym for ‘--period "weekly"’. -

-
-
--wide - -
-

Let the register report use 132 columns instead of 80 (the default). -Identical to ‘--columns "132"’. -

-
-
--yearly - -
-
-Y - -
-

Synonym for ‘--period "yearly"’. -

-
-
- -
- - - -

8.3.4 Basic options

- -

These are the most basic command options. Most likely, the user will -want to set them using environment variables (see Environment variables), instead of using actual command-line options: -

-
-
--help - -
-
-h - -
-

Display the man page for ledger. -

-
-
--version - -
-

Print the current version of ledger and exits. This is useful for -sending bug reports, to let the author know which version of ledger you -are using. -

-
-
--file FILE - -
-
-f FILE - -
-

Read FILE as a ledger file. FILE can be ‘-’ which is -a synonym for ‘/dev/stdin’. This command may be used multiple -times. Typically, the environment variable LEDGER_FILE is set, -rather than using this command-line option. -

-
-
--output FILE - -
-
-o FILE - -
-

Redirect output from any command to FILE. By default, all output -goes to standard output. -

-
-
--init-file FILE - -
-
-i FILE - -
-

Causes FILE to be read by ledger before any other ledger file. -This file may not contain any postings, but it may contain option -settings. To specify options in the init file, use the same syntax as -on the command-line, but put each option on its own line. Here is an -example init file: -

-
-
--price-db ~/finance/.pricedb
---wide
-; ~/.ledgerrc ends here
-
- -

Option settings on the command-line or in the environment always take -precedence over settings in the init file. -

-
-
--account STR - -
-
-a STR - -
-

Specify the default account which QIF file postings are assumed to -relate to. -

-
-
- -
- - - -

8.3.5 Report filtering

- -

These options change which postings affect the outcome of a -report, in ways other than just using regular expressions: -

-
-
--current - -
-
-c - -
-

Display only transactions occurring on or before the current date. -

-
-
--begin DATE - -
-
-b DATE - -
-

Constrain the report to transactions on or after DATE. Only -transactions after that date will be calculated, which means that the -running total in the balance report will always start at zero with the -first matching transaction. (Note: This is different from using ---display EXPR to constrain what is displayed). -

-
-
--end DATE - -
-
-e DATE - -
-

Constrain the report so that transactions on or after DATE are -not considered. -

-
-
--period PERIOD_EXPRESSION - -
-
-p PERIOD_EXPRESSION - -
-

Set the reporting period to STR. This will subtotal all matching -transactions within each period separately, making it easy to see -weekly, monthly, quarterly, etc., posting totals. A period string can -even specify the beginning and end of the report range, using simple -terms like ‘last June’ or ‘next month’. For more details on -period expressions, see Period Expressions. -

-
-
--period-sort VEXPR - -
-

Sort the postings within each reporting period using the value -expression EXPR. This is most often useful when reporting -monthly expenses, in order to view the highest expense categories at -the top of each month: -

-
-
$ ledger -M --period-sort total reg ^Expenses
-
- -
-
--cleared - -
-
-C - -
-

Display only postings whose transaction has been marked “cleared” -(by placing an asterisk to the right of the date). -

-
-
--uncleared - -
-
-U - -
-

Display only postings whose transaction has not been marked “cleared” -(i.e., if there is no asterisk to the right of the date). -

-
-
--real - -
-
-R - -
-

Display only real postings, not virtual. (A virtual posting is -indicated by surrounding the account name with parentheses or brackets; -see Virtual postings for more information). -

-
-
--actual - -
-
-L - -
-

Display only actual postings, and not those created by automated -transactions. -

-
-
--related - -
-
-r - -
-

Display postings that are related to whichever postings would -otherwise have matched the filtering criteria. In the register -report, this shows where money went to, or the account it came from. -In the balance report, it shows all the accounts affected by -transactions having a related posting. For example, if a file had -this transaction: -

-
-
2004/03/20 Safeway
-    Expenses:Food                       $65.00
-    Expenses:Cash                       $20.00
-    Assets:Checking                    $-85.00
-
- -

And the register command was: -

-
-
$ ledger -f example.dat -r register food
-
- -

The following would be printed, showing the postings related to the -posting that matched: -

-
-
04-Mar-20 Safeway               Expenses:Cash                $20.00       $20.00
-                                Assets:Checking             $-85.00      $-65.00
-
- -
-
--budget - -
-

Useful for displaying how close your postings meet your budget. ---add-budget also shows unbudgeted postings, while ---unbudgeted shows only those. --forecast VEXPR -is a related option that projects your budget into the future, showing -how it will affect future balances. See Budgeting and Forecasting. -

-
-
--limit EXPR - -
-
-l EXPR - -
-

Limit which postings take part in the calculations of a report. -

-
-
--amount EXPR - -
-
-t EXPR - -
-

Change the value expression used to calculate the “value” column in -the register report, the amount used to calculate account -totals in the balance report, and the values printed in the -equity report. See Value Expressions. -

-
-
--total VEXPR - -
-
-T VEXPR - -
-

Set the value expression used for the “totals” column in the -register and balance reports. -

-
-
- - - - - - - -
- - - -

8.3.6 Output customization

- -

These options affect only the output, but not which postings are -used to create it: -

-
-
--collapse - -
-
-n - -
-

Cause transactions in a register report with multiple -postings to be collapsed into a single, subtotaled transaction. -

-
-
--subtotal - -
-
-s - -
-

Cause all transactions in a register report to be collapsed -into a single, subtotaled transaction. -

-
-
--by-payee - -
-
-P - -
-

Report subtotals by payee. -

-
-
--empty - -
-
-E - -
-

Include even empty accounts in the balance report. -

-
-
--weekly - -
-
-W - -
-

Report posting totals by the week. The week begins on whichever day of -the week begins the month containing that posting. To set a specific -begin date, use a period string, such as ‘weekly from DATE’. -

-
-
--monthly - -
-
-M - -
-

Report posting totals by month. -

-
-
--yearly - -
-
-Y - -
-

Report posting totals by year. For more complex periods, use ---period. -

-
-
--period PERIOD_EXPRESSION - -
-

Option described above. -

-
-
--dow - -
-

Report posting totals for each day of the week. This is an easy way -to see if weekend spending is more than on weekdays. -

-
-
--sort VEXPR - -
-
-S VEXPR - -
-

Sort a report by comparing the values determined using the value -expression VEXPR. For example, using ‘-S "-abs(total)"’ in -the balance report will sort account balances from greatest to -least, using the absolute value of the total. For more on how to use -value expressions, see Value Expressions. -

-
-
--pivot TAG - -
-

Produce a pivot table around the TAG provided. This requires -meta data using valued tags. -

-
-
--wide - -
-
-w - -
-

Cause the default register report to assume 132 columns -instead of 80. -

-
-
--head INT - -
-

Cause only the first INT transactions to be printed. This is -different from using the command-line utility head, which would -limit to the first INT postings. --tail INT outputs -only the last INT transactions. Both options may be used -simultaneously. If a negative amount is given, it will invert the -meaning of the flag (instead of the first five transactions being -printed, for example, it would print all but the first five). -

-
-
--pager FILE - -
-

Tell Ledger to pass its output to the given FILE pager program; -very useful when the output is especially long. This behavior can be -made the default by setting the LEDGER_PAGER environment variable. -

-
-
--no-pager - -
-

Tell Ledger to not pass its output to a pager program; useful -when a pager is set by default. -

-
-
--average - -
-
-A - -
-

Report the average posting value. -

-
-
--deviation - -
-
-D - -
-

Report each posting’s deviation from the average. It is only meaningful -in the register and prices reports. -

-
-
--percent - -
-
-% - -
-

Show account subtotals in the balance report as percentages of -the parent account. -

- -
-
--amount-data - -
-
-j - -
-

Change the register report so that it prints nothing but the -date and the value column, and the latter without commodities. This is -only meaningful if the report uses a single commodity. This data can -then be fed to other programs, which could plot the date, analyze it, -etc. -

-
-
--total-data - -
-
-J - -
-

Change the register report so that it prints nothing but the -date and total columns, without commodities. -

-
-
--display EXPR - -
-
-d EXPR - -
-

Limit which postings or accounts are actually displayed in a report. -They might still be calculated, and be part of the running total of a -register report, for example, but they will not be displayed. This is -useful for seeing last month’s checking postings, against a running -balance which includes all posting values: -

-
-
$ ledger -d "d>=[last month]" reg checking
-
- -

The output from this command is very different from the following, -whose running total includes only postings from the last month -onward: -

-
-
$ ledger -p "last month" reg checking
-
- -

Which is more useful depends on what you’re looking to know: the total -amount for the reporting range (using --period -PERIOD_EXPRESSION (-p)), or simply a display restricted to the -reporting range (using --display EXPR (-d)). -

-
-
--date-format DATE_FORMAT - -
-
-y DATE_FORMAT - -
-

Change the basic date format used by reports. The default uses a date -like ‘2004/08/01’, which represents the default date format of -%Y/%m/%d. To change the way dates are printed in general, the -easiest way is to put --date-format DATE_FORMAT in the -Ledger initialization file ~/.ledgerrc (or the file referred to -by LEDGER_INIT). -

-
-
--format FORMAT_STRING - -
-
-F FORMAT_STRING - -
-

Set the reporting format for whatever report ledger is about to make. -See Format Strings. There are also specific format commands for -each report type: -

-
-
--balance-format FORMAT_STRING - -
-

Define the output format for the balance report. The default -(defined in report.h is: -

-
-
"%(ansify_if(
-        justify(scrub(display_total), 20,
-                20 + int(prepend_width), true, color),
-                  bold if should_bold))
-        %(!options.flat ? depth_spacer : \"\")
-      %-(ansify_if(
-         ansify_if(partial_account(options.flat), blue if color),
-                   bold if should_bold))\n%/
-      %$1\n%/
-      %(prepend_width ? \" \" * int(prepend_width) : \"\")
-      --------------------\n"
-
- -
-
--cleared-format FORMAT_STRING - -
-

Define the format for the cleared report. The default is: -

-
-
"%(justify(scrub(get_at(display_total, 0)), 16, 16 + int(prepend_width),
-       true, color))  %(justify(scrub(get_at(display_total, 1)), 18,
-       36 + int(prepend_width), true, color))
-          %(latest_cleared ? format_date(latest_cleared) : \"         \")
-          %(!options.flat ? depth_spacer : \"\")
-      %-(ansify_if(partial_account(options.flat), blue if color))\n%/
-      %$1  %$2    %$3\n%/
-      %(prepend_width ? \" \" * int(prepend_width) : \"\")
-      ----------------    ----------------    ---------\n"
-
- -
-
--register-format FORMAT_STRING - -
-

Define the output format for the register report. The default -(defined in report.h is: -

-
-
"%(ansify_if(
-        ansify_if(justify(format_date(date), int(date_width)),
-                  green if color and date > today),
-                  bold if should_bold))
-       %(ansify_if(
-         ansify_if(justify(truncated(payee, int(payee_width)), int(payee_width)),
-                   bold if color and !cleared and actual),
-                   bold if should_bold))
-       %(ansify_if(
-         ansify_if(justify(truncated(display_account, int(account_width),
-                                     int(abbrev_len)), int(account_width)),
-                   blue if color),
-                   bold if should_bold))
-       %(ansify_if(
-         justify(scrub(display_amount), int(amount_width),
-                 3 + int(meta_width) + int(date_width) + int(payee_width)
-                   + int(account_width) + int(amount_width) + int(prepend_width),
-                 true, color),
-                 bold if should_bold))
-       %(ansify_if(
-         justify(scrub(display_total), int(total_width),
-                 4 + int(meta_width) + int(date_width) + int(payee_width)
-                   + int(account_width) + int(amount_width) + int(total_width)
-                   + int(prepend_width), true, color),
-                 bold if should_bold))\n%/
-      %(justify(\" \", int(date_width)))
-       %(ansify_if(
-         justify(truncated(has_tag(\"Payee\") ? payee : \" \",
-                           int(payee_width)), int(payee_width)),
-                   bold if should_bold))
-       %$3 %$4 %$5\n"
-
- -
-
--csv-format FORMAT_STRING - -
-

Set the format for csv reports. The default is: -

-
-
"%(quoted(date)),
- %(quoted(code)),
- %(quoted(payee)),
- %(quoted(display_account)),
- %(quoted(commodity(scrub(display_amount)))),
- %(quoted(quantity(scrub(display_amount)))),
- %(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\"))),
- %(quoted(join(note | xact.note)))\n"
-
- -
-
--plot-amount-format FORMAT_STRING - -
-

Set the format for amount plots, using the --amount-data (-j) -option. The default is: -

-
-
"%(format_date(date, \"%Y-%m-%d\")) %(quantity(scrub(display_amount)))\n"
-
- -
-
--plot-total-format FORMAT_STRING - -
-

Set the format for total plots, using the --total-data (-J) -option. The default is: -

-
-
"%(format_date(date, \"%Y-%m-%d\")) %(quantity(scrub(display_total)))\n"
-
- -
-
--pricedb-format FORMAT_STRING - -
-

Set the format expected for the historical price file. The default is: -

-
-
"P %(datetime) %(display_account) %(scrub(display_amount))\n"
-
- -
-
--prices-format FORMAT_STRING - -
-

Set the format for the prices report. The default is: -

-
-
"%(date) %-8(display_account) %(justify(scrub(display_amount), 12,
-           2 + 9 + 8 + 12, true, color))\n"
-
- -
-
- -
- - - -

8.3.7 Commodity reporting

- -

These options affect how commodity values are displayed: -

-
-
--price-db FILE - -
-

Set the file that is used for recording downloaded commodity prices. -It is always read on startup, to determine historical prices. Other -settings can be placed in this file manually, to prevent downloading -quotes for a specific commodity, for example. This is done by adding a -line like the following: -

-
-
; Don't download quotes for the dollar, or timelog values
-N $
-N h
-
- -

Note: Ledger NEVER writes output to files. You are responsible for -updating the price-db file. The best way is to have your price -download script maintain this file. -

-

The format of the file can be changed by telling ledger to use the ---pricedb-format FORMAT_STRING you define. -

-
-
--price-exp INT - -
-
--leeway INT - -
-
-Z INT - -
-

Set the expected freshness of price quotes, in INT minutes. That -is, if the last known quote for any commodity is older than this value, -and if --download is being used, then the Internet will be -consulted again for a newer price. Otherwise, the old price is still -considered to be fresh enough. -

-
-
--download - -
-
-Q - -
-

Cause quotes to be automagically downloaded, as needed, by running -a script named getquote and expecting that script to return -a value understood by ledger. A sample implementation of -a getquote script, implemented in Perl, is provided in the -distribution. Downloaded quote price are then appended to the price -database, usually specified using the environment variable -LEDGER_PRICE_DB. -

-
-
- -

There are several different ways that ledger can report the totals it -displays. The most flexible way to adjust them is by using value -expressions, and the --amount EXPR (-t) and ---total VEXPR (-T) options. However, there are also -several “default” reports, which will satisfy most users’ basic -reporting needs: -

-
-
--quantity - -
-
-O - -
-

Report commodity totals (this is the default). -

-
-
--basis - -
-
-B - -
-

Report the cost basis for all postings. -

-
-
--market - -
-
-V - -
-

Use the last known value for commodities to calculate final values. -

-
-
--gain - -
-
-G - -
-

Report the net gain/loss for all commodities in the report that have -a price history. -

-
-
- -

Often you will be more interested in the value of your entire holdings, -in your preferred currency. It might be nice to know you hold 10,000 -shares of PENNY, but you are more interested in whether or not that is -worth $1000.00 or $10,000.00. However, the current day value of a -commodity can mean different things to different people, depending on -the accounts involved, the commodities, the nature of the transactions, -etc. -

- - - - -

When you specify --market (-V), or --exchange -COMMODITY (-X), you are requesting that some or all of the -commodities be valuated as of today (or whatever --now -DATE is set to). But what does such a valuation mean? This -meaning is governed by the presence of a VALUE meta-data property, -whose content is an expression used to compute that value. -

-

If no VALUE property is specified, each posting is assumed to have -a default, as if you’d specified a global, automated transaction as -follows: -

-
-
= expr true
-    ; VALUE:: market(amount, date, exchange)
-
- -

This definition emulates the present day behavior of --market -(-V) and --exchange COMMODITY (-X) (in the case of -‘-X’, the requested commodity is passed via the string -‘exchange’ above). -

- -

One thing many people have wanted to do is to fixate the valuation of -old European currencies in terms of the Euro after a certain date: -

-
-
= expr commodity == "DM"
-    ; VALUE:: date < [Jun 2008] ? market(amount, date, exchange) : 1.44 EUR
-
- -

This says: If --now DATE is some old date, use market -prices as they were at that time; but if --now DATE is -past June 2008, use a fixed price for converting Deutsch Mark to Euro. -

-

Or how about never re-valuating commodities used in Expenses, since -they cannot have a different future value: -

-
-
= /^Expenses:/
-    ; VALUE:: market(amount, post.date, exchange)
-
- -

This says the future valuation is the same as the valuation at the time -of posting. post.date equals the posting’s date, while just ’date’ is -the value of --now DATE (defaults to today). -

-

Or how about valuating miles based on a reimbursement rate during a -specific time period: -

-
-
= expr commodity == "miles" and date >= [2007] and date < [2008]
-    ; VALUE:: market($1.05, date, exchange)
-
- -

In this case, miles driven in 2007 will always be valuated at $1.05 -each. If you use ‘-X EUR’ to expressly request all amounts in -Euro, Ledger shall convert $1.05 to Euro by whatever means are -appropriate for dollars. -

-

Note that you can have a valuation expression specific to a particular -posting or transaction, by overriding these general defaults using -specific meta-data: -

-
-
2010-12-26 Example
-    Expenses:Food                $20
-    ; Just to be silly, always valuate *these* $20 as 30 DM, no matter what
-    ; the user asks for with -V or -X
-    ; VALUE:: 30 DM
-    Assets:Cash
-
- -

This example demonstrates that your value expression should be as -symbolic as possible, using terms like ’amount’ and ’date’, rather than -specific amounts and dates. Also, you should pass the amount along to -the function ’market’ so it can be further revalued if the user has -asked for a specific currency. -

-

Or, if it better suits your accounting, you can be less symbolic, -which allows you to report most everything in EUR if you use ‘-X -EUR’, except for certain accounts or postings which should always be -valuated in another currency. For example: -

-
-
= /^Assets:Brokerage:CAD$/
-    ; Always report the value of commodities in this account in
-    ; terms of present day dollars, despite what was asked for
-    ; on the command-line VALUE:: market(amount, date, ‘$’)
-
- - - - - - - - - - -

Ledger presently has no way of handling such things as FIFO and LIFO. -

-

If you specify an unadorned commodity name, like AAPL, it will balance -against itself. If --lots are not being displayed, then it -will appear to balance against any lot of AAPL. -

- - -

If you specify an adorned commodity, like AAPL {$10.00}, it will also -balance against itself, and against any AAPL if --lots is not -specified. But if you do specify --lot-prices, for example, -then it will balance against that specific price for AAPL. -

-

Normally when you use --exchange COMMODITY (-X) to -request that amounts be reported in a specific commodity, Ledger uses -these values: -

-
    -
  • Register Report -For the register report, use the value of that commodity on -the date of the posting being reported, with a ‘<Revalued>’ posting -added at the end if today’s value is different from the value of the -last posting. - -
  • Balance Report -For the balance report, use the value of that commodity as of -today. - -
- -

You can now specify --historical (-H) to ask that all -valuations for any amount be done relative to the date that amount was -encountered. -

-

You can also now use --exchange COMMODITY (-X) (and ---historical (-H)) in conjunction with --basis (-B) -and --price (-I), to see valuation reports of just your basis -costs or lot prices. -

-

Finally, sometimes, you may seek to only report one (or some subset) of -the commodities in terms of another commodity. In this situation, you -can use the syntax --exchange COMMODITY1:COMMODITY2 -to request that ledger always display COMMODITY1 in terms of -COMMODITY2, but you want no other commodities to be automatically -displayed in terms of COMMODITY2 without additional ---exchange options. For example, if you wanted to report EUR -and BTC in terms of USD, but report all other commodities without -conversion to USD, you could use: --exchange EUR:USD --exchange -BTC:USD. -

-
- - - -

8.3.8 Environment variables

- -

Every option to ledger may be set using an environment variable if the -option has a long name. For example setting the environment variable -‘LEDGER_DATE_FORMAT="%d.%m.%Y"’ will have the same effect as specifying -‘--date-format '%d.%m.%Y'’ on the command-line. Options on the -command-line always take precedence over environment variable settings, however. -

-

Note that you may also permanently specify option values by placing -option settings in the file ~/.ledgerrc one option per line, for example: -

-
-
--pager /bin/cat
-
- -
- - - -

8.4 Period Expressions

- -

A period expression indicates a span of time, or a reporting interval, -or both. Ledger’s end dates are always exclusive, imagine the date is -followed by 00:00:00 time. They are instants in time not entire days. -The full syntax is: -

-
-
[INTERVAL] [BEGIN] [END]
-
- -

The optional INTERVAL part may be any one of: -

-
-
every day
-every week
-every month
-every quarter
-every year
-every N days     # N is any integer
-every N weeks
-every N months
-every N quarters
-every N years
-daily
-weekly
-biweekly
-monthly
-bimonthly
-quarterly
-yearly
-
- -

After the interval, a begin time, end time, both or neither may be -specified. As for the begin time, it can be either of: -

-
-
from <SPEC>
-since <SPEC>
-
- -

The end time can be either of: -

-
-
to <SPEC>
-until <SPEC>
-
- -

Where SPEC can be any of: -

-
-
2004
-2004/10
-2004/10/1
-10/1
-october
-oct
-this week  # or day, month, quarter, year
-next week
-last week
-
- -

The beginning and ending can be given at the same time, if it spans a -single period. In that case, just use SPEC by itself. In that -case, the period ‘oct’, for example, will cover all the days in -October. The possible forms are: -

-
-
<SPEC>
-in <SPEC>
-
- -

Here are a few examples of period expressions: -

-
-
monthly
-monthly in 2004
-weekly from oct
-weekly from last month
-from sep to oct
-from 10/1 to 10/5
-monthly until 2005
-from apr
-until nov
-last oct
-weekly last august
-
- -
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

9 Budgeting and Forecasting

- - - - - - -
- - - -

9.1 Budgeting

- - - - - -

Keeping a budget allows you to pay closer attention to your income and -expenses, by reporting how far your actual financial activity is from -your expectations. -

-

To start keeping a budget, put some periodic transactions -(see Periodic Transactions) at the top of your ledger file. A -periodic transaction is almost identical to a regular transaction, except -that it begins with a tilde and has a period expression in place of a -payee. For example: -

-
-
~ Monthly
-    Expenses:Rent               $500.00
-    Expenses:Food               $450.00
-    Expenses:Auto:Gas           $120.00
-    Expenses:Insurance          $150.00
-    Expenses:Phone              $125.00
-    Expenses:Utilities          $100.00
-    Expenses:Movies              $50.00
-    Expenses                    $200.00  ; all other expenses
-    Assets
-
-~ Yearly
-    Expenses:Auto:Repair        $500.00
-    Assets
-
- -

These two periodic transactions give the usual monthly expenses, as well -as one typical yearly expense. For help on finding out what your -average monthly expenses are for any category, use a command like: -

-
-
$ ledger -p "this year" --monthly --average register ^expenses
-
- -

The reported totals are the current year’s average for each account. -

-

Once these periodic transactions are defined, creating a budget report is -as easy as adding --budget to the command-line. For example, -a typical monthly expense report would be: -

-
-
$ ledger --monthly register ^expenses
-
- -

To see the same report balanced against your budget, use: -

-
-
$ ledger --budget --monthly register ^expenses
-
- -

A budget report includes only those accounts that appear in the budget. -To see all expenses balanced against the budget, use ---add-budget. You can even see only the unbudgeted expenses -using --unbudgeted: -

-
-
$ ledger --unbudgeted --monthly register ^expenses
-
- -

You can also use these flags with the balance command. -

-
- - - -

9.2 Forecasting

- - -

Sometimes it’s useful to know what your finances will look like in the -future, such as determining when an account will reach zero. Ledger -makes this easy to do, using the same periodic transactions as are used -for budgeting. An example forecast report can be generated with: -

-
-
$ ledger --file drewr3.dat --forecast "T>{\$-500.00}" register ^assets ^liabilities
-
- -

This report continues outputting postings until the running total -is greater than $-500.00. A final posting is always shown, to -inform you what the total afterwards would be. -

-

Forecasting can also be used with the balance report, -but by date only, and not against the running total: -

-
-
$ ledger --forecast "d<[2010]" bal ^assets ^liabilities
-
- -
- - - -

10 Time Keeping

- - -

Ledger directly supports “timelog” entries, which have this form: -

-
-
i 2013/03/28 22:13:00 ACCOUNT[  PAYEE]
-o 2013/03/29 03:39:00
-
- -

This records a check-in to the given ACCOUNT, and a check-out. You can -be checked-in to multiple accounts at a time, if you wish, and they can -span multiple days (use --day-break to break them up in the -report). The number of seconds between check-in and check-out is -accumulated as time to that ACCOUNT. If the checkout uses a capital -‘O’, the transaction is marked “cleared”. You can use an -optional PAYEE for whatever meaning you like. -

-

Now, there are a few ways to generate this information. You can use -the timeclock.el package, which is part of Emacs. Or you can -write a simple script in whichever language you prefer to emit similar -information. Or you can use Org mode’s time-clocking abilities and -the org2tc script developed by John Wiegley. -

-

These timelog entries can appear in a separate file, or directly in -your main ledger file. The initial ‘i’ and ‘o’ characters -count as Ledger “directives”, and are accepted anywhere that -ordinary transactions are valid. -

-
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

11 Value Expressions

- - - -

Ledger uses value expressions to make calculations for many different -purposes: -

-
    -
  1. The values displayed in reports. - -
  2. For predicates (where truth is anything non-zero), to determine which -postings are calculated (option --limit EXPR (-l)) or -displayed (option --display EXPR (-d)). - -
  3. For sorting criteria, to yield the sort key. - -
  4. In the matching criteria used by automated postings. - -
- -

Value expressions support most simple math and logic operators, in -addition to a set of functions and variables. -

- - - -

Display predicates are also very handy with register reports, to -constrain which transactions are printed. For example, the following -command shows only transactions from the beginning of the current month, -while still calculating the running balance based on all transactions: -

-
-
$ ledger -d "d>[this month]" register checking
-
- -

The advantage of this command’s complexity is that it prints the -running total in terms of all transactions in the register. The -following, simpler command is similar, but totals only the displayed -postings: -

-
-
$ ledger -b "this month" register checking
-
- - - - - - - - -
- -
-

-Next: , Previous: , Up: Value Expressions   [Contents][Index]

-
- -

11.1 Variables

- - - -

Below are the one letter variables available in any value expression. -For the register and print commands, these variables -relate to individual postings, and sometimes the account affected by a -posting. For the balance command, these variables relate to -accounts, often with a subtle difference in meaning. The use of each -variable for both is specified. -

-
-
t
-

This maps to whatever the user specified with --amount -EXPR (-t). In a register report, --amount -EXPR (-t) changes the value column; in a balance -report, it has no meaning by default. If --amount EXPR -(-t) was not specified, the current report style’s value expression is -used. -

-
-
T
-

This maps to whatever the user specified with --total -VEXPR (-T). In a register report, --total VEXPR -(-T) changes the totals column; in a balance report, this is the value -given for each account. If --total VEXPR (-T) was not -specified, the current report style’s value expression is used. -

-
-
m
-

This is always the present moment/date. -

-
-
- - - - - - -
- -
-

-Next: , Previous: , Up: Variables   [Contents][Index]

-
- -

11.1.1 Posting/account details

- -
-
d
-

A posting’s date, as the number of seconds past the epoch. This -is always “today” for an account. -

-
-
a
-

The posting’s amount; the balance of an account, without -considering children. -

-
-
b
-

The cost of a posting; the cost of an account, without its -children. -

-
-
v
-

The market value of a posting or an account, without its children. -

-
-
g
-

The net gain (market value minus cost basis), for a posting or an -account, without its children. It is the same as ‘v-b’. -

-
-
l
-

The depth (“level”) of an account. If an account has one parent, -its depth is one. -

-
-
n
-

The index of a posting, or the count of postings affecting an -account. -

-
-
X
-

1’ if a posting’s transaction has been cleared, ‘0’ otherwise. -

-
-
R
-

1’ if a posting is not virtual, ‘0’ otherwise. -

-
-
Z
-

1’ if a posting is not automated, ‘0’ otherwise. -

-
-
- -
- -
-

-Previous: , Up: Variables   [Contents][Index]

-
- -

11.1.2 Calculated totals

- -
-
O
-

The total of all postings seen so far, or the total of an account -and all its children. -

-
-
N
-

The total count of postings affecting an account and all its -children. -

-
-
- -
- -
-

-Next: , Previous: , Up: Value Expressions   [Contents][Index]

-
- -

11.2 Functions

- -

The available one letter functions are: -

-
-
-
-

Negates the argument. -

-
-
U
-

The absolute (unsigned) value of the argument. -

-
-
S
-

Strips the commodity from the argument. -

-
-
P
-

The present market value of the argument. The syntax ‘P(x,d)’ is -supported, which yields the market value at time ‘d’. If no date -is given, then the current moment is used. -

-
-
- -
- - - -

11.3 Operators

- -

The operators, in order of precedence, are: -

-
    -
  1. * / -
  2. + - -
  3. ! < > = -
  4. & | ?: -
- - - - - - -
- -
-

-Next: , Previous: , Up: Operators   [Contents][Index]

-
- -

11.3.1 Unary Operators

- -

not (!) -neg -

-
- -
-

-Previous: , Up: Operators   [Contents][Index]

-
- -

11.3.2 Binary Operators

- -

== -< -<= -> ->= -and -or -+ -- -* -/ -QUERY -COLON -CONS -SEQ -DEFINE -LOOKUP -LAMBDA -CALL -MATCH -

-
- -
-

-Previous: , Up: Value Expressions   [Contents][Index]

-
- -

11.4 Complex expressions

- -

More complicated expressions are possible using: -

-
-
"amount == COMMODITY AMOUNT"
-

The amount can be any kind of amount supported by ledger, -with or without a commodity. Use this for decimal values. -

-
-
/REGEX/
-
account =~ /REGEX/
-

A regular expression that matches against an account’s full name. If -a posting, this will match against the account affected by the -posting. -

-
-
@/REGEX/
-
expr payee =~ /REGEX/
-

A regular expression that matches against a transaction’s payee name. -

-
-
%/REGEX/
-
expr has_tag(/REGEX/)
-
expr has_tag('TAG')
-

A regular expression (REGEX) or string (TAG) that checks for the tags of -a transaction. -

-
-
tag(REGEX) =~ /REGEX/
-

A regular expression that matches a transaction’s tags against its values. -

-
-
expr date =~ /REGEX/
-

Useful for specifying a date in plain terms. For example, you could say -‘expr date =~ /2014/’. -

-
-
expr comment =~ /REGEX/
-

A regular expression that matches against a posting’s comment -field. This searches only a posting’s field, not the transaction’s note -or comment field. For example, ledger reg "expr" "comment =~ -/landline/" will match: -

-
-
2014/1/29  Phone bill
-    Assets:Checking                           $50.00
-    Expenses:Phone                           $-50.00  ; landline bill
-
- -

but will not match: -

-
-
2014/1/29  Phone bill  ; landline bill
-    ; landline bill
-    Assets:Checking                           $50.00
-    Expenses:Phone                           $-50.00
-
- -

To match the latter, use ‘ledger reg "expr" "note =~ /landline/"’ -instead. -

-
-
expr note =~ /REGEX/
-

A regular expression that matches against a transaction’s note field. -This searches all comments in the transaction, including comments on -individual postings. Thus, ‘ledger reg "expr" "note =~ /landline/"’ -will match both all the three examples below: -

-
-
2014/1/29  Phone bill
-    Assets:Checking                           $50.00
-    Expenses:Phone                           $-50.00  ; landline bill
-
- -
-
2014/1/29  Phone bill  ; landline bill
-    Assets:Checking                           $50.00
-    Expenses:Phone                           $-50.00
-
- -
-
2014/1/29  Phone bill
-    ; landline bill
-    Assets:Checking                           $50.00
-    Expenses:Phone                           $-50.00
-
- -
-
(EXPR)
-

A sub-expression is nested in parenthesis. This can be useful passing -more complicated arguments to functions, or for overriding the natural -precedence order of operators. -

-
-
expr base =~ /REGEX/
-

A regular expression that matches against an account’s base name. If -a posting, this will match against the account affected by the -posting. -

-
-
expr code =~ /REGEX/
-

A regular expression that matches against the transaction code (the -text that occurs between parentheses before the payee). -

-
-
expr any(KEYWORD =~ /REGEX/)
-

The any keyword is used to specify that at least one posting of -the transaction must match the expression in brackets. For example, -‘ledger -f d reg expr "any(account =~ /Assets:/)"’ can be used to -display all transactions which involve at least one ‘Assets:’ -account. -

-
-
expr all(KEYWORD =~ /REGEX/)
-

The all keyword is used to specify that all postings of a -transactions must match the expression in brackets. For example, -‘ledger -f d reg expr "all(account =~ /Assets:/)"’ can be used to -display all transactions where all accounts are ‘Assets:’. -

-
-
- -

The query command can be used to see how Ledger interprets -your query. This can be useful if you are not getting the results you -expect (see Pre-Commands). -

- - - - -
- - - -

11.4.1 Miscellaneous

- -

The following Ledger journal data (saved as expr.dat) is used to explain the behaviour of the -functions and variables below: -

-
2015/01/16 * (C0D3) Payee
-  Assets:Cash                 ¤ -123,45
-    ; Payee: PiggyBank
-  Expenses:Office Supplies
-
- -
-
Function: abs value
-
Function: U value
-

Return the absolute value of the given value, e.g. amount. -

-
$ ledger -f expr.dat --format "%(account) %(abs(amount))\n" reg assets
-
-
-
Assets:Cash ¤ 123,45
-
-
- -
-
Function: amount_expr
-

Return the calculated amount of the posting according to the --amount -option. -

- -
-
Function: ansify_if value color bool
-

Render the given expression as a string, applying the proper ANSI escape -codes to display it in the given color if bool is true. It -typically checks the value of the option --color. Since ANSI escape -codes include non-printable character sequences, such as escape ^[ -the following example may not appear as the final result on the command-line. -

-
$ ledger -f expr.dat --format "%(ansify_if(account, blue, options.color))\n" reg
-
-
-
Assets:Cash
-Expenses:Office Supplies
-
-
- -
-
Function: ceiling value
-

Return the next integer of value toward +infinity. -

-
$ ledger -f expr.dat --format "%(account) %(ceiling(amount))\n" reg
-
-
-
Assets:Cash ¤ -123,00
-Expenses:Office Supplies ¤ 124,00
-
-
- -
-
Variable: code
-

Return the transaction code, the string between the parenthesis after the date. -

-
$ ledger -f expr.dat --format "%(account) %(code)\n" reg assets
-
-
-
Assets:Cash C0D3
-
-
- -
-
Variable: commodity
-

Return the commodity of the posting amount. -

-
-
$ ledger -f expr.dat --format "%(account) %(commodity)\n" reg
-
-
-
Assets:Cash ¤
-Expenses:Office Supplies ¤
-
- -
-
Variable: date
-

Return the date of the posting. -

-
-
$ ledger -f expr.dat --format "%(date) %(account)\n" reg assets
-
-
-
2015/01/16 Assets:Cash
-
- -
-
Variable: display_amount
-
Variable: t
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- -
-
Variable: display_total
-
Variable: T
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- -
-
Function: floor value
-

Return the next integer of value toward -infinity. -

-
$ ledger -f expr.dat --format "%(account) %(floor(amount))\n" reg
-
-
-
Assets:Cash ¤ -124,00
-Expenses:Office Supplies ¤ 123,00
-
-
- -
-
Function: format string
-

Evaluate string as format just like the --format option. -

- -
-
Function: format_date date format
-

Return the date as a string using format. See -strftime (3) for format string details. -

-
$ ledger -f expr.dat --format "%(format_date(date, '%A, %B %d. %Y'))\n" reg assets
-
-
-
Friday, January 16. 2015
-
-
- -
-
Function: format_datetime datetime format
-

Return the datetime as a string using format. Refer to -strftime (3) for format string details. -

- -
-
Function: get_at sequence index
-

Return the value in sequence at index. The first element is index 0. -For internal use only. -

- -
-
Function: is_seq value
-

Return true if value is a sequence. For internal use only. -

- -
-
Function: join value
-

Replace all newlines in value with \n. -

- -
-
Function: justify value first_width latter_width right_justify colorize
-

Right or left justify the string representing value. The width -of the field in the first line is given by first_width. For -subsequent lines the width is given by latter_width. If -latter_width=-1, then first_width is used for all lines. -If right_justify=true then the field is right justified within -the width of the field. If it is false, then the field is left -justified and padded to the full width of the field. If -colorize is true, then ledger will honor color settings. -

-
$ ledger -f expr.dat --format "»%(justify(account, 30, 30, true))«\n" reg
-
-
-
»                   Assets:Cash«
-»      Expenses:Office Supplies«
-
-
- -
-
Function: market value datetime
-
Function: P
-

Return the price of value at datetime. Note that datetime -must be surrounded by brackets in order to be parsed correctly, -e.g. [2012/03/23]. -

- -
-
Function: nail_down
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- -
-
Variable: now
-
Variable: d
-
Variable: m
-

Return the current datetime. -

- -
-
Variable: options
-

A variable that allows access to the values of the given command-line options -using the long option names, e.g. to see whether --daily or -D -was given use option.daily. -

-
$ ledger -f expr.dat -X $ -D --format "%(options.daily) %(options.exchange)\n" reg assets
-
-
-
true $
-
-
- -
-
Function: percent value_a value_b
-

Return the percentage of value_a in relation to value_b (used as 100%) -

-
$ ledger -f expr.dat --format "%(percent(amount, 200))\n" reg
-
-
-
-61.73%
-61.73%
-
-
- -
-
Function: print value
-

Print value to stdout. For internal use only. -

- -
-
Function: quantity value
-

Return the quantity of value for values that have a per-unit cost. -

- -
-
Function: quoted expression
-

Surround expression with double-quotes. If expression contains a double-quote, it will be escaped with a backslash. -

-
$ ledger -f expr.dat --format "%(quoted(account)) %(quoted(amount))\n" reg
-
-
-
"Assets:Cash" "¤ -123,45"
-"Expenses:Office Supplies" "¤ 123,45"
-
-
- - -
-
Function: round
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- -
-
Function: rounded
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- -
-
Function: roundto value n
-

Return value rounded to n digits. Does not affect formatting. -

-
$ ledger -f expr.dat --format "%(account) %(roundto(amount, 1))\n" reg
-
-
-
Assets:Cash ¤ -123,40
-Expenses:Office Supplies ¤ 123,50
-
-
- -
-
Function: scrub value
-

Clean value using various transformations such as round, stripping -value annotations, and more. -

- -
-
Function: should_bold
-

Return true if expression given to --bold-if evaluates to true. For internal use only. -

- -
-
Function: strip value
-
Function: S
-

Strip value annotation from value. -

- -
-
Function: to_amount value
-

Convert value to an amount. For internal use only. -

- -
-
Function: to_balance value
-

Convert value to a balance. For internal use only. -

- -
-
Function: to_boolean value
-

Convert value to a boolean. For internal use only. -

- -
-
Function: to_date value
-

Convert value to a date. For internal use only. -

- -
-
Function: to_datetime value
-

Convert value to a datetime. For internal use only. -

- -
-
Function: to_int value
-
Function: int value
-

Return the integer value for value. -

-
$ ledger -f expr.dat --format "%(1 + to_int('1'))\n%(2,5 + int(2,5))\n" reg assets
-
-
-
2
-4.5
-
-
- -
-
Function: to_mask value
-

Convert value to a mask. For internal use only. -

- -
-
Function: to_sequence value
-

Convert value to a sequence. For internal use only. -

- -
-
Function: to_string value
-
Function: str value
-

Convert value to a character string. -

- -
-
Variable: today
-

Return today’s date. -

-
-
$ ledger -f expr.dat --now 2015/01/01 --format "%(today)\n" reg assets
-
-
-
2015/01/01
-
- -
-
Function: top_amount
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- -
-
Function: total_expr
-

Return the calculated total of the posting according to the --total -option. -

- -
-
Function: trim value
-

Trim leading and trailing whitespace from value. -

-
$ ledger -f expr.dat --format "»%(trim(' 	Trimmed	 '))«\n" reg assets
-
-
-
»Trimmed«
-
-
- -
-
Function: truncatedstring total_len account_len
-

Truncate string to total_len ensuring that each account is at least -account_len long. -

- -
-
Function: unround
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- -
-
Function: unrounded
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- -
-
Function: value_date
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

- - -
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

12 Format Strings

- - - - - - - - - -
- - - -

12.1 Format String Basics

- - - - - - - - - - - -

Format strings may be used to change the output format of reports. They -are specified by passing a formatting string to the --format -FORMAT_STRING (-F) option. Within that string, constructs are -allowed which make it possible to display the various parts of an -account or posting in custom ways. -

-

There are several additional flags that allow you to define formats -for specific reports. These are useful to define in your configuration -file and will allow you to run ledger reports from the command-line -without having to enter a new format for each command. -

-
    -
  • --balance-format FORMAT_STRING -
  • --budget-format FORMAT_STRING -
  • --cleared-format FORMAT_STRING -
  • --csv-format FORMAT_STRING -
  • --plot-amount-format FORMAT_STRING -
  • --plot-total-format FORMAT_STRING -
  • --pricedb-format FORMAT_STRING -
  • --prices-format FORMAT_STRING -
  • --register-format FORMAT_STRING -
- -
- - - -

12.2 Format String Structure

- -

Within a format string, a substitution is specified using a percent -‘%’ character. The basic format of all substitutions is: -

-
-
%[-][MIN WIDTH][.MAX WIDTH](VALEXPR)
-
- -

If the optional minus sign ‘-’ follows the percent character -‘%’, whatever is substituted will be left justified. The default -is right justified. If a minimum width is given next, the substituted -text will be at least that wide, perhaps wider. If a period and -a maximum width is given, the substituted text will never be wider -than this, and will be truncated to fit. Here are some examples: -

-
-
%-20P
-

A transaction’s payee, left justified and padded to 20 characters wide. -

-
-
%20P
-

The same, right justified, at least 20 chars wide. -

-
-
%.20P
-

The same, no more than 20 chars wide. -

-
-
- -

The expression following the format constraints can be a single letter, -or an expression enclosed in parentheses or brackets. -

-
- - - -

12.3 Format Expressions

- - - -

For demonstration purposes the journal data from expr.dat is used. -The allowable expressions are: -

-
-
%
-

Inserts a percent sign. -

-
$ ledger -f expr.dat --format "%%\n" reg assets
-
-
-
%
-
- -
-
t
-

Inserts the results of the value expression specified by ---amount EXPR (-t). If --amount EXPR (-t) -was not specified, the current report style’s value expression is used. -

-
-
T
-

Inserts the results of the value expression specified by --total -VEXPR (-T). If --total VEXPR (-T) was not -specified, the current report style’s value expression is used. -

-
-
(EXPR)
-

Inserts the amount resulting from the value expression given in -parentheses. To insert five times the total value of an account, for -example, one could say ‘%12(5*O)’. Note: It’s important to put the -five first in that expression, so that the commodity doesn’t get -stripped from the total. -

-
$ ledger -f expr.dat --format "%12(5*O)\n" reg assets
-
-
-
   ¤ -617,25
-
- -
-
[DATEFMT]
-

Inserts the result of formatting a posting’s date with a date format -string, exactly like those supported by strftime (3). For -example: ‘%[%Y/%m/%d %H:%M:%S]’. -

-
-
S
-

Insert the path name of the file from which the transaction’s data was -read. Only sensible in a register report. -

-
$ ledger -f ~/journal.dat --format "%S\n" reg assets
-
-
-
/home/jwiegley/journal.dat
-
- -
-
B
-

Inserts the beginning character position of that transaction within the -file. -

-
$ ledger -f expr.dat --format "%B\n" reg assets
-
-
-
26
-
- -
-
b
-

Inserts the beginning line of that transaction within the file. -

-
$ ledger -f expr.dat --format "%b\n" reg assets
-
-
-
2
-
- -
-
E
-

Inserts the ending character position of that transaction within the -file. -

-
$ ledger -f expr.dat --format "%E\n" reg assets
-
-
-
90
-
- -
-
e
-

Inserts the ending line of that transaction within the file. -

-
$ ledger -f expr.dat --format "%e\n" reg assets
-
-
-
3
-
- -
-
D
-

Returns the date according to the default format. -

-
-
d
-

Returns the date according to the default format. If the transaction -has an effective date, it prints ACTUAL_DATE=EFFECTIVE_DATE. -

-
-
X
-

If a posting has been cleared, this returns a 1, otherwise returns 0. -

-
-
Y
-

This is the same as ‘%X’, except that it only displays a state -character if all of the member postings have the same state. -

-
-
C
-

Inserts the transaction code. This is the value specified between -parentheses on the first line of the transaction. -

-
$ ledger -f expr.dat --format "%C\n" reg assets
-
-
-
(C0D3) 
-
- -
-
P
-

Inserts the payee related to a posting. -

-
$ ledger -f expr.dat --format "%P\n" reg assets
-
-
-
PiggyBank
-
- - -
-
A
-

Inserts the full name of an account. -

-
$ ledger -f expr.dat --format "%A\n" reg
-
-
-
Assets:Cash
-Expenses:Office Supplies
-
- - - -
-
N
-

Inserts the note associated with a posting, if one exists. -

-
$ ledger -f expr.dat --format "%N\n" reg assets
-
-
-
 Payee: PiggyBank
-
- -
-
/
-

The ‘%/’ construct is special. It separates a format string -between what is printed for the first posting of a transaction, and -what is printed for all subsequent postings. If not used, the -same format string is used for all postings. -

-
$ ledger -f expr.dat --format "%P\n%/%A\n" reg
-
-
-
PiggyBank
-Expenses:Office Supplies
-
- -
-
- -
- - - -

12.4 Balance format

- - - -

As an example of how flexible the --format FORMAT_STRING -strings can be, the default balance format looks like this (the various -functions are described later): -

-
-
"%(justify(scrub(display_total), 20, -1, true, color))"
-"  %(!options.flat ? depth_spacer : \"\")"
-"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
-"%$1\n%/"
-"--------------------\n"
-
- -
- -
-

-Previous: , Up: Format Strings   [Contents][Index]

-
- -

12.5 Formatting Functions and Codes

- - - - - - - - - - - -
- - - -

12.5.1 Field Widths

- -

The following codes return the width allocated for the specific fields. -The defaults can be changed using the corresponding command-line -options: -

-
    -
  • date_width -
  • payee_width -
  • account_width -
  • amount_width -
  • total_width -
- -
- - - -

12.5.2 Colors

- -

The character-based formatting ledger can do is limited to the ANSI -terminal character colors and font highlights in a normal TTY session. -

- - - - - -
redmagentabold
greencyanunderline
yellowwhiteblink
blueblack
- -
- - - -

12.5.3 Quantities and Calculations

- -
-
amount_expr
-
abs
-
commodity
-
display_amount
-
display_total
-
floor
-
get_at
-
is_seq
-
market
-
percent
-
price
-
quantity
-
rounded
-
truncated
-
total_expr
-
top_amount
-
to_boolean
-
to_int
-
to_amount
-
to_balance
-
unrounded
-
- -
- - - -

12.5.4 Date Functions

- - -

The following functions allow you to manipulate and format dates. -

-
-
date
-

Return the date of the current transaction. -

-
-
format_date(date, "FORMAT_STRING")
-

Format the date using the given format string. -

-
-
now
-

Return the current date and time. If the --now DATE -option is defined it will return that value. -

-
-
today
-

Return the current date. If the --now DATE option is -defined it will return that value. -

-
-
to_datetime
-

Convert a string to a date-time value. -

-
-
to_date
-

Convert a string to date value. -

-
-
value_date
-
- - - - - -
- - - -

12.5.5 Date and Time Format Codes

- -

Date and time format are specified as strings of single letter codes -preceded by percent signs. Any separator, or no separator can be -specified. -

- - - - - - - -
- - - -

12.5.5.1 Days

- -

Dates are formed from a combination of day, month and year codes, in -whatever order you prefer: -

-
-
%Y
-

Four digit year. -

-
-
%y
-

Two digit year. -

-
-
%m
-

Two digit month. -

-
-
%d
-

Two digit date. -

-
-
- -

So "%Y%m%d" yields ‘20111214’ which provides a date that -is simple to sort on. -

-
- -
-

-Next: , Previous: , Up: Date and Time Format Codes   [Contents][Index]

-
- -

12.5.5.2 Weekdays

- -

You can have additional weekday information in your date with ‘%A’ -as -

-
-
%m-%d-%Y %A
-

yields ‘02-10-2010 Wednesday’. -

-
-
%A %m-%d-%Y
-

yields ‘Wednesday 02-10-2010’. -

-
-
- -

These are options you can select for weekday -

-
-
%a
-

weekday, abbreviated Wed. -

-
-
%A
-

weekday, full Wednesday. -

-
-
%d
-

day of the month (dd), zero padded up to 10. -

-
-
%e
-

day of the month (dd), no leading zero up to 10. -

-
-
%j
-

day of year, zero padded 000–366. -

-
-
%u
-

day of week starting with Monday (1), i.e. mtwtfss 3. -

-
-
%w
-

day of week starting with Sunday (0), i.e. smtwtfs 3. -

-
-
- -
- - - -

12.5.5.3 Month

- -

You can have additional month information in your date with ‘%B’ -as -

-
-
%m-%d-%Y %B
-

yields ‘02-10-2010 February’. -

-
-
%B %m-%d-%Y
-

yields ‘February 02-10-2010’. -

-
-
- -

These are options you can select for month -

-
-
%m
-

mm’ month as two digits. -

-
-
%b
-

Locale’s abbreviated month, for example ‘02’ might be abbreviated -as ‘Feb’. -

-
-
%B
-

Locale’s full month, variable length, e.g. February. -

-
-
- -
- -
-

-Previous: , Up: Date and Time Format Codes   [Contents][Index]

-
- -

12.5.5.4 Miscellaneous Date Codes

- -

Additional date format parameters which can be used: -

-
-
%U
-

week number Sunday as first day of week, ranging 01–53. -

-
-
%W
-

week number Monday as first day of week, ranging 01–53. -

-
-
%V
-

week of the year, ranging 01–53. -

-
-
%C
-

century, ranging 00–99. -

-
-
%D
-

yields %m/%d/%y as in ‘02/10/10’. -

-
-
%x
-

locale’s date representation, as ‘02/10/2010’ for the U.S. -

-
-
%F
-

yields %Y-%m-%d as in ‘2010-02-10’. -

-
-
- -
- - - -

12.5.6 Text Formatting

- -

The following format functions allow you limited formatting of text: -

-
-
ansify_if(value, color)
-

Surrounds the string representing value with ANSI codes to give it -color on an TTY display. Has no effect if directed to a file. -

-
-
justify(value, first_width, latter_width, right_justify, colorize)
-

Right or left justify the string representing value. The width -of the field in the first line is given by first_width. For -subsequent lines the width is given by latter_width. If -latter_width=-1, then first_width is use for all lines. -If right_justify=true then the field is right justify within -the width of the field. If it is false, then the field is left -justified and padded to the full width of the field. If -colorize is true, then ledger will honor color settings. -

-
-
join(STR)
-

Replaces line feeds in STR with ‘\n’. -

-
-
quoted(STR)
-

Return STR surrounded by double quotes, ‘"STR"’. -

-
-
strip(value)
-

Values can have numerous annotations, such as effective dates and lot -prices. strip removes these annotations. -

-
-
- -
- - - -

12.5.7 Data File Parsing Information

- -

The following format strings provide locational metadata -regarding the coordinates of entries in the source data file(s) that -generated the posting. -

-
-
filename
-

the name of the ledger data file from whence the posting came, -abbreviated ‘S’. -

-
-
beg_pos
-

character position in filename where entry for posting begins, -abbreviated ‘B’. -

-
-
end_pos
-

character position in filename where entry for posting ends, -abbreviated ‘E’. -

-
-
beg_line
-

line number in filename where entry for posting begins, -abbreviated ‘b’. -

-
-
end_line
-

line number in filename where entry for posting ends, -abbreviated ‘e’. -

-
-
- -
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

13 Extending with Python

- -

Python can be used to extend your Ledger experience. But first, -a word must be said about Ledger’s data model, so that other things -make sense later. -

- - - - - - - - -
- - - -

13.1 Basic data traversal

- -

Every interaction with Ledger happens in the context of a Session. -Even if you don’t create a session manually, one is created for you by -the top-level interface functions. The Session is where objects live -like the Commodities that Amounts refer to. -

-

To make a Session useful, you must read a Journal into it, using the -function ‘read_journal‘. This reads Ledger data from the given -file, populates a Journal object within the current Session, and -returns a reference to that Journal object. -

-

Within the Journal live all the Transactions, Postings, and other -objects related to your data. There are also AutomatedTransactions -and PeriodicTransactions, etc. -

-

Here is how you would traverse all the postings in your data file: -

-
-
import ledger
-
-for xact in ledger.read_journal("sample.dat").xacts():
-    for post in xact.posts():
-        print "Transferring %s to/from %s" % (post.amount, post.account)
-
- -
- - - -

13.2 Raw versus Cooked

- -

Ledger data exists in one of two forms: raw and cooked. Raw objects are -what you get from a traversal like the above, and represent exactly what -was seen in the data file. Consider this journal: -

-
-
= true
-    (Assets:Cash)    $100
-
-2012-03-01 KFC
-    Expenses:Food    $100
-    Assets:Credit
-
- -

In this case, the raw regular transaction in this file is: -

-
-
2012-03-01 KFC
-    Expenses:Food    $100
-    Assets:Credit
-
- -

While the cooked form is: -

-
-
2012-03-01 KFC
-    Expenses:Food    $100
-    Assets:Credit   $-100
-    (Assets:Cash)    $100
-
- -

So the easy way to think about raw vs. cooked is that raw is the -unprocessed data, and cooked has had all considerations applied. -

-

When you traverse a Journal by iterating over its transactions, you are -generally looking at raw data. In order to look at cooked data, you -must generate a report of some kind by querying the journal: -

-
-
for post in ledger.read_journal("sample.dat").query("food"):
-    print "Transferring %s to/from %s" % (post.amount, post.account)
-
- -

The reason why queries iterate over postings instead of transactions is -that queries often return only a “slice” of the transactions they -apply to. You can always get at a matching posting’s transaction by -looking at its xact member: -

-
-
last_xact = None
-for post in ledger.read_journal("sample.dat").query(""):
-    if post.xact != last_xact:
-        for post in post.xact.posts():
-            print "Transferring %s to/from %s" % (post.amount,
-            post.account)
-        last_xact = post.xact
-
- -

This query ends up reporting every cooked posting in the Journal, but -does it transaction-wise. It relies on the fact that an unsorted report -returns postings in the exact order they were parsed from the journal -file. -

-
- - - -

13.3 Queries

- -

The Journal.query() method accepts every argument you can specify on the -command-line, including --options. -

-

Since a query “cooks” the journal it applies to, only one query may be -active for that journal at a given time. Once the query object is gone -(after the for loop), then the data reverts back to its raw state. -

-
- -
-

-Next: , Previous: , Up: Extending with Python   [Contents][Index]

-
- -

13.4 Embedded Python

- -

You can embed Python into your data files using the ’python’ directive: -

-
-
python
-    import os
-    def check_path(path_value):
-        print "%s => %s" % (str(path_value), os.path.isfile(str(path_value)))
-        return os.path.isfile(str(path_value))
-
-tag PATH
-    assert check_path(value)
-
-2012-02-29 KFC
-    ; PATH: somebogusfile.dat
-    Expenses:Food                $20
-    Assets:Cash
-
- -

Any Python functions you define this way become immediately available as -valexpr functions. -

-
- - - -

13.5 Amounts

- -

When numbers come from Ledger, like post.amount, the type of the value -is Amount. It can be used just like an ordinary number, except that -addition and subtraction are restricted to amounts with the same -commodity. If you need to create sums of multiple commodities, use -a Balance. For example: -

-
-
total = Balance()
-for post in ledger.read_journal("sample.dat").query(""):
-    total += post.amount
-print total
-
- -
- - - -

14 Ledger for Developers

- - - - - - - - -
- - - -

14.1 Internal Design

- -

Ledger is developed as a tiered set of functionality, where lower tiers -know nothing about the higher tiers. In fact, multiple libraries are -built during the development the process, and link unit tests to these -libraries, so that it is a link error for a lower tier to violate this -modularity. -

-

Those tiers are: -

-
    -
  • Utility code - -

    There’s lots of general utility in Ledger for doing time parsing, using -Boost.Regex, error handling, etc. It’s all done in a way that can be -reused in other projects as needed. -

    -
  • Commoditized Amounts (amount_t, commodity_t and friends) - -

    A numerical abstraction combining multi-precision rational numbers (via -GMP) with commodities. These structures can be manipulated like regular -numbers in either C++ or Python (as Amount objects). -

    -
  • Commodity Pool - -

    Commodities are all owned by a commodity pool, so that future parsing of -amounts can link to the same commodity and established a consistent -price history and record of formatting details. -

    -
  • Balances - -

    Adds the concept of multiple amounts with varying commodities. Supports -simple arithmetic, and multiplication and division with non-commoditized -values. -

    -
  • Price history - -

    Amounts have prices, and these are kept in a data graph which the amount -code itself is only dimly aware of (there’s three points of access so an -amount can query its revalued price on a given date). -

    -
  • Values - -

    Often the higher layers in Ledger don’t care if something is an amount -or a balance, they just want to add stuff to it or print it. For this, -I created a type-erasure class, value_t/Value, into which many things -can be stuffed and then operated on. They can contain amounts, -balances, dates, strings, etc. If you try to apply an operation between -two values that makes no sense (like dividing an amount by a balance), -an error occurs at runtime, rather than at compile-time (as would happen -if you actually tried to divide an amount_t by -a balance_t). -

    -

    This is the core data type for the value expression language. -

    -
  • Value expressions - -

    The next layer up adds functions and operators around the Value concept. -This lets you apply transformations and tests to Values at runtime -without having to bake it into C++. The set of functions available is -defined by each object type in Ledger (posts, accounts, transactions, -etc.), though the core engine knows nothing about these. At its base, -it only knows how to apply operators to values, and how to pass them to -and receive them from functions. -

    -
  • Query expressions - -

    Expressions can be onerous to type at the command-line, so there’s -a shorthand for reporting called “query expressions”. These add no -functionality of their own, but are purely translated from the input -string down to the corresponding value expression, for example the -input string ‘cash’ is translated to ‘(account -=~ /cash/)’. This is a convenience layer. -

    -
  • Format strings - -

    Format strings let you interpolate value expressions into strings, with -the requirement that any interpolated value have a string -representation. Really all this does is calculate the value expression -in the current report context, call the resulting value’s -to_string() method, and stuffs the result into the output string. -It also provides printf-like behavior, such as min/max width, right/left -justification, etc. -

    -
  • Journal items - -

    Next is a base type shared by anything that can appear in a journal: an -item_t. It contains details common to all such parsed entities, like -what file and line it was found on, etc. -

    -
  • Journal posts - -

    The most numerous object found in a Journal, postings are a type of item -that contain an account, an amount, a cost, and metadata. There are -some other complications, like the account can be marked virtual, the -amount could be an expression, etc. -

    -
  • Journal transactions - -

    Postings are owned by transactions, always. This subclass of item_t -knows about the date, the payee, etc. If a date or metadata tag is -requested from a posting and it doesn’t have that information, the -transaction is queried to see if it can provide it. -

    -
  • Journal accounts - -

    Postings are also shared by accounts, though the actual memory is -managed by the transaction. Each account knows all the postings within -it, but contains relatively little information of its own. -

    -
  • The Journal object - -

    Finally, all transactions with their postings, and all accounts, are -owned by a journal_t object. This is the go-to object for -querying and reporting on your data. -

    -
  • Textual journal parser - -

    There is a textual parser, wholly contained in textual.cc, which -knows how to parse text into journal objects, which then get -“finalized” and added to the journal. Finalization is the step that -enforces the double-entry guarantee. -

    -
  • Iterators - -

    Every journal object is “iterable”, and these iterators are defined in -iterators.h and iterators.cc. This iteration logic is kept out of the -basic journal objects themselves for the sake of modularity. -

    -
  • Comparators - -

    Another abstraction isolated to its own layer, this class encapsulating -the comparison of journal objects, based on whatever value expression -the user passed to --sort VEXPR. -

    -
  • Temporaries - -

    Many reports bring pseudo-journal objects into existence, like postings -which report totals in a ‘Total’ account. These objects are -created and managed by a temporaries_t object, which gets used in -many places by the reporting filters. -

    -
  • Option handling - -

    There is an option handling subsystem used by many of the layers further -down. It makes it relatively easy for me to add new options, and to -have those option settings immediately accessible to value expressions. -

    -
  • Session objects - -

    Every journal object is owned by a session, with the session providing -support for that object. In GUI terms, this is the Controller object -for the journal Data object, where every document window would be -a separate session. They are all owned by the global scope. -

    -
  • Report objects - -

    Every time you create any report output, a report object is created to -determine what you want to see. In the Ledger REPL, a new report object -is created every time a command is executed. In CLI mode, only one -report object ever comes into being, as Ledger immediately exits after -displaying the results. -

    -
  • Reporting filters - -

    The way Ledger generates data is this: it asks the session for the -current journal, and then creates an iterator applied to that journal. -The kind of iterator depends on the type of report. -

    -

    This iterator is then walked, and every object yielded from the iterator -is passed to an “item handler”, whose type is directly related to the -type of the iterator. -

    -

    There are many, many item handlers, which can be chained together. Each -one receives an item (post, account, xact, etc.), performs some action -on it, and then passes it down to the next handler in the chain. There -are filters which compute the running totals; that queue and sort all -the input items before playing them back out in a new order; that filter -out items which fail to match a predicate, etc. Almost every reporting -feature in Ledger is related to one or more filters. Looking at -filters.h, there are over 25 of them defined currently. -

    -
  • The filter chain - -

    How filters get wired up, and in what order, is a complex process based -on all the various options specified by the user. This is the job of -the chain logic, found entirely in chain.cc. It took a really -long time to get this logic exactly right, which is why I haven’t -exposed this layer to the Python bridge yet. -

    -
  • Output modules - -

    Although filters are great and all, in the end you want to see stuff. -This is the job of special “leaf” filters called output modules. They -are implemented just like a regular filter, but they don’t have -a “next” filter to pass the data on down to. Instead, they are the -end of the line and must do something with the item that results in the -user seeing something on their screen or in a file. -

    -
  • Select queries - -

    Select queries know a lot about everything, even though they implement -their logic by implementing the user’s query in terms of all the other -features thus presented. Select queries have no functionality of their -own, they are simple a shorthand to provide access to much of Ledger’s -functionality via a cleaner, more consistent syntax. -

    -
  • The Global Scope - -

    There is a master object which owns every other objects, and this is -Ledger’s global scope. It creates the other objects, provides REPL -behavior for the command-line utility, etc. In GUI terms, this is the -Application object. -

    -
  • The Main Driver - -

    This creates the global scope object, performs error reporting, and -handles command-line options which must precede even the creation of the -global scope, such as --debug CODE. -

    -
- -

And that’s Ledger in a nutshell. All the rest are details, such as -which value expressions each journal item exposes, how many filters -currently exist, which options the report and session scopes define, -etc. -

-
- - - -

14.2 Journal File Format for Developers

- -

This chapter offers a complete description of the journal data format, -suitable for implementers in other languages to follow. For users, the -chapter on keeping a journal is less extensive, but more typical of -common usage (see Keeping a Journal). -

-

Data is collected in the form of transactions which occur in one -or more journal files. Each transaction, in turn, is made up of -one or more postings, which describe how amounts flow from -one account to another. Here is an example of the simplest of -journal files: -

-
-
2010/05/31 Just an example
-    Expenses:Some:Account                $100.00
-    Income:Another:Account
-
- -

In this example, there is a transaction date, a payee, or description of -the transaction, and two postings. The postings show movement of one -hundred dollars from an account within the Income hierarchy, to the -specified expense account. The name and meaning of these accounts is -arbitrary, with no preferences implied, although you will find it useful -to follow standard accounting practices (see Principles of Accounting with Ledger). -

-

Since an amount is missing from the second posting, it is assumed to be -the inverse of the first. This guarantees the cardinal rule of -double-entry accounting: the sum of every transaction must balance to -zero, or it is in error. Whenever Ledger encounters a null -posting in a transaction, it uses it to balance the remainder. -

-

It is also typical, though not enforced, to think of the first posting -as the destination, and the final as the source. Thus, the amount of -the first posting is typically positive. Consider: -

-
-
2010/05/31 An income transaction
-    Assets:Checking       $1,000.00
-    Income:Salary
-
-2010/05/31 An expense transaction
-    Expenses:Dining         $100.00
-    Assets:Checking
-
- - - - - - - - -
- - - -

14.2.1 Comments and meta-data

- -

Comments are generally started using a ‘;’. However, in order to -increase compatibility with other text manipulation programs and methods -three additional comment characters are valid if used at the beginning -of a line: ‘#’, ‘|’, and ‘*’. -

-
- - - -

14.2.2 Specifying Amounts

- - -

The heart of a journal is the amounts it records, and this fact is -reflected in the diversity of amount expressions allowed. All of them -are covered here, though it must be said that sometimes, there are -multiple ways to achieve a desired result. -

-

Note: It is important to note that there must be at least two -spaces between the end of the account and the beginning of the amount -(including a commodity designator). -

- - - - - -
- - - -

14.2.2.1 Integer Amounts

- -

In the simplest form, bare decimal numbers are accepted: -

-
-
2010/05/31 An income transaction
-    Assets:Checking        1000.00
-    Income:Salary
-
- - -

Such amounts may only use an optional period for a decimal point. These -are referred to as integer amounts or uncommoditized -amounts. In most ways they are similar to commoditized amounts, -but for one significant difference: They always display in reports with -full precision. More on this in a moment. For now, a word must -be said about how Ledger stores numbers. -

-

Every number parsed by Ledger is stored internally as an -infinite-precision rational value. Floating-point math is never used, -as it cannot be trusted to maintain precision of values. So, in the -case of ‘1000.00’ above, the internal value is ‘100000/100’. -

-

While rational numbers are great at not losing precision, the question -arises: How should they be displayed? A number like ‘100000/100’ -is no problem, since it represents a clean decimal fraction. But what -about when the number ‘1/1’ is divided by three? How should one -print ‘1/3’, an infinitely repeating decimal? -

-

Ledger gets around this problem by rendering rationals into decimal at -the last possible moment, and only for display. As such, some -rounding must, at times, occur. If this rounding would affect the -calculation of a running total, special accommodation postings are -generated to make you aware it has happened. In practice, it happens -rarely, but even then it does not reflect adjustment of the -internal amount, only the displayed amount. -

-

What has still not been answered is how Ledger rounds values. Should -‘1/3’ be printed as ‘0.33’ or ‘0.33333’? For -commoditized amounts, the number of decimal places is decided by -observing how each commodity is used; but in the case of integer -amounts, an arbitrary factor must be chosen. Initially, this factor -is six. Thus, ‘1/3’ is printed back as ‘0.333333’. -Further, this rounding factor becomes associated with each particular -value, and is carried through mathematical operations. For example, -if that particular number were multiplied by itself, the decimal -precision of the result would be twelve. Addition and subtraction do -not affect precision. -

-

Since each integer amount retains its own display precision, this is -called full precision, as opposed to commoditized amounts, which -always look to their commodity to know what precision they should -round to, and so use commodity precision. -

-
- - - -

14.2.2.2 Commoditized Amounts

- -

A commoditized amount is an integer amount which has an -associated commodity. This commodity can appear before or after the -amount, and may or may not be separated from it by a space. Most -characters are allowed in a commodity name, except for the following: -

-
    -
  • Any kind of white-space -
  • Numerical digits -
  • Punctuation: .,;:?! -
  • Mathematical and logical operators: -+*/^&|= -
  • Bracketing characters: <>[](){} -
  • The at symbol: @ -
- -

And yet, any of these may appear in a commodity name if it is -surrounded by double quotes, for example: -

-
-
100 "EUN+133"
-
- -

If a quoted commodity is found, it is displayed in quotes as -well, to avoid any confusion as to which part is the amount, and which -part is the commodity. -

-

Another feature of commoditized amounts is that they are reported back -in the same form as parsed. If you specify dollar amounts using -‘$100’, they will print the same; likewise with ‘100 $’ or -‘$100.000’. You may even use decimal commas, such as -‘$100,00’, or thousand-marks, as in ‘$10,000.00’. -

-

These display characteristics become associated with the commodity, -with the result being that all amounts of the same commodity are -reported consistently. Where this is most noticeable is the -display precision, which is determined by the most precise value -seen for a given commodity—in most cases. -

-

Ledger makes a distinction between observed amounts and -unobserved amounts. An observed amount is critiqued by Ledger to -determine how amounts using that commodity should be displayed; -unobserved amounts are significant in their value only—no matter how -they are specified, it does not change how other amounts in that -commodity will be displayed. -

-

An example of this is found in cost expressions, covered next. -

-
- - - -

14.2.3 Posting costs

- -

You have seen how to specify either a commoditized or an integer -amount for a posting. But what if the amount you paid for something -was in one commodity, and the amount received was another? There are -two main ways to express this: -

-
-
2010/05/31 Farmer's Market
-    Assets:My Larder           100 apples
-    Assets:Checking                -$20.00
-
- -

In this example, you have paid twenty dollars for one hundred apples. -The cost to you is twenty cents per apple, and Ledger calculates this -implied cost for you. You can also make the cost explicit using a -cost amount: -

-
-
2010/05/31 Farmer's Market
-    Assets:My Larder           100 apples @ $0.200000
-    Assets:Checking
-
- -

Here the per-unit cost is given explicitly in the form of a cost -amount; and since cost amounts are unobserved, the use of six -decimal places has no effect on how dollar amounts are displayed in -the final report. You can also specify the total cost: -

-
-
2010/05/31 Farmer's Market
-    Assets:My Larder           100 apples @@ $20
-    Assets:Checking
-
- -

These three forms have identical meaning. In most cases the first is -preferred, but the second two are necessary when more than two -postings are involved: -

-
-
2010/05/31 Farmer's Market
-    Assets:My Larder           100 apples        @ $0.200000
-    Assets:My Larder           100 pineapples    @ $0.33
-    Assets:My Larder           100 "crab apples" @ $0.04
-    Assets:Checking
-
- -

Here the implied cost is ‘$57.00’, which is entered into the null -posting automatically so that the transaction balances. -

-
- - - -

14.2.4 Primary commodities

- - - -

In every transaction involving more than one commodity, there is -always one which is the primary commodity. This commodity -should be thought of as the exchange commodity, or the commodity used -to buy and sell units of the other commodity. In the fruit examples -above, dollars are the primary commodity. This is decided by Ledger -based on the placement of the commodity in the transaction: -

-
-
2010/05/31 Sample Transaction
-    Expenses               100 secondary
-    Assets                  -50 primary
-
-2010/05/31 Sample Transaction
-    Expenses               100 secondary @ 0.5 primary
-    Assets
-
-2010/05/31 Sample Transaction
-    Expenses               100 secondary @@ 50 primary
-    Assets
-
- -

The only case where knowledge of primary versus secondary comes into -play is in reports that use the --market (-V) or ---basis (-B) options. With these, only primary commodities are -shown. -

-

If a transaction uses only one commodity, this commodity is also -considered a primary. In fact, when Ledger goes about ensuring that -all transactions balance to zero, it only ever asks this of primary -commodities. -

-
- - - -

14.3 Developer Commands

- - - - - - - - - -
- -
-

-Next: , Previous: , Up: Developer Commands   [Contents][Index]

-
- -

14.3.1 echo

- - -

This command simply echoes its argument back to the output. -

-
- -
-

-Next: , Previous: , Up: Developer Commands   [Contents][Index]

-
- -

14.3.2 reload

- - -

Forces ledger to reload any journal files. This function exists to -support external programs controlling a running ledger process and does -nothing for a command-line user. -

-
- -
-

-Next: , Previous: , Up: Developer Commands   [Contents][Index]

-
- -

14.3.3 source

- - -

The source command takes a journal file as an argument and -parses it checking for errors; no other reports are generated, and no -other arguments are necessary. Ledger will return success if no errors -are found. -

-
- -
-

-Next: , Previous: , Up: Developer Commands   [Contents][Index]

-
- -

14.3.4 Debug Options

- -

These options are primarily for Ledger developers, but may be of some -use to a user trying something new. -

-
-
--args-only - -
-

Ignore init files and environment variables for the ledger run. -

-
-
--debug CODE - -
-

If Ledger has been built with debug options this will provide extra -data during the run. The following are the available CODES to -debug: -

- - - - - - - - - - - - - - - - - - - - - - - - - - -
account.displaydraft.xactoption.names
account.sortedexpr.calcorg.next_amount
amount.commoditiesexpr.compileorg.next_total
amount.convertexpr.merged.compileparser.error
amount.is_zerofilters.changed_valuepool.commodities
amount.parsefilters.changed_value.roundingpost.assign
amount.pricefilters.collapsepython.init
amount.refsfilters.forecastpython.interp
amount.roundtofilters.intervalquery.mask
amount.truncatefilters.revaluedreport.predicate
amount.unroundformat.abbrevscope.search
annotate.lessformat.exprscope.symbols
archive.journalgenerate.postselect.parse
auto.columnsgenerate.post.stringtextual.include
budget.generatehistory.findtextual.parse
commodity.annotated.striphistory.maptimelog
commodity.annotationsitem.metatimes.epoch
commodity.compareledger.readtimes.interval
commodity.downloadledger.validatetimes.parse
commodity.exchangelookupvalue.sort
commodity.price.findlookup.accountvalue.storage.refcount
commodity.prices.addmask.matchxact.extend
commodity.prices.findmemory.debugxact.extend.cleared
csv.mappingsop.memoryxact.extend.fail
csv.parseoption.argsxact.finalize
-

 

-
-
--trace INT - -
-

Enable tracing. The INT specifies the level of trace desired: -

- - - - - - - - - - - - - -
LOG_OFF0
LOG_CRIT1
LOG_FATAL2
LOG_ASSERT3
LOG_ERROR4
LOG_VERIFY5
LOG_WARN6
LOG_INFO7
LOG_EXCEPT8
LOG_DEBUG9
LOG_TRACE10
LOG_ALL11
-

 

-
-
--verbose - -
-
-v - -
-

Print detailed information on the execution of Ledger. -

-
-
--verify - -
-

Enable additional assertions during run-time. This causes a significant -slowdown. When combined with --debug CODE ledger will -produce memory trace information. -

-
-
--verify-memory - -
-

Verify that every constructed object is properly destructed. This is for -debugging purposes only. -

-
-
--version - -
-

Print version information and exit. -

-
-
- -
- -
-

-Previous: , Up: Developer Commands   [Contents][Index]

-
- -

14.3.5 Pre-Commands

- - -

Pre-commands are useful when you aren’t sure how a command or option -will work. The difference between a pre-command and a regular command -is that pre-commands ignore the journal data file completely, nor is -the user’s init file read. -

-
-
eval VEXPR - -
-

Evaluate the given value expression against the model transaction. -

-
-
format FORMAT_STRING - -
-

Print details of how ledger uses the given formatting description and -apply it against a model transaction. -

-
-
generate - -
-

Randomly generates syntactically valid Ledger data from a seed. Used -by the ‘GenerateTests’ harness for development testing. -

-
-
parse VEXPR - -
-
expr VEXPR - -
-

Print details of how ledger uses the given value expression description -and apply it against a model transaction. -

-
-
period PERIOD_EXPRESSION - -
-

Evaluate the given period and report how Ledger interprets it: -

-
-
$ ledger period "this year"  --now 2011-01-01
-
-
-
--- Period expression tokens ---
-TOK_THIS: this
-TOK_YEAR: year
-END_REACHED: <EOF>
-
---- Before stabilization ---
-   range: in year 2011
-
---- After stabilization ---
-   range: in year 2011
-   start: 11-Jan-01
-  finish: 12-Jan-01
-
---- Sample dates in range (max. 20) ---
- 1: 11-Jan-01
-
- -
-
query - -
-
args - -
-

Evaluate the given arguments and report how Ledger interprets it against -the following model transaction: -

-
-
$ ledger query "/Book/"
-
-
-
--- Input arguments ---
-("/Book/")
-
---- Context is first posting of the following transaction ---
-2004/05/27 Book Store
-    ; This note applies to all postings. :SecondTag:
-    Expenses:Books                 20 BOOK @ $10
-    ; Metadata: Some Value
-    ; Typed:: $100 + $200
-    ; :ExampleTag:
-    ; Here follows a note describing the posting.
-    Liabilities:MasterCard        $-200.00
-
---- Input expression ---
-(account =~ /Book/)
-
---- Text as parsed ---
-(account =~ /Book/)
-
---- Expression tree ---
-0x7fd639c0da40    O_MATCH (1)
-0x7fd639c10170     IDENT: account (1)
-0x7fd639c10780     VALUE: /Book/ (1)
-
---- Compiled tree ---
-0x7fd639c10520    O_MATCH (1)
-0x7fd639c0d6c0     IDENT: account (1)
-0x7fd639c0d680      FUNCTION (1)
-0x7fd639c10780     VALUE: /Book/ (1)
-
---- Calculated value ---
-true
-
- -
-
script - -
-

UNDOCUMENTED! Please help by contributing documentation for this feature. -

-
-
template - -
-

Shows the insertion template that the xact sub-command -generates. This is a debugging command. -

-
-
- -
- - - -

14.4 Ledger Development Environment

- - - - - - -
- - - -

14.4.1 acprep build configuration tool

- -
- - - -

14.4.2 Testing Framework

- -

Ledger source ships with a fairly complete set of tests to verify that -all is well, and no old errors have resurfaced. Tests are run -individually with ctest. All tests can be run using make -check or ninja check depending on which build tool you prefer. -

-

Once built, the ledger executable resides under the build -subdirectory in the source tree. Tests are built and stored in the -test subdirectory for the build. For example, -~/ledger/build/ledger/opt/test. -

- - - - - -
- - - -

14.4.2.1 Running Tests

- -

The complete test suite can be run from the build directory using the -check option for the build tool you use. For example, make -check. The entire test suit lasts around a minute for the optimized -built and many times longer for the debug version. While developing -and debugging, running individual tests can save a great deal of time. -

-

Individual tests can be run from the test subdirectory of the -build location. To execute a single test use ctest -V -R regex, -where the regex matches the name of the test you want to build. -

-

There are nearly 300 tests stored under the test subdirectory -in the main source distribution. They are broken into two broad -categories, baseline and regression. To run the 5FBF2ED8 test, -for example, issue ctest -V -R "5FB". -

-
- -
-

-Previous: , Up: Testing Framework   [Contents][Index]

-
- -

14.4.2.2 Writing Tests

- -

To write a new test first decide to which broad category the test belongs: -baseline or regression. Depending on the category tests are named differently -baseline tests are prefixed with their type, e.g. ‘cmd’ -(see Baseline Test Types for valid types), whereas regressions are either -named after the bug id, e.g. ‘1234.test’ or uuid ‘91416D62.test’. -In case several test files belong to the same bug number the files by appending -_X where ‘X’ is the number of the test, e.g. ‘1234_1.test’, -‘1234_2.test’. -

-

Baseline Test Types: -

-
cmd
-

Ledger commands like register or balance -

-
dir
-

Ledger directives like account or alias -

-
feat
-

Ledger features such as balance assertions in journal file -

-
opt
-

Ledger options such as --period or --format -

-
- -

A ledger test file contains three sections: -

-
    -
  1. the journal data used for the test, this can be empty in certain -scenarios -
  2. the ledger command-line options used for the test -
  3. the expected output -
- -

Ledger has a special command directive for tests, everything between -test and end test is treated like a comment, so every -Ledger test is automatically a valid Ledger file. -The test scripts take the remainder of the test line and use -it as command-line arguments for ledger, the text enclosed in test -and end test is expected output, for example: -

-
-
; This is the journal data
-year 2014
-12/24 (C0d3) Santa Claus
-  Assets:Bank         ¤ -150,00
-  Expenses:Presents
-
-; The following line specifies the ledger command-line options for this test and
-; everything between the next line and `end test` specifies the expected output
-test reg --payee=code
-14-Dec-24 C0d3                  Assets:Bank               ¤ -150,00    ¤ -150,00
-14-Dec-24 C0d3                  Expenses:Presents          ¤ 150,00            0
-end test
-
- -

When it is necessary to test for errors printed to stderr redirect -the test output by adding -> to the test line and match the -expected error text in an __ERROR__ section: -

-
-
2014/01/01 * Acme Corporation
-  Assets:Bank:Checking      ¤  1.000,00
-  [Fund:Vacation]           ¤    300,00
-  [Fund:Studies]            ¤    600,00
-  Income:Salary             ¤ -2.000,00
-
-test reg ->
-__ERROR__
-While parsing file "$FILE", line 5:
-While balancing transaction from "$FILE", lines 1-5:
-> 2014/01/01 * Acme Corporation
->   Assets:Bank:Checking      ¤  1.000,00
->   [Fund:Vacation]           ¤    300,00
->   [Fund:Studies]            ¤    600,00
->   Income:Salary             ¤ -2.000,00
-Unbalanced remainder is:
-           ¤ -100,00
-Amount to balance against:
-          ¤ 1.900,00
-Error: Transaction does not balance
-end test
-
- -

A special $FILE variable can be used to match the journal filename -used during the test. -

-

To add new tests to the test suite use the rebuild_cache option for the -build tool you use, for example make rebuild_cache, now the -new tests can be run as documented in Running Tests. -

-
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

15 Major Changes from version 2.6

- -

The following have been removed from Ledger 3.0: -

-
    -
  • OFX support. - -
  • GnuCash file import. - -
  • The option --performance (-g). - -
  • The balance report now defaults to showing all relevant accounts. This -is the opposite of 2.x. That is, bal in 3.0 does what ‘-s -bal’ did in 2.x. To see 2.6 behavior, use --collapse (-n) -option in 3.0, like ‘bal -n’. The --subtotal (-s) option -no longer has any effect on balance reports. - -
- -

The following are deprecated in Ledger 3.0: -

-
    -
  • Single character value expressions are deprecated and should be changed -to the new value expressions available in 3.0 - -
  • The following environment variables have been renamed in Ledger 3.0: -
    -
    LEDGER
    -

    is now LEDGER_FILE, -

    -
    LEDGER_INIT
    -

    is now LEDGER_INIT_FILE, -

    -
    PRICE_HIST
    -

    is now LEDGER_PRICE_DB, -

    -
    PRICE_EXP
    -

    is now LEDGER_PRICE_EXP. -

    -
    - -
- -
- - - -

Appendix A Example Journal File

- -

The following journal file is included with the source distribution of -ledger. It is called drewr3.dat and exhibits many ledger -features, include automatic and virtual transactions, -

-
-
; -*- ledger -*-
-
-= /^Income/
-  (Liabilities:Tithe)                    0.12
-
-;~ Monthly
-;  Assets:Checking                     $500.00
-;  Income:Salary
-
-;~ Monthly
-;   Expenses:Food  $100
-;   Assets
-
-2010/12/01 * Checking balance
-  Assets:Checking                   $1,000.00
-  Equity:Opening Balances
-
-2010/12/20 * Organic Co-op
-  Expenses:Food:Groceries             $ 37.50  ; [=2011/01/01]
-  Expenses:Food:Groceries             $ 37.50  ; [=2011/02/01]
-  Expenses:Food:Groceries             $ 37.50  ; [=2011/03/01]
-  Expenses:Food:Groceries             $ 37.50  ; [=2011/04/01]
-  Expenses:Food:Groceries             $ 37.50  ; [=2011/05/01]
-  Expenses:Food:Groceries             $ 37.50  ; [=2011/06/01]
-  Assets:Checking                   $ -225.00
-
-2010/12/28=2011/01/01 Acme Mortgage
-  Liabilities:Mortgage:Principal    $  200.00
-  Expenses:Interest:Mortgage        $  500.00
-  Expenses:Escrow                   $  300.00
-  Assets:Checking                  $ -1000.00
-
-2011/01/02 Grocery Store
-  Expenses:Food:Groceries             $ 65.00
-  Assets:Checking
-
-2011/01/05 Employer
-  Assets:Checking                   $ 2000.00
-  Income:Salary
-
-2011/01/14 Bank
-  ; Regular monthly savings transfer
-  Assets:Savings                     $ 300.00
-  Assets:Checking
-
-2011/01/19 Grocery Store
-  Expenses:Food:Groceries             $ 44.00 ; hastag: not block
-  Assets:Checking
-
-2011/01/25 Bank
-  ; Transfer to cover car purchase
-  Assets:Checking                  $ 5,500.00
-  Assets:Savings
-  ; :nobudget:
-
-apply tag hastag: true
-apply tag nestedtag: true
-2011/01/25 Tom's Used Cars
-  Expenses:Auto                    $ 5,500.00
-  ; :nobudget:
-  Assets:Checking
-
-2011/01/27 Book Store
-  Expenses:Books                       $20.00
-  Liabilities:MasterCard
-end tag
-2011/12/01 Sale
-  Assets:Checking:Business            $ 30.00
-  Income:Sales
-end tag
-
- -
- -
-

-Next: , Previous: , Up: Top   [Contents][Index]

-
- -

Appendix B Miscellaneous Notes

- -

Various notes from the discussion list that I haven’t incorporated in -to the main body of the documentation. -

- - - - -
- - - -

B.1 Cookbook

- - - - - - -
- -
-

-Next: , Previous: , Up: Cookbook   [Contents][Index]

-
- -

B.1.1 Invoking Ledger

- - -
-
$ ledger --group-by "tag('trip')" bal
-
-
-
$ ledger cleared VWCU NFCU Tithe Misentry
-
-
-
$ ledger register Joint --uncleared
-
-
-
$ ledger register Checking --sort d -d 'd>[2011/04/01]' until 2011/05/25
-
- -
- -
-

-Previous: , Up: Cookbook   [Contents][Index]

-
- -

B.1.2 Ledger Files

- -
-
= /^Income:Taxable/
-  (Liabilities:Tithe Owed)    -0.1
-= /Noah/
-  (Liabilities:Tithe Owed)    -0.1
-= /Jonah/
-  (Liabilities:Tithe Owed)    -0.1
-= /Tithe/
-  (Liabilities:Tithe Owed)    -1.0
-
- -
- - - -

Concepts Index

- -
Jump to:   A -   -B -   -C -   -D -   -E -   -F -   -G -   -H -   -I -   -J -   -L -   -M -   -N -   -O -   -P -   -R -   -S -   -T -   -U -   -W -   -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Index Entry  Section

A
account, alias: Command Directives
account, meaning of: Fat-free Accounting
accounts, limiting by: Register Report
accounts, naming: Structuring your Accounts
adorned commodity: Commodity reporting
amounts: Specifying Amounts
assertions: Command Directives
assertions: Command Directives
assets and liabilities: Assets and Liabilities
automated transaction: Transactions and Comments

B
balance report: Balance Report
beginning ledger: Starting up
block comments: Commenting on your Journal
bucket: Command Directives
buying stock: Buying and Selling Stock

C
cleared report: Cleared Report
comma separated variable file reading: The convert command
comments: Transactions and Comments
comments: Command Directives
comments: Command Directives
comments, block: Commenting on your Journal
comments, characters: Commenting on your Journal
commodity: Currency and Commodities
consumable commodity pricing: Fixing Lot Prices
credits and debits: Stating where money goes
csv exporting: Basic Reporting Commands
csv importing: Converting from other formats
csv importing: The convert command
currency: Currency and Commodities
currency symbol display on windows: Using the Windows Command-Line

D
debts are liabilities: Assets and Liabilities
depth_spacer: Asset Allocation
display_total: Asset Allocation
double-entry accounting: Accounting with Ledger

E
effective date of invoice: Effective Dates
effective dates: Effective Dates
Euro conversion: Commodity reporting

F
FIFO/LIFO: Commodity reporting
fixated prices: Command Directives
fixing lot prices: Fixing Lot Prices

G
Gnuplot: Visualizing with Gnuplot

H
historical prices: Transactions and Comments

I
income is negative: Stating where money goes
initial equity: Starting up

J
journals: Start a Journal File

L
LIFO/FIFO: Commodity reporting
limit by payees: Controlling the Accounts and Payees
limiting by accounts: Register Report

M
meaning of account: Fat-free Accounting

N
naming accounts: Structuring your Accounts

O
opening balance: Starting up

P
parent.total: Asset Allocation
Payee metadata tag: Payee metadata tag
periodic transaction: Transactions and Comments
plotting: Visualizing with Gnuplot
posting format details: The Most Basic Entry
postings: Fat-free Accounting
pre-commands: Pre-Commands
pre-declare account: Command Directives
pre-declare commodity: Command Directives
pre-declare tag: Command Directives

R
register report: Register Report
reimbursable expense tracking: Tracking reimbursable expenses

S
spaces in postings: The Most Basic Entry

T
tags: Transactions and Comments
transaction, automated: Transactions and Comments
transaction, periodic: Transactions and Comments
tutorial: Ledger Tutorial

U
uncommoditized amounts: Integer Amounts

W
why is income negative: Stating where money goes
windows cmd.exe: Using the Windows Command-Line

-
Jump to:   A -   -B -   -C -   -D -   -E -   -F -   -G -   -H -   -I -   -J -   -L -   -M -   -N -   -O -   -P -   -R -   -S -   -T -   -U -   -W -   -
- -
- -
-

-Previous: , Up: Top   [Contents][Index]

-
- -

Commands & Options Index

- -
Jump to:   - -   -= -   -~ -   -
-A -   -B -   -C -   -D -   -E -   -F -   -G -   -H -   -I -   -J -   -L -   -M -   -N -   -O -   -P -   -Q -   -R -   -S -   -T -   -U -   -V -   -X -   -Y -   -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Index Entry  Section

-
-%: Output Customization
-%: Report Options
-%: Output customization
--abbrev-len INT: Report Options
--account STR: The convert command
--account STR: Basic Options
--account STR: Report Options
--account STR: Basic options
--account-width INT: Report Options
--actual: Report Filtering
--actual: Report Options
--actual: Report filtering
--actual-dates: Report Options
--add-budget: Report Filtering
--add-budget: Report Options
--add-budget: Budgeting
--amount EXPR: Report Filtering
--amount EXPR: Report Options
--amount EXPR: Report filtering
--amount EXPR: Variables
--amount EXPR: Format Expressions
--amount-data: Visualizing with Gnuplot
--amount-data: The register command
--amount-data: Output Customization
--amount-data: Report Options
--amount-data: Output customization
--amount-width INT: Report Options
--anon: Output Customization
--anon: Report Options
--ansi: Report Options
--args-only: Global Options
--args-only: Debug Options
--auto-match: The convert command
--auto-match: Report Options
--aux-date: Auxiliary dates
--aux-date: Report Options
--average: prices and pricedb commands
--average: Output Customization
--average: Report Options
--average: Output customization
--balance-format FORMAT_STRING: Output Customization
--balance-format FORMAT_STRING: Report Options
--balance-format FORMAT_STRING: Output customization
--balance-format FORMAT_STRING: Format String Basics
--balance-format FORMAT_STRING: Balance format
--base: Report Options
--basis: Commodity Reporting
--basis: Report Options
--basis: Commodity reporting
--basis: Commodity reporting
--basis: Primary commodities
--begin DATE: Report Filtering
--begin DATE: Report Options
--begin DATE: Report filtering
--bold-if VEXPR: Report Options
--budget: Periodic Transactions
--budget: Report Filtering
--budget: Report Options
--budget: Report filtering
--budget: Budgeting
--budget-format FORMAT_STRING: Report Options
--budget-format FORMAT_STRING: Format String Basics
--by-payee: Working with multiple funds and accounts
--by-payee: Payee metadata tag
--by-payee: Output Customization
--by-payee: Grouping Options
--by-payee: Report Options
--by-payee: Output customization
--change: Report Options
--check-payees: Error Checking and Calculation Options
--check-payees: Session Options
--cleared: Transaction state
--cleared: Report Filtering
--cleared: Report Options
--cleared: Report filtering
--cleared-format FORMAT_STRING: Report Options
--cleared-format FORMAT_STRING: Output customization
--cleared-format FORMAT_STRING: Format String Basics
--collapse: Output Customization
--collapse: Report Options
--collapse: Output customization
--collapse-if-zero: Report Options
--color: Report Options
--columns INT: Report Options
--cost: Report Options
--count: Reports about your Journals
--count: Report Options
--csv-format FORMAT_STRING: Report Options
--csv-format FORMAT_STRING: Output customization
--csv-format FORMAT_STRING: Format String Basics
--current: Report Filtering
--current: Report Options
--current: Report filtering
--daily: Grouping Options
--daily: Report Options
--date EXPR: Report Options
--date-format DATE_FORMAT: Output Customization
--date-format DATE_FORMAT: Report Options
--date-format DATE_FORMAT: Output customization
--date-width INT: Report Options
--datetime-format DATETIME_FORMAT: Report Options
--day-break: Session Options
--day-break: Time Keeping
--days-of-week: Report Options
--dc: Report Filtering
--dc: Report Options
--debug CODE: Global Options
--debug CODE: Debug Options
--decimal-comma: Session Options
--depth INT: Report Options
--detail: Report Options
--deviation: Output Customization
--deviation: Report Options
--deviation: Output customization
--display EXPR: Reporting monthly expenses
--display EXPR: Visualizing with Gnuplot
--display EXPR: Output Customization
--display EXPR: Report Options
--display EXPR: Output customization
--display EXPR: Value Expressions
--display-amount EXPR: Report Options
--display-total EXPR: Report Options
--dow: Output Customization
--dow: Grouping Options
--dow: Report Options
--dow: Output customization
--download: Transactions and Comments
--download: Commodity Reporting
--download: Session Options
--download: Commodity reporting
--effective: Effective Dates
--effective: Report Options
--empty: Balancing transactions
--empty: Output Customization
--empty: Report Options
--empty: Output customization
--end DATE: Report Filtering
--end DATE: Report Options
--end DATE: Report filtering
--equity: Report Options
--exact: Report Options
--exchange COMMODITY: Complete control over commodity pricing
--exchange COMMODITY: Primary and secondary commodities
--exchange COMMODITY: Report Options
--exchange COMMODITY: Commodity reporting
--exchange COMMODITY: Commodity reporting
--explicit: Session Options
--file FILE: Basic Options
--file FILE: Session Options
--file FILE: Basic options
--first INT: Report Options
--flat: Report Options
--force-color: Report Options
--force-pager: Report Options
--forecast VEXPR: Report Filtering
--forecast VEXPR: Report Options
--forecast VEXPR: Forecasting
--forecast-while VEXPR: Report Filtering
--forecast-while VEXPR: Report Options
--forecast-years INT: Report Options
--format FORMAT_STRING: Output Customization
--format FORMAT_STRING: Report Options
--format FORMAT_STRING: Output customization
--format FORMAT_STRING: Format String Basics
--format FORMAT_STRING: Balance format
--gain: Commodity Reporting
--gain: Report Options
--gain: Commodity reporting
--generated: Report Options
--group-by EXPR: Report Options
--group-title-format FORMAT_STRING: Report Options
--head INT: Output Customization
--head INT: Report Options
--head INT: Output customization
--help: Basic Options
--help: Global Options
--help: Basic options
--historical: Report Options
--historical: Commodity reporting
--immediate: Error Checking and Calculation Options
--immediate: Report Options
--import FILE: Basic Options
--init-file FILE: Basic Options
--init-file FILE: Global Options
--init-file FILE: Basic options
--inject: Report Options
--input-date-format DATE_FORMAT: The convert command
--input-date-format DATE_FORMAT: Session Options
--invert: The convert command
--invert: Report Options
--last INT: Report Options
--leeway INT: Commodity Reporting
--leeway INT: Session Options
--leeway INT: Commodity reporting
--limit EXPR: Controlling the Accounts and Payees
--limit EXPR: Visualizing with Gnuplot
--limit EXPR: Report Filtering
--limit EXPR: Report Options
--limit EXPR: Report filtering
--limit EXPR: Value Expressions
--lot-dates: Lot dates
--lot-dates: Report Options
--lot-notes: Lot notes
--lot-notes: Report Options
--lot-prices: Commodity prices
--lot-prices: Report Options
--lot-prices: Commodity reporting
--lot-prices: Commodity reporting
--lot-tags: Report Options
--lots: Lot notes
--lots: Report Options
--lots: Commodity reporting
--lots-actual: Report Options
--market: Commodities and Currencies
--market: Complete control over commodity pricing
--market: Primary and secondary commodities
--market: Commodity Reporting
--market: Report Options
--market: Commodity reporting
--market: Commodity reporting
--market: Primary commodities
--master-account STR: Session Options
--meta TAG: Report Options
--meta-width INT: Report Options
--monthly: Reporting monthly expenses
--monthly: Generating a monthly register
--monthly: Grouping Options
--monthly: Report Options
--monthly: Output customization
--monthly: Budgeting
--no-aliases: Session Options
--no-aliases: Report Options
--no-color: Report Options
--no-pager: Output Customization
--no-pager: Report Options
--no-pager: Output customization
--no-revalued: Report Options
--no-rounding: Report Options
--no-titles: Report Options
--no-total: Report Options
--now DATE: Report Options
--now DATE: Commodity reporting
--now DATE: Date Functions
--only FIXME: Report Options
--options: Global Options
--output FILE: Basic Options
--output FILE: Report Options
--output FILE: Basic options
--pager FILE: Output Customization
--pager FILE: Report Options
--pager FILE: Output customization
--payee VEXPR: Report Options
--payee-width INT: Report Options
--payee=code: Working with multiple funds and accounts
--pedantic: Command Directives
--pedantic: Error Checking and Calculation Options
--pedantic: Session Options
--pending: Transaction state
--pending: Report Options
--percent: Output Customization
--percent: Report Options
--percent: Output customization
--period PERIOD_EXPRESSION: Report Filtering
--period PERIOD_EXPRESSION: Report Options
--period PERIOD_EXPRESSION: Report filtering
--period PERIOD_EXPRESSION: Output customization
--period-sort VEXPR: Reporting monthly expenses
--period-sort VEXPR: Report Filtering
--period-sort VEXPR: Report Options
--period-sort VEXPR: Report filtering
--permissive: Balance verification
--permissive: Session Options
--pivot TAG: Output Customization
--pivot TAG: Report Options
--pivot TAG: Output customization
--plot-amount-format FORMAT_STRING: Output Customization
--plot-amount-format FORMAT_STRING: Report Options
--plot-amount-format FORMAT_STRING: Output customization
--plot-amount-format FORMAT_STRING: Format String Basics
--plot-total-format FORMAT_STRING: Output Customization
--plot-total-format FORMAT_STRING: Report Options
--plot-total-format FORMAT_STRING: Output customization
--plot-total-format FORMAT_STRING: Format String Basics
--prepend-format FORMAT_STRING: Report Options
--prepend-width INT: Report Options
--price: Report Options
--price: Commodity reporting
--price-db FILE: Commodities and Currencies
--price-db FILE: Commodity Reporting
--price-db FILE: Session Options
--price-db FILE: Commodity reporting
--price-exp INT: Commodity Reporting
--price-exp INT: Session Options
--price-exp INT: Commodity reporting
--pricedb-format FORMAT_STRING: Report Options
--pricedb-format FORMAT_STRING: Output customization
--pricedb-format FORMAT_STRING: Format String Basics
--prices-format FORMAT_STRING: Output Customization
--prices-format FORMAT_STRING: Report Options
--prices-format FORMAT_STRING: Output customization
--prices-format FORMAT_STRING: Format String Basics
--primary-date: Report Options
--quantity: Commodity Reporting
--quantity: Report Options
--quantity: Commodity reporting
--quarterly: Output Customization
--quarterly: Grouping Options
--quarterly: Report Options
--raw: Report Options
--real: Working with multiple funds and accounts
--real: Virtual postings
--real: Report Filtering
--real: Report Options
--real: Report filtering
--recursive-aliases: Session Options
--register-format FORMAT_STRING: Output Customization
--register-format FORMAT_STRING: Report Options
--register-format FORMAT_STRING: Output customization
--register-format FORMAT_STRING: Format String Basics
--related: Reporting monthly expenses
--related: Report Filtering
--related: Report Options
--related: Report filtering
--related-all: Report Options
--revalued: Report Options
--revalued-only: Report Options
--revalued-total FIXME: Report Options
--rich-data: The convert command
--rich-data: Report Options
--script FILE: Global Options
--seed INT: Report Options
--sort VEXPR: Output Customization
--sort VEXPR: Report Options
--sort VEXPR: Output customization
--sort-all FIXME: Report Options
--sort-xacts VEXPR: Report Options
--start-of-week INT: Report Options
--strict: Keeping it Consistent
--strict: Command Directives
--strict: Error Checking and Calculation Options
--strict: Session Options
--subtotal: Reporting monthly expenses
--subtotal: An overall balance summary
--subtotal: Output Customization
--subtotal: Grouping Options
--subtotal: Report Options
--subtotal: Output customization
--tail INT: Output Customization
--tail INT: Report Options
--time-colon: Session Options
--time-report: Report Options
--total VEXPR: Report Filtering
--total VEXPR: Report Options
--total VEXPR: Report filtering
--total VEXPR: Variables
--total VEXPR: Format Expressions
--total-data: Visualizing with Gnuplot
--total-data: The register command
--total-data: Output Customization
--total-data: Report Options
--total-data: Output customization
--total-width INT: Report Options
--trace INT: Global Options
--trace INT: Debug Options
--truncate CODE: Report Options
--unbudgeted: Report Filtering
--unbudgeted: Report Options
--unbudgeted: Budgeting
--uncleared: Transaction state
--uncleared: Report Filtering
--uncleared: Report Options
--uncleared: Report filtering
--unrealized: Report Options
--unrealized-gains STR: Report Options
--unrealized-losses STR: Report Options
--unround: Report Options
--value-expr VEXPR: Session Options
--values: tags
--values: Report Options
--verbose: Global Options
--verbose: Debug Options
--verify: Global Options
--verify: Debug Options
--verify-memory: Global Options
--verify-memory: Debug Options
--version: Basic Options
--version: Global Options
--version: Basic options
--version: Debug Options
--weekly: Output Customization
--weekly: Grouping Options
--weekly: Report Options
--weekly: Output customization
--wide: Output Customization
--wide: Report Options
--wide: Output customization
--yearly: Output Customization
--yearly: Grouping Options
--yearly: Report Options
--yearly: Output customization
-A: Output Customization
-A: Report Options
-A: Output customization
-a STR: Basic Options
-a STR: Basic options
-B: Commodity Reporting
-B: Report Options
-B: Commodity reporting
-b DATE: Report Filtering
-b DATE: Report filtering
-c: Report Filtering
-C: Report Filtering
-C: Report Options
-c: Report filtering
-C: Report filtering
-D: Output Customization
-D: Grouping Options
-D: Report Options
-D: Output customization
-d EXPR: Output Customization
-d EXPR: Output customization
-E: Output Customization
-E: Report Options
-E: Output customization
-e DATE: Report Filtering
-e DATE: Report filtering
-f FILE: Basic Options
-f FILE: Session Options
-f FILE: Basic options
-F FORMAT_STRING: Output Customization
-F FORMAT_STRING: Report Options
-F FORMAT_STRING: Output customization
-G: Commodity Reporting
-G: Report Options
-G: Commodity reporting
-h: Basic Options
-h: Global Options
-H: Report Options
-h: Basic options
-I: Report Options
-i FILE: Basic Options
-i FILE: Basic options
-j: Output Customization
-J: Output Customization
-j: Report Options
-J: Report Options
-j: Output customization
-J: Output customization
-L: Report Filtering
-L: Report Options
-L: Report filtering
-l EXPR: Report Filtering
-l EXPR: Report Options
-l EXPR: Report filtering
-M: Grouping Options
-M: Report Options
-M: Output customization
-n: Output Customization
-n: Report Options
-n: Output customization
-O: Commodity Reporting
-O: Report Options
-O: Commodity reporting
-o FILE: Basic Options
-o FILE: Basic options
-P: Output Customization
-P: Grouping Options
-P: Report Options
-P: Output customization
-p PERIOD_EXPRESSION: Report Filtering
-p PERIOD_EXPRESSION: Report filtering
-Q: Commodity Reporting
-Q: Session Options
-Q: Commodity reporting
-R: Report Filtering
-r: Report Filtering
-R: Report Options
-R: Report filtering
-r: Report filtering
-s: Output Customization
-s: Grouping Options
-s: Report Options
-s: Output customization
-S VEXPR: Output Customization
-S VEXPR: Report Options
-S VEXPR: Output customization
-t EXPR: Report Filtering
-t EXPR: Report Options
-t EXPR: Report filtering
-T VEXPR: Report Filtering
-T VEXPR: Report Options
-T VEXPR: Report filtering
-U: Report Filtering
-U: Report Options
-U: Report filtering
-V: Commodity Reporting
-v: Global Options
-V: Report Options
-V: Commodity reporting
-v: Debug Options
-W: Output Customization
-w: Output Customization
-W: Grouping Options
-W: Report Options
-W: Output customization
-w: Output customization
-X COMMODITY: Report Options
-Y: Output Customization
-Y: Grouping Options
-Y: Report Options
-Y: Output customization
-y DATE_FORMAT: Output Customization
-y DATE_FORMAT: Report Options
-y DATE_FORMAT: Output customization
-Z INT: Commodity Reporting
-Z INT: Session Options
-Z INT: Commodity reporting

=
=: Transactions and Comments

~
~: Transactions and Comments

A
A: Command Directives
abs: Miscellaneous
account: Command Directives
accounts: Keeping it Consistent
accounts: accounts
alias: Command Directives
amount_expr: Miscellaneous
ansify_if: Miscellaneous
apply account: Command Directives
apply tag: Command Directives
args: Pre-Commands
assert: Command Directives

B
b: Command Directives
bal: Basic Reporting Commands
balance: Balance Report
balance: The balance command
balance: Basic Reporting Commands
bucket: Command Directives
bucket: Command Directives

C
C: Commodity equivalences
C: Command Directives
capture: Command Directives
ceiling: Miscellaneous
check: Command Directives
cleared: Cleared Report
comment: Transactions and Comments
comment: Command Directives
commodities: commodities
commodity: Command Directives
convert: The convert command
csv: The csv command
csv: Basic Reporting Commands

D
D: Command Directives
define: Command Directives
draft: xact

E
echo: echo
emacs: The lisp command
emacs: Basic Reporting Commands
end: Command Directives
entry: xact
equity: Archiving Previous Years
equity: The equity command
equity: Basic Reporting Commands
eval VEXPR: Pre-Commands
expr: Command Directives
expr VEXPR: Pre-Commands

F
fixed: Command Directives
floor: Miscellaneous
format: Miscellaneous
format FORMAT_STRING: Pre-Commands
format_date: Miscellaneous
format_datetime: Miscellaneous

G
generate: Pre-Commands
get_at: Miscellaneous

H
h: Command Directives
help: Getting help

I
I: Command Directives
i: Command Directives
include: Command Directives
int: Miscellaneous
is_seq: Miscellaneous

J
join: Miscellaneous
justify: Miscellaneous

L
lisp: The lisp command
lisp: Basic Reporting Commands

M
market: Miscellaneous

N
N: Command Directives
nail_down: Miscellaneous

O
O: Command Directives
o: Command Directives
org: Emacs org Mode

P
P: Transactions and Comments
P: Miscellaneous
parse VEXPR: Pre-Commands
payee: Command Directives
payees: Payee metadata tag
payees: payees
percent: Miscellaneous
period PERIOD_EXPRESSION: Pre-Commands
pricedb: prices and pricedb commands
pricedb: Basic Reporting Commands
pricemap: The pricemap command
prices: prices and pricedb commands
prices: Basic Reporting Commands
print: Command Directives
print: Command Directives
print: Archiving Previous Years
print: The print command
print: Basic Reporting Commands
print: Miscellaneous

Q
quantity: Miscellaneous
query: Pre-Commands
quoted: Miscellaneous

R
reg: Basic Reporting Commands
register: Register Report
register: Command Directives
register: Command Directives
register: Payee metadata tag
register: The register command
register: Generating a monthly register
register: Basic Reporting Commands
reload: reload
round: Miscellaneous
rounded: Miscellaneous
roundto: Miscellaneous

S
S: Miscellaneous
script: Pre-Commands
scrub: Miscellaneous
select: select
should_bold: Miscellaneous
source: source
stat: stats
stats: stats
str: Miscellaneous
strip: Miscellaneous

T
tag: Command Directives
tags: tags
template: Pre-Commands
test: Command Directives
top_amount: Miscellaneous
total_expr: Miscellaneous
to_amount: Miscellaneous
to_balance: Miscellaneous
to_boolean: Miscellaneous
to_date: Miscellaneous
to_datetime: Miscellaneous
to_int: Miscellaneous
to_mask: Miscellaneous
to_sequence: Miscellaneous
to_string: Miscellaneous
trim: Miscellaneous
truncatedstring: Miscellaneous

U
U: Miscellaneous
unround: Miscellaneous
unrounded: Miscellaneous

V
value_date: Miscellaneous

X
xact: Command Directives
xact: xact
xact: Basic Reporting Commands
xml: The xml command
xml: Basic Reporting Commands

Y
Y: Command Directives
year: Command Directives
year: Command Directives

-
Jump to:   - -   -= -   -~ -   -
-A -   -B -   -C -   -D -   -E -   -F -   -G -   -H -   -I -   -J -   -L -   -M -   -N -   -O -   -P -   -Q -   -R -   -S -   -T -   -U -   -V -   -X -   -Y -   -
- -
-
-

Footnotes

- -

(1)

-

In some special -cases, it automatically balances this transaction for you.

-

(2)

-

This also means if you -misspell an account it will end up getting counted separately from -what you intended. An Emacs major mode -ledger-mode provides -tab completion for automatically filling in account names.

-

(3)

-

You -can track anything, even time or distance traveled. As long as -it cannot be created or destroyed inside your accounting system.

-
-
- - - - - - - + +

Ledger: Command-Line Accounting

+ + + + + + + + + + + + + + +

Table of Contents

+ +
+ + +
+ + + + +
+

+Next: , Previous: , Up: (dir)   [Contents][Index]

+
+ +

Overview

+ +

Ledger is a command-line accounting tool that provides double-entry +accounting based on a text journal. It provides no bells or whistles, +and returns the user to the days before user interfaces were even a +twinkling in their fathers’ CRTs. +

+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

1 Introduction to Ledger

+ + + + + + + + +
+ + + +

1.1 Fat-free Accounting

+ +

Ledger is an accounting tool with the moxie to exist. It provides no +bells or whistles, and returns the user to the days before user +interfaces were even a twinkling in their father’s CRT. +

+

What it does offer is a double-entry accounting journal with all the +flexibility and muscle of its modern day cousins, without any of the +fat. Think of it as the Bran Muffin of accounting tools. +

+

To use it, you need to start keeping a journal. This is the basis of +all accounting, and if you haven’t started yet, now is the time to +learn. The little booklet that comes with your checkbook is a journal, +so we’ll describe double-entry accounting in terms of that. +

+ +

A checkbook journal records debits (subtractions, or withdrawals) and +credits (additions, or deposits) with reference to a single account: +the checking account. Where the money comes from, and where it goes +to, are described in the payee field, where you write the person or +company’s name. The ultimate aim of keeping a checkbook journal is to +know how much money is available to spend. That’s really the aim of +all journals. +

+ +

What computers add is the ability to walk through these postings, +and tell you things about your spending habits; to let you devise +budgets and get control over your spending; to squirrel away money +into virtual savings account without having to physically move money +around; etc. As you keep your journal, you are recording information +about your life and habits, and sometimes that information can start +telling you things you aren’t aware of. Such is the aim of all good +accounting tools. +

+

The next step up from a checkbook journal, is a journal that keeps +track of all your accounts, not just checking. In such a journal, you +record not only who gets paid—in the case of a debit—but where the +money came from. In a checkbook journal, it’s assumed that all the +money comes from your checking account. But in a general journal, you +write postings in two lines: the source account and target account. +There must always be a debit from at least one account for every +credit made to another account. This is what is meant by +“double-entry” accounting: the journal must always balance to zero, +with an equal number of debits and credits. +

+

For example, let’s say you have a checking account and a brokerage +account, and you can write checks from both of them. Rather than keep +two checkbooks, you decide to use one journal for both. In this +general journal you need to record a payment to Pacific Bell for your +monthly phone bill, and a transfer (via check) from your brokerage +account to your checking account. The Pacific Bell bill is $23.00, +let’s say, and you want to pay it from your checking account. In the +general journal you need to say where the money came from, in addition +to where it’s going to. These transactions might look like this: +

+
+
9/29        Pacific Bell                $23.00     $23.00
+            Checking                   $-23.00          0
+9/30        Checking                   $100.00    $100.00
+      (123) Brokerage                 $-100.00          0
+
+ +

The posting must balance to $0: $23 went to Pacific Bell, $23 came +from Checking. The next entry shows check number 123 written against +your brokerage account, transferring money to your checking account. +There is nothing left over to be accounted for, since the money has +simply moved from one account to another in both cases. This is the +basis of double-entry accounting: money never pops in or out of +existence; it is always a posting from one account to another. +

+

Keeping a general journal is the same as keeping two separate +journals: One for Pacific Bell and one for Checking. In that case, +each time a payment is written into one, you write a corresponding +withdrawal into the other. This makes it easier to write in +a “running balance”, since you don’t have to look back at the last +time the account was referenced—but it also means having a lot of +journal books, if you deal with multiple accounts. +

+ + +

Here is a good place for an aside on the use of the word “account”. +Most private people consider an account to be something that holds +money at an institution for them. Ledger uses a more general +definition of the word. An account is anywhere money can go. Other +finance programs use “categories”, Ledger uses accounts. So, for +example, if you buy some groceries at Trader Joe’s, then more groceries +at Whole Food Market, you might assign the transactions like this +

+
+
2011/03/15   Trader Joe's
+    Expenses:Groceries   $100.00
+    Assets:Checking
+2011/03/15   Whole Food Market
+    Expenses:Groceries   $75.00
+    Assets:Checking
+
+ +

In both cases the money goes to the ‘Groceries’ account, even +though the payees were different. You can set up your accounts in any +way you choose. +

+

Enter the beauty of computerized accounting. The purpose of the +Ledger program is to make general journal accounting simple, by +keeping track of the balances for you. Your only job is to enter the +postings. If an individual posting does not balance, Ledger displays +an error and indicates the incorrect posting.1 +

+

In summary, there are two aspects of Ledger use: updating the journal +data file, and using the Ledger tool to view the summarized result of +your transactions. +

+

And just for the sake of example—as a starting point for those who +want to dive in head-first—here are the journal transactions from +above, formatted as the Ledger program wishes to see them: +

+
+
2004/09/29 Pacific Bell
+    Expenses:Pacific Bell              $23.00
+    Assets:Checking
+
+ +

The account balances and registers in this file, if saved as +ledger.dat, could be reported using: +

+
+
$ ledger -f ledger.dat balance
+
+ +
+
             $-23.00  Assets:Checking
+              $23.00  Expenses:Pacific Bell
+--------------------
+                   0
+
+ +

Or +

+
+
$ ledger -f ledger.dat register checking
+
+ +
+
04-Sep-29 Pacific Bell          Assets:Checking             $-23.00      $-23.00
+
+ +

And even: +

+
+
$ ledger -f ledger.dat register Bell
+
+ +
+
04-Sep-29 Pacific Bell          Expenses:Pacific Bell        $23.00       $23.00
+
+ +

An important difference between Ledger and other finance packages is +that Ledger will never alter your input file. You can create and edit +that file in any way you prefer, but Ledger is only for analyzing the +data, not for altering it. +

+
+ + + +

1.2 Building the program

+ +

Ledger is written in ANSI C++, and should compile on any unix platform. +The easiest way to build and install ledger is to use the prepared +acprep script, that does a lot of the footwork: +

+
+
    # to install missing dependencies
+    ./acprep dependencies
+    # building ledger
+    ./acprep update
+    # to run the actual installation
+    make install
+
+ +

See the ‘help‘ subcommand to ‘acprep‘, which explains some of its many +options. You can run ‘make check‘ to confirm the result, and ‘make +install‘ to install. If these instructions do not work for you, you can check the +‘INSTALL.md‘ in the source directory for more up to date build instructions. +

+
+ + + +

1.3 Getting help

+ + +

Ledger has a complete online help system based on GNU Info. This manual +can be searched directly from the command-line using info ledger, +which will bring up this entire manual in your TTY. Alternatively, the +shorter man page can be accessed from the command-line either via +man ledger or ledger --help +

+

If you need help on how to use Ledger, or run into problems, you can +join the Ledger mailing list at +http://groups.google.com/group/ledger-cli. +

+

You can also find help in the #ledger channel on the IRC server +irc.freenode.net. +

+
+ + + +

1.4 Third-Party Ledger Tutorials

+ +

There are plenty of people using Ledger for accounting applications. +Some have documented how they use Ledger’s features to solve their +accounting problems. +

+

One such tutorial, specifically designed for non-profit charities that seek +to use Ledger, can be found at +https://k.sfconservancy.org/NPO-Accounting/npo-ledger-cli (with a copy on GitHub also +available at https://github.com/conservancy/npo-ledger-cli/). If +you’re looking for information about how to use Ledger’s tagging system to +handle invoicing, track expenses by program targets, and other such concepts, +you might find the tutorial useful. (Some of the auditor reporting scripts +that relate to the aforementioned Ledger setup can be found +contrib/non-profit-audit-reports/ in Ledger’s own source repository.) +

+
+ + + +

2 Ledger Tutorial

+ + + + + + + +
+ + + +

2.1 Start a Journal File

+ + +

A journal is a record of your financial transactions and will be central +to using Ledger. For now we just want to get a taste of what Ledger can +do. An example journal is included with the source code distribution, +called drewr3.dat (see Example Journal File). Copy it +someplace convenient and open up a terminal window in that directory. +

+

If you would rather start with your own journal right away please +see Keeping a Journal. +

+
+ + + +

2.2 Run a Few Reports

+ + + + + + + + +

Please note that as a command-line program, Ledger is controlled from +your shell. There are several different command shells that all +behave slightly differently with respect to some special characters. +In particular, the “bash” shell will interpret ‘$’ signs +differently than ledger and they must be escaped to reach the actual +program. Another example is “zsh”, which will interpret ‘^’ +differently than ledger expects. In all cases that follow you should +take that into account when entering the command-line arguments as given. +There are too many variations between shells to give concrete examples +for each. +

+
+ + + +

2.2.1 Balance Report

+ + + +

To find the balances of all of your accounts, run this command: +

+
+
$ ledger -f drewr3.dat balance
+
+ +

Ledger will generate: +

+
+
         $ -3,804.00  Assets
+          $ 1,396.00    Checking
+             $ 30.00      Business
+         $ -5,200.00    Savings
+         $ -1,000.00  Equity:Opening Balances
+          $ 6,654.00  Expenses
+          $ 5,500.00    Auto
+             $ 20.00    Books
+            $ 300.00    Escrow
+            $ 334.00    Food:Groceries
+            $ 500.00    Interest:Mortgage
+         $ -2,030.00  Income
+         $ -2,000.00    Salary
+            $ -30.00    Sales
+            $ -63.60  Liabilities
+            $ -20.00    MasterCard
+            $ 200.00    Mortgage:Principal
+           $ -243.60    Tithe
+--------------------
+           $ -243.60
+
+ +

Showing you the balance of all accounts. Options and search terms can +pare this down to show only the accounts you want. +

+

A more useful report is to show only your Assets and Liabilities: +

+
+
$ ledger -f drewr3.dat balance Assets Liabilities
+
+ +
+
         $ -3,804.00  Assets
+          $ 1,396.00    Checking
+             $ 30.00      Business
+         $ -5,200.00    Savings
+            $ -63.60  Liabilities
+            $ -20.00    MasterCard
+            $ 200.00    Mortgage:Principal
+           $ -243.60    Tithe
+--------------------
+         $ -3,867.60
+
+ +
+ + + +

2.2.2 Register Report

+ + + +

To show all transactions and a running total: +

+
+
$ ledger -f drewr3.dat register
+
+ +

Ledger will generate: +

+
+
10-Dec-01 Checking balance      Assets:Checking          $ 1,000.00   $ 1,000.00
+                                Equit:Opening Balances  $ -1,000.00            0
+10-Dec-20 Organic Co-op         Expense:Food:Groceries      $ 37.50      $ 37.50
+                                Expense:Food:Groceries      $ 37.50      $ 75.00
+                                Expense:Food:Groceries      $ 37.50     $ 112.50
+                                Expense:Food:Groceries      $ 37.50     $ 150.00
+                                Expense:Food:Groceries      $ 37.50     $ 187.50
+                                Expense:Food:Groceries      $ 37.50     $ 225.00
+                                Assets:Checking           $ -225.00            0
+10-Dec-28 Acme Mortgage         Lia:Mortgage:Principal     $ 200.00     $ 200.00
+                                Expe:Interest:Mortgage     $ 500.00     $ 700.00
+                                Expenses:Escrow            $ 300.00   $ 1,000.00
+                                Assets:Checking         $ -1,000.00            0
+11-Jan-02 Grocery Store         Expense:Food:Groceries      $ 65.00      $ 65.00
+                                Assets:Checking            $ -65.00            0
+11-Jan-05 Employer              Assets:Checking          $ 2,000.00   $ 2,000.00
+                                Income:Salary           $ -2,000.00            0
+                                (Liabilities:Tithe)       $ -240.00    $ -240.00
+11-Jan-14 Bank                  Assets:Savings             $ 300.00      $ 60.00
+                                Assets:Checking           $ -300.00    $ -240.00
+11-Jan-19 Grocery Store         Expense:Food:Groceries      $ 44.00    $ -196.00
+                                Assets:Checking            $ -44.00    $ -240.00
+11-Jan-25 Bank                  Assets:Checking          $ 5,500.00   $ 5,260.00
+                                Assets:Savings          $ -5,500.00    $ -240.00
+11-Jan-25 Tom's Used Cars       Expenses:Auto            $ 5,500.00   $ 5,260.00
+                                Assets:Checking         $ -5,500.00    $ -240.00
+11-Jan-27 Book Store            Expenses:Books              $ 20.00    $ -220.00
+                                Liabilities:MasterCard     $ -20.00    $ -240.00
+11-Dec-01 Sale                  Asse:Checking:Business      $ 30.00    $ -210.00
+                                Income:Sales               $ -30.00    $ -240.00
+                                (Liabilities:Tithe)         $ -3.60    $ -243.60
+
+ +

To limit this to a more useful subset, simply add the accounts you are +interested in seeing transactions for: +

+ + + +
+
$ ledger -f drewr3.dat register Groceries
+
+ +
+
10-Dec-20 Organic Co-op         Expense:Food:Groceries      $ 37.50      $ 37.50
+                                Expense:Food:Groceries      $ 37.50      $ 75.00
+                                Expense:Food:Groceries      $ 37.50     $ 112.50
+                                Expense:Food:Groceries      $ 37.50     $ 150.00
+                                Expense:Food:Groceries      $ 37.50     $ 187.50
+                                Expense:Food:Groceries      $ 37.50     $ 225.00
+11-Jan-02 Grocery Store         Expense:Food:Groceries      $ 65.00     $ 290.00
+11-Jan-19 Grocery Store         Expense:Food:Groceries      $ 44.00     $ 334.00
+
+ +

Which matches the balance reported for the ‘Groceries’ account: +

+
+
$ ledger -f drewr3.dat balance Groceries
+
+ +
+
            $ 334.00  Expenses:Food:Groceries
+
+ +

If you would like to find transaction to only a certain payee use +‘payee’ or ‘@’: +

+
+
$ ledger -f drewr3.dat register payee "Organic"
+
+ +
+
10-Dec-20 Organic Co-op         Expense:Food:Groceries      $ 37.50      $ 37.50
+                                Expense:Food:Groceries      $ 37.50      $ 75.00
+                                Expense:Food:Groceries      $ 37.50     $ 112.50
+                                Expense:Food:Groceries      $ 37.50     $ 150.00
+                                Expense:Food:Groceries      $ 37.50     $ 187.50
+                                Expense:Food:Groceries      $ 37.50     $ 225.00
+                                Assets:Checking           $ -225.00            0
+
+ +
+ + + +

2.2.3 Cleared Report

+ + + +

A very useful report is to show what your obligations are versus what +expenditures have actually been recorded. It can take several days for +a check to clear, but you should treat it as money spent. The +cleared report shows just that (note that the +cleared report will not format correctly for accounts that +contain multiple commodities): +

+
+
$ ledger -f drewr3.dat cleared
+
+ +
+
     $ -3,804.00            $ 775.00                 Assets
+      $ 1,396.00            $ 775.00    10-Dec-20      Checking
+         $ 30.00                   0                     Business
+     $ -5,200.00                   0                   Savings
+     $ -1,000.00         $ -1,000.00    10-Dec-01    Equity:Opening Balances
+      $ 6,654.00            $ 225.00                 Expenses
+      $ 5,500.00                   0                   Auto
+         $ 20.00                   0                   Books
+        $ 300.00                   0                   Escrow
+        $ 334.00            $ 225.00    10-Dec-20      Food:Groceries
+        $ 500.00                   0                   Interest:Mortgage
+     $ -2,030.00                   0                 Income
+     $ -2,000.00                   0                   Salary
+        $ -30.00                   0                   Sales
+        $ -63.60                   0                 Liabilities
+        $ -20.00                   0                   MasterCard
+        $ 200.00                   0                   Mortgage:Principal
+       $ -243.60                   0                   Tithe
+----------------    ----------------    ---------
+       $ -243.60                   0             
+
+ +

The first column shows the outstanding balance, the second column +shows the “cleared” balance. +

+
+ +
+

+Previous: , Up: Run a Few Reports   [Contents][Index]

+
+ +

2.2.4 Using the Windows Command-Line

+ + + +

Using ledger under the windows command shell has one significant +limitation. CMD.EXE is limited to standard ASCII characters and as +such cannot display any currency symbols other than dollar signs +‘$’. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

3 Principles of Accounting with Ledger

+ + + + + + + + + + + + +
+ + + +

3.1 Accounting with Ledger

+ + +

Accounting is simply tracking your money. It can range from nothing, +and just waiting for automatic overdraft protection to kick in, or +not, to a full-blown double-entry accounting system. Ledger +accomplishes the latter. With ledger you can handle your personal +finances or your business’s. Double-entry accounting scales. +

+
+ + + +

3.2 Stating where money goes

+ + +

Accountants will talk of “credits” and “debits”, but the meaning +is often different from the layman’s understanding. To avoid +confusion, Ledger uses only subtractions and additions, although the +underlying intent is the same as standard accounting principles. +

+

Recall that every posting will involve two or more accounts. +Money is transferred from one or more accounts to one or more other +accounts. To record the posting, an amount is subtracted +from the source accounts, and added to the target accounts. +

+

In order to write a Ledger transaction correctly, you must determine +where the money comes from and where it goes to. For example, when +you are paid a salary, you must add money to your bank account and +also subtract it from an income account: +

+
+
9/29  My Employer
+    Assets:Checking                           $500.00
+    Income:Salary                            $-500.00
+
+ + + + +

Why is the Income a negative figure? When you look at the balance +totals for your ledger, you may be surprised to see that Expenses are +a positive figure, and Income is a negative figure. It may take some +getting used to, but to properly use a general ledger you must think +in terms of how money moves. Rather than Ledger “fixing” the minus +signs, let’s understand why they are there. +

+

When you earn money, the money has to come from somewhere. Let’s call +that somewhere “society”. In order for society to give you an +income, you must take money away (withdraw) from society in order to +put it into (make a payment to) your bank. When you then spend that +money, it leaves your bank account (a withdrawal) and goes back to +society (a payment). This is why Income will appear negative—it +reflects the money you have drawn from society—and why Expenses will +be positive—it is the amount you’ve given back. These additions and +subtractions will always cancel each other out in the end, because you +don’t have the ability to create new money: it must always come from +somewhere, and in the end must always leave. This is the beginning of +economy, after which the explanation gets terribly difficult. +

+

Based on that explanation, here’s another way to look at your balance +report: every negative figure means that that account or person or +place has less money now than when you started your ledger; and every +positive figure means that that account or person or place has more +money now than when you started your ledger. Make sense? +

+
+ + + +

3.3 Assets and Liabilities

+ + + +

Assets are money that you have, and Liabilities are money that you +owe. “Liabilities” is just a more inclusive name for Debts. +

+

An Asset is typically increased by transferring money from an Income +account, such as when you get paid. Here is a typical transaction: +

+
+
2004/09/29  My Employer
+    Assets:Checking               $500.00
+    Income:Salary
+
+ +

Money, here, comes from an Income account belonging to ‘My +Employer’, and is transferred to your checking account. The money is +now yours, which makes it an Asset. +

+

Liabilities track money owed to others. This can happen when you +borrow money to buy something, or if you owe someone money. Here is +an example of increasing a MasterCard liability by spending money with +it: +

+
+
2004/09/30  Restaurant
+    Expenses:Dining                $25.00
+    Liabilities:MasterCard
+
+ +

The Dining account balance now shows $25 spent on Dining, and +a corresponding $25 owed on the MasterCard—and therefore shown as +$-25.00. The MasterCard liability shows up as negative because it +offsets the value of your assets. +

+

The combined total of your Assets and Liabilities is your net worth. +So to see your current net worth, use this command: +

+
+
$ ledger balance ^assets ^liabilities
+
+ +
+
             $500.00  Assets:Checking
+             $-25.00  Liabilities:MasterCard
+--------------------
+             $475.00
+
+ +

In a similar vein, your Income accounts show up negative, because they +transfer money from an account in order to increase your +assets. Your Expenses show up positive because that is where the +money went to. The combined total of Income and Expenses is your cash +flow. A positive cash flow means you are spending more than you make, +since income is always a negative figure. To see your current cash +flow, use this command: +

+
+
$ ledger balance ^income ^expenses
+
+ +
+
              $25.00  Expenses:Dining
+            $-500.00  Income:Salary
+--------------------
+            $-475.00
+
+ +

Another common question to ask of your expenses is: How much do I +spend each month on X? Ledger provides a simple way of displaying +monthly totals for any account. Here is an example that summarizes +your monthly automobile expenses: +

+
+
$ ledger -M register -f drewr3.dat expenses:auto
+
+ +
+
11-Jan-01 - 11-Jan-31           Expenses:Auto            $ 5,500.00   $ 5,500.00
+
+ +

This assumes, of course, that you use account names like +‘Expenses:Auto:Gas’ and ‘Expenses:Auto:Repair’. +

+ + + + +
+ + + +

3.3.1 Tracking reimbursable expenses

+ + +

Sometimes you will want to spend money on behalf of someone else, which +will eventually get repaid. Since the money is still yours, it +is really an asset. And since the expenditure was for someone else, you +don’t want it contaminating your Expenses reports. You will need to +keep an account for tracking reimbursements. +

+

This is fairly easy to do in ledger. When spending the money, spend +it to your Assets:Reimbursements, using a different account for +each person or business that you spend money for. For example: +

+
+
2004/09/29  Circuit City
+    Assets:Reimbursements:Company XYZ     $100.00
+    Liabilities:MasterCard
+
+ +

This shows $100.00 spent on a MasterCard at Circuit City, with the +expense was made on behalf of Company XYZ. Later, when Company XYZ +pays the amount back, the money will transfer from that reimbursement +account back to a regular asset account: +

+
+
2004/09/29  Company XYZ
+    Assets:Checking                       $100.00
+    Assets:Reimbursements:Company XYZ
+
+ +

This deposits the money owed from Company XYZ into a checking account, +presumably because they paid the amount back with a check. +

+

But what to do if you run your own business, and you want to keep +track of expenses made on your own behalf, while still tracking +everything in a single ledger file? This is more complex, because you +need to track two separate things: 1) The fact that the money should +be reimbursed to you, and 2) What the expense account was, so that you +can later determine where your company is spending its money. +

+

This kind of posting is best handled with mirrored postings in +two different files, one for your personal accounts, and one for your +company accounts. But keeping them in one file involves the same +kinds of postings, so those are what is shown here. First, the +personal transaction, which shows the need for reimbursement: +

+
+
2004/09/29  Circuit City
+    Assets:Reimbursements:Company XYZ     $100.00
+    Liabilities:MasterCard
+
+ +

This is the same as above, except that you own Company XYZ, and are +keeping track of its expenses in the same ledger file. This +transaction should be immediately followed by an equivalent +transaction, which shows the kind of expense, and also notes the fact +that $100.00 is now payable to you: +

+
+
2004/09/29  Circuit City
+    Company XYZ:Expenses:Computer:Software      $100.00
+    Company XYZ:Accounts Payable:Your Name
+
+ +

This second transaction shows that Company XYZ has just spent $100.00 +on software, and that this $100.00 came from Your Name, which must be +paid back. +

+

These two transactions can also be merged, to make things a little +clearer. Note that all amounts must be specified now: +

+
+
2004/09/29  Circuit City
+    Assets:Reimbursements:Company XYZ         $100.00
+    Liabilities:MasterCard                   $-100.00
+    Company XYZ:Expenses:Computer:Software    $100.00
+    Company XYZ:Accounts Payable:Your Name   $-100.00
+
+ +

To “pay back” the reimbursement, just reverse the order of +everything, except this time drawing the money from a company asset, +paying it to accounts payable, and then drawing it again from the +reimbursement account, and paying it to your personal asset account. +It’s easier shown than said: +

+
+
2004/10/15  Company XYZ
+    Assets:Checking                           $100.00
+    Assets:Reimbursements:Company XYZ        $-100.00
+    Company XYZ:Accounts Payable:Your Name    $100.00
+    Company XYZ:Assets:Checking              $-100.00
+
+ +

And now the reimbursements account is paid off, accounts payable is paid +off, and $100.00 has been effectively transferred from the company’s +checking account to your personal checking account. The money simply +“waited”—in both ‘Assets:Reimbursements:Company XYZ’, and +‘Company XYZ:Accounts Payable:Your Name’—until such time as it +could be paid off. +

+

The value of tracking expenses from both sides like that is that you +do not contaminate your personal expense report with expenses made on +behalf of others, while at the same time making it possible to +generate accurate reports of your company’s expenditures. It is more +verbose than just paying for things with your personal assets, but it +gives you a very accurate information trail. +

+

The advantage to keep these doubled transactions together is that they +always stay in sync. The advantage to keeping them apart is that it +clarifies the transfer’s point of view. To keep the postings in +separate files, just separate the two transactions that were joined +above. For example, for both the expense and the pay-back shown +above, the following four transactions would be created. Two in your +personal ledger file: +

+
+
2004/09/29  Circuit City
+    Assets:Reimbursements:Company XYZ     $100.00
+    Liabilities:MasterCard               $-100.00
+
+2004/10/15  Company XYZ
+    Assets:Checking                       $100.00
+    Assets:Reimbursements:Company XYZ    $-100.00
+
+ +

And two in your company ledger file: +

+
+
apply account Company XYZ
+
+2004/09/29  Circuit City
+    Expenses:Computer:Software            $100.00
+    Accounts Payable:Your Name           $-100.00
+
+2004/10/15  Company XYZ
+    Accounts Payable:Your Name            $100.00
+    Assets:Checking                      $-100.00
+
+end apply account
+
+ +

(Note: The apply account above means that all accounts +mentioned in the file are children of that account. In this case it +means that all activity in the file relates to Company XYZ). +

+

After creating these transactions, you will always know that $100.00 +was spent using your MasterCard on behalf of Company XYZ, and that +Company XYZ spent the money on computer software and paid it back +about two weeks later. +

+
+
$ ledger balance --no-total
+
+ +
+
             $100.00  Assets:Checking
+                   0  Company XYZ
+            $-100.00    Assets:Checking
+             $100.00    Expenses:Computer:Software
+            $-100.00  Liabilities:MasterCard
+
+ +
+ + + +

3.4 Commodities and Currencies

+ +

Ledger makes no assumptions about the commodities you use; it only +requires that you specify a commodity. The commodity may be any +non-numeric string that does not contain a period, comma, forward +slash or at-sign. It may appear before or after the amount, although +it is assumed that symbols appearing before the amount refer to +currencies, while non-joined symbols appearing after the amount refer +to commodities. Here are some valid currency and commodity +specifiers: +

+
+
$20.00         ; currency: twenty US dollars
+40 AAPL        ; commodity: 40 shares of Apple stock
+60 DM          ; currency: 60 Deutsch Mark
+£50            ; currency: 50 British pounds
+50 EUR         ; currency: 50 Euros (or use appropriate symbol)
+
+ +

Ledger will examine the first use of any commodity to determine how +that commodity should be printed on reports. It pays attention to +whether the name of commodity was separated from the amount, whether +it came before or after, the precision used in specifying the amount, +whether thousand marks were used, etc. This is done so that printing +the commodity looks the same as the way you use it. +

+

An account may contain multiple commodities, in which case it will +have separate totals for each. For example, if your brokerage account +contains both cash, gold, and several stock quantities, the balance +might look like: +

+
+
  $200.00
+100.00 AU
+  AAPL 40
+ BORL 100
+ FEQTX 50  Assets:Brokerage
+
+ +

This balance report shows how much of each commodity is in your +brokerage account. +

+

Sometimes, you will want to know the current street value of your +balance, and not the commodity totals. For this to happen, you must +specify what the current price is for each commodity. The price can +be any commodity, in which case the balance will be computed in terms +of that commodity. The usual way to specify prices is with a price +history file, which might look like this: +

+
+
P 2004/06/21 02:18:01 FEQTX $22.49
+P 2004/06/21 02:18:01 BORL $6.20
+P 2004/06/21 02:18:02 AAPL $32.91
+P 2004/06/21 02:18:02 AU $400.00
+
+ + + +

Specify the price history to use with the --price-db FILE +option, with the --market (-V) option to report in terms of +current market value: +

+
+
$ ledger --price-db prices.db -V balance brokerage
+
+ +

The balance for your brokerage account will be reported in US dollars, +since the prices database uses that currency. +

+
+
$40880.00  Assets:Brokerage
+
+ +

You can convert from any commodity to any other commodity. Let’s say +you had $5000 in your checking account, and for whatever reason you +wanted to know how many ounces of gold that would buy, in terms of the +current price of gold: +

+
+
$ ledger -T "{1 AU}*(O/P{1 AU})" balance checking
+
+ +

Although the total expression appears complex, it is simply saying +that the reported total should be in multiples of AU units, where the +quantity is the account total divided by the price of one AU. Without +the initial multiplication, the reported total would still use the +dollars commodity, since multiplying or dividing amounts always keeps +the left value’s commodity. The result of this command might be: +

+
+
14.01 AU  Assets:Checking
+
+ + + + + + +
+ + + +

3.4.1 Commodity price histories

+ +

Whenever a commodity is purchased using a different commodity (such as +a share of common stock using dollars), it establishes a price for +that commodity on that day. It is also possible, by recording price +details in a ledger file, to specify other prices for commodities at +any given time. Such price transactions might look like those below: +

+
+
P 2004/06/21 02:17:58 TWCUX $27.76
+P 2004/06/21 02:17:59 AGTHX $25.41
+P 2004/06/21 02:18:00 OPTFX $39.31
+P 2004/06/21 02:18:01 FEQTX $22.49
+P 2004/06/21 02:18:02 AAPL $32.91
+
+ +

By default, ledger will not consider commodity prices when generating +its various reports. It will always report balances in terms of the +commodity total, rather than the current value of those commodities. +To enable pricing reports, use one of the commodity reporting options. +

+
+ + + +

3.4.2 Commodity equivalences

+ +

Sometimes a commodity has several forms which are all equivalent. An +example of this is time. Whether tracked in terms of minutes, hours +or days, it should be possible to convert between the various forms. +Doing this requires the use of commodity equivalences. +

+

For example, you might have the following two postings, one which +transfers an hour of time into a ‘Billable’ account, and another +which decreases the same account by ten minutes. The resulting report +will indicate that fifty minutes remain: +

+
+
2005/10/01 Work done for company
+    Billable:Client                 1h
+    Project:XYZ
+
+2005/10/02 Return ten minutes to the project
+    Project:XYZ                    10m
+    Billable:Client
+
+ +

Reporting the balance for this ledger file produces: +

+
+
$ ledger --no-total balance Billable Project
+
+ +
+
               50.0m  Billable:Client
+              -50.0m  Project:XYZ
+
+ + + +

This example works because ledger already knows how to handle seconds, +minutes and hours, as part of its time tracking support. Defining +other equivalences is simple. The following is an example that +creates data equivalences, helpful for tracking bytes, kilobytes, +megabytes, and more: +

+
+
C 1.00 Kb = 1024 b
+C 1.00 Mb = 1024 Kb
+C 1.00 Gb = 1024 Mb
+C 1.00 Tb = 1024 Gb
+
+ +

Each of these definitions correlates a commodity (such as ‘Kb’) +and a default precision, with a certain quantity of another commodity. +In the above example, kilobytes are reported with two decimal places +of precision and each kilobyte is equal to 1024 bytes. +

+

Equivalence chains can be as long as desired. Whenever a commodity +would report as a decimal amount (less than ‘1.00’), the next +smallest commodity is used. If a commodity could be reported in terms +of a higher commodity without resulting to a partial fraction, then +the larger commodity is used. +

+
+ + + +

3.5 Accounts and Inventories

+ +

Since Ledger’s accounts and commodity system is so flexible, you can +have accounts that don’t really exist, and use commodities that no one +else recognizes. For example, let’s say you are buying and selling +various items in EverQuest, and want to keep track of them using a +ledger. Just add items of whatever quantity you wish into your +EverQuest account: +

+
+
9/29  Get some stuff at the Inn
+    Places:Black's Tavern                   -3 Apples
+    Places:Black's Tavern                   -5 Steaks
+    EverQuest:Inventory
+
+ +

Now your EverQuest:Inventory has 3 apples and 5 steaks in it. The +amounts are negative, because you are taking from Black’s +Tavern in order to add to your Inventory account. Note that you don’t +have to use ‘Places:Black's Tavern’ as the source account. You +could use ‘EverQuest:System’ to represent the fact that you +acquired them online. The only purpose for choosing one kind of +source account over another is to generate more informative reports +later on. The more you know, the better the analysis you can perform. +

+

If you later sell some of these items to another player, the +transaction would look like: +

+
+
10/2  Sturm Brightblade
+    EverQuest:Inventory                     -2 Steaks
+    EverQuest:Inventory                     15 Gold
+
+ +

Now you’ve turned 2 steaks into 15 gold, courtesy of your customer, +Sturm Brightblade. +

+
+
$ ledger balance EverQuest
+
+ +
+
            3 Apples
+             15 Gold
+            3 Steaks  EverQuest:Inventory
+
+ +
+ + + +

3.6 Understanding Equity

+ +

The most confusing transaction in any ledger will be your equity +account—because starting balances can’t come out of nowhere. +

+

When you first start your ledger, you will likely already have money +in some of your accounts. Let’s say there’s $100 in your checking +account; then add a transaction to your ledger to reflect this amount. +Where will the money come from? The answer: your equity. +

+
+
10/2  Opening Balance
+    Assets:Checking                         $100.00
+    Equity:Opening Balances
+
+ +

But what is equity? You may have heard of equity when people talked +about house mortgages, as “the part of the house that you own”. +Basically, equity is like the value of something. If you own a car +worth $5000, then you have $5000 in equity in that car. In order to +turn that car (a commodity) into a cash flow, or a credit to your bank +account, you will have to debit the equity by selling it. +

+

When you start a ledger, you probably already have a net worth. +Your net worth is your current equity. By transferring the money in +the ledger from your equity to your bank accounts, you are crediting +the ledger account based on your prior equity. That is why, when you +look at the balance report, you will see a large negative number for +Equity that never changes: Because that is what you were worth (what +you debited from yourself in order to start the ledger) before the +money started moving around. If the total positive value of your +assets is greater than the absolute value of your starting equity, it +means you are making money. +

+

Clear as mud? Keep thinking about it. Until you figure it out, put +not Equity at the end of your balance command, to remove the +confusing figure from the total. +

+
+ + + +

3.7 Dealing with Petty Cash

+ +

Something that stops many people from keeping a ledger at all is the +insanity of tracking small cash expenses. They rarely generate a +receipt, and there are often a lot of small postings, rather than +a few large ones, as with checks. +

+

One solution is: don’t bother. Move your spending to a debit card, +but in general ignore cash. Once you withdraw it from the ATM, mark +it as already spent to an ‘Expenses:Cash’ category: +

+
+
2004/03/15 ATM
+    Expenses:Cash                      $100.00
+    Assets:Checking
+
+ +

If at some point you make a large cash expense that you want to track, +just move the amount of the expense from ‘Expenses:Cash’ +into the target account: +

+
+
2004/03/20 Somebody
+    Expenses:Food                       $65.00
+    Expenses:Cash
+
+ +

This way, you can still track large cash expenses, while ignoring all +of the smaller ones. +

+
+ + + +

3.8 Working with multiple funds and accounts

+ +

There are situations when the accounts you’re tracking are different +between your clients and the financial institutions where money is +kept. An example of this is working as the treasurer for a religious +institution. From the secular point of view, you might be working +with three different accounts: +

+
    +
  • Checking +
  • Savings +
  • Credit Card +
+ +

From a religious point of view, the community expects to divide its +resources into multiple “funds”, from which it makes purchases or +reserves resources for later: +

+
    +
  • School fund +
  • Building fund +
  • Community fund +
+ +

The problem with this kind of setup is that, when you spend money, it +comes from two or more places at once: the account and the fund. And +yet, the correlation of amounts between funds and accounts is rarely +one-to-one. What if the school fund has ‘$500.00’, but +‘$400.00’ of that comes from Checking, and ‘$100.00’ from +Savings? +

+

Traditional finance packages require that the money reside in only one +place. But there are really two “views” of the data: from the +account point of view and from the fund point of view—yet both sets +should reflect the same overall expenses and cash flow. It’s simply +where the money resides that differs. +

+

This situation can be handled in one of two ways. The first is using +virtual postings to represent the fact that money is moving to and +from two kind of accounts at the same time: +

+
+
2004/03/20 Contributions
+    Assets:Checking                    $500.00
+    Income:Donations
+
+2004/03/25 Distribution of donations
+    [Funds:School]                     $300.00
+    [Funds:Building]                   $200.00
+    [Assets:Checking]                 $-500.00
+
+ +

The use of square brackets in the second transaction ensures that the +virtual postings balance to zero. Now money can be spent directly +from a fund at the same time as money is drawn from a physical +account: +

+
+
2004/03/25 Payment for books (paid from Checking)
+    Expenses:Books                    $100.00
+    Assets:Checking                  $-100.00
+    (Funds:School)                   $-100.00
+
+ +

The use of round brackets creates a virtual posting without ensuring +a balance to zero. When reports are generated, by default they’ll +appear in terms of the funds. In this case, you will likely want to +mask out your ‘Assets’ account, because otherwise the balance +won’t make much sense: +

+
+
$ ledger --no-total bal not ^Assets
+
+ +
+
             $100.00  Expenses:Books
+             $400.00  Funds
+             $200.00    Building
+             $200.00    School
+            $-500.00  Income:Donations
+
+ + +

If the --real option is used, the report will be in terms of +the real accounts: +

+
+
$ ledger --real --no-total bal
+
+ +
+
             $400.00  Assets:Checking
+             $100.00  Expenses:Books
+            $-500.00  Income:Donations
+
+ +

If more asset accounts are needed as the source of a posting, just +list them as you would normally, for example: +

+
+
2004/03/25 Payment for books (paid from Checking)
+    Expenses:Books                    $100.00
+    Assets:Checking                   $-50.00
+    Liabilities:Credit Card           $-50.00
+    (Funds:School)                   $-100.00
+
+ +

The second way of tracking funds is to use transaction codes. In this +respect the codes become like virtual accounts that embrace the entire +set of postings. Basically, we are associating a transaction with a +fund by setting its code. Here are two transactions that deposit money +into, and spend money from, the ‘Funds:School’ fund: +

+
+
2004/03/25 (Funds:School) Donations
+    Assets:Checking                   $100.00
+    Income:Donations
+
+2004/03/25 (Funds:Building) Donations
+    Assets:Checking                   $20.00
+    Income:Donations
+
+2004/04/25 (Funds:School) Payment for books
+    Expenses:Books                     $50.00
+    Assets:Checking
+
+ +

Note how the accounts now relate only to the real accounts, and any +balance or register reports will reflect this. That the transactions +relate to a particular fund is kept only in the code. +

+ + +

How does this become a fund report? By using the +--payee=code option, you can generate a register report +where the payee for each posting shows the code. Alone, this is not +terribly interesting; but when combined with the --by-payee +(-P) option, you will now see account subtotals for any postings +related to a specific fund. So, to see the current monetary balances of +all funds, the command would be: +

+
+
$ ledger --payee=code -P reg ^Assets
+
+ +
+
04-Mar-25 Funds:Building        Assets:Checking              $20.00       $20.00
+04-Mar-25 Funds:School          Assets:Checking              $50.00       $70.00
+
+ +

Or to see a particular fund’s expenses, the ‘School’ fund in this +case: +

+
+
$ ledger --payee=code -P reg ^Expenses and code School
+
+ +
+
04-Apr-25 Funds:School          Expenses:Books               $50.00       $50.00
+
+ +

Both approaches yield different kinds of flexibility, depending on how +you prefer to think of your funds: as virtual accounts, or as tags +associated with particular transactions. Your own tastes will decide +which is best for your situation. +

+
+ + + +

4 Keeping a Journal

+ +

The most important part of accounting is keeping a good journal. If +you have a good journal, tools can be written to work whatever +mathematical tricks you need to better understand your spending +patterns. Without a good journal, no tool, however smart, can help +you. +

+

The Ledger program aims at making journal transactions as simple as +possible. Since it is a command-line tool, it does not provide a user +interface for keeping a journal. If you require an user interface to +maintain journal transactions GnuCash is a good alternative. +

+

If you are not using GnuCash, but a text editor to maintain your +journal, read on. Ledger has been designed to make data transactions +as simple as possible, by keeping the journal format easy, and also by +automagically determining as much information as possible based on the +nature of your transactions. +

+

For example, you do not need to tell Ledger about the accounts you +use. Any time Ledger sees a posting involving an account it knows +nothing about, it will create it2. If you +use a commodity that is new to Ledger, it will create that commodity, +and determine its display characteristics (placement of the symbol +before or after the amount, display precision, etc.) based on how you +used the commodity in the posting. +

+ + + + + + + + + + + + +
+ + + +

4.1 The Most Basic Entry

+ +

Here is the Pacific Bell example from above, given as a Ledger +posting, with the addition of a check number: +

+
+
9/29 (1023) Pacific Bell
+    Expenses:Utilities:Phone                   $23.00
+    Assets:Checking                           $-23.00
+
+ +

As you can see, it is very similar to what would be written on paper, +minus the computed balance totals, and adding in account names that +work better with Ledger’s scheme of things. In fact, since Ledger is +smart about many things, you don’t need to specify the balanced +amount, if it is the same as the first line: +

+
+
9/29 (1023) Pacific Bell
+    Expenses:Utilities:Phone                   $23.00
+    Assets:Checking
+
+ +

For this transaction, Ledger will figure out that $-23.00 must come +from ‘Assets:Checking’ in order to balance the transaction. +

+

Also note the structure of the account entries. There is an implied +hierarchy established by separating with colons (see Structuring your Accounts). +

+ + + +

The format is very flexible and it isn’t necessary that you +indent and space out things exactly as shown. The only requirements +are that the start of the transaction (the date typically) is at the +beginning of the first line of the transaction, and the accounts are +indented by at least one space. If you omit the leading spaces in the +account lines Ledger will generate an error. There must be at least +two spaces, or a tab, between the amount and the account. If you do +not have adequate separation between the amount and the account Ledger +will give an error and stop calculating. +

+
+ + + +

4.2 Starting up

+ + + + +

Unless you have recently arrived from another planet, you already have +a financial state. You need to capture that financial state so that +Ledger has a starting point. +

+

At some convenient point in time you knew the balances and outstanding +obligation of every financial account you have. Those amounts form the +basis of the opening entry for ledger. For example if you chose the +beginning of 2011 as the date to start tracking finances with ledger, +your opening balance entry could look like this: +

+
+
2011/01/01 * Opening Balance
+    Assets:Joint Checking                   $800.14
+    Assets:Other Checking                    $63.44
+    Assets:Savings                         $2805.54
+    Assets:Investments:401K:Deferred         100.0000 VIFSX @ $80.5227
+    Assets:Investments:401K:Matching          50.0000 VIFSX @ $83.7015
+    Assets:Investments:IRA                   250.0000 VTHRX @ $20.5324
+    Liabilities:Mortgage                $-175634.88
+    Liabilities:Car Loan                  $-3494.26
+    Liabilities:Visa                      -$1762.44
+    Equity:Opening Balances
+
+ +

There is nothing special about the name “Opening Balances” as the +payee of the account name, anything convenient that you understand will +work. +

+
+ + + +

4.3 Structuring your Accounts

+ + + +

There really are no requirements for how you do this, but to preserve +your sanity we suggest some very basic structure to your accounting +system. +

+

At the highest level you have five sorts of accounts: +

+
    +
  1. Expenses: where money goes, +
  2. Assets: where money sits, +
  3. Income: where money comes from, +
  4. Liabilities: money you owe, +
  5. Equity: the real value of your property. +
+ +

Starting the structure off this way will make it simpler for you to get +answers to the questions you really need to ask about your finances. +

+

Beneath these top level accounts you can have any level of detail you +desire. For example, if you want to keep specific track of how much +you spend on burgers and fries, you could have the following: +

+
+
Expenses:Food:Hamburgers and Fries
+
+ +
+ + + +

4.4 Commenting on your Journal

+ + + + +

Comments are generally started using a ‘;’. However, in order to +increase compatibility with other text manipulation programs and +methods, four additional comment characters are valid if used at the +beginning of a line: ‘#’, ‘|’, and ‘*’ and ‘%’. +

+

Block comments can be made by use comment ... end +comment. +

+
+
; This is a single line comment,
+#  and this,
+%   and this,
+|    and this,
+*     and this.
+
+comment
+    This is a block comment with
+    multiple lines
+end comment
+
+ +

There are several forms of comments within a transaction, for example: +

+
+
; this is a global comment that is not applied to a specific transaction
+; it can start with any of the five characters but is not included in the
+; output from 'print' or 'output'
+
+2011/12/11  Something Sweet
+    ; German Chocolate Cake
+    ; :Broke Diet:
+    Expenses:Food                  $10.00 ; Friends: The gang
+    Assets:Credit Union:Checking
+
+ +

The first comment is global and Ledger will not attach it to any +specific transactions. The comments within the transaction must all +start with ‘;’ and are preserved as part of the transaction. The +‘:’ indicates meta-data and tags (see Metadata). +

+
+ + + +

4.5 Currency and Commodities

+ + + +

Ledger is agnostic when it comes to how you value your accounts. +Dollars, Euros, Pounds, Francs, Shares etc. are all just “commodities”. +Holdings in stocks, bonds, mutual funds and other financial +instruments can be labeled using whatever is convenient for you (stock +ticker symbols are suggested for publicly traded assets).3 +

+

For the rest of this manual, we will only use the word “commodities” +when referring to the units on a transaction value. +

+

This is fundamentally different than many common accounting packages, +which assume the same currency throughout all of your accounts. This +means if you typically operate in Euros, but travel to the US and have +some expenses, you would have to do the currency conversion +before you made the entry into your financial system. With +ledger this is not required. In the same journal you can have entries +in any or all commodities you actually hold. You can use the +reporting capabilities to convert all commodities to a single +commodity for reporting purposes without ever changing the underlying +entry. +

+

For example, the following entries reflect transactions made for a +business trip to Europe from the US: +

+
+
2011/09/23 Cash in Munich
+    Assets:Cash                               €50.00
+    Assets:Checking                          $-66.00
+
+2011/09/24 Dinner in Munich
+    Expenses:Business:Travel                  €35.00
+    Assets:Cash
+
+ +

This says that $66.00 came out of checking and turned into 50 +Euros. The implied exchange rate was $1.32. Then 35.00 Euros were +spent on Dinner in Munich. +

+

Running a ledger balance report shows: +

+
+
$ ledger -f example.dat bal
+
+ +
+
             $-66.00
+              €15.00  Assets
+              €15.00    Cash
+             $-66.00    Checking
+              €35.00  Expenses:Business:Travel
+--------------------
+             $-66.00
+              €50.00
+
+ +

The top two lines show my current assets as $-66.00 in checking (in +this very short example I didn’t establish opening an opening balance +for the checking account) and €15.00. After spending on dinner I have +€15.00 in my wallet. The bottom line balances to zero, but is shown +in two lines since we haven’t told ledger to convert commodities. +

+ + + + + + + +
+ + + +

4.5.1 Naming Commodities

+ +

Commodity names can have any character, including white-space. +However, if you include white-space or numeric characters, the +commodity name must be enclosed in double quotes ‘"’: +

+
+
1999/06/09 ! Achat
+    Actif:SG PEE STK         49.957 "Arcancia Équilibre 454"
+    Actif:SG PEE STK      $-234.90
+
+2000/12/08 ! Achat
+    Actif:SG PEE STK        215.796 "Arcancia Équilibre 455"
+    Actif:SG PEE STK    $-10742.54
+
+ +
+ + + +

4.5.2 Buying and Selling Stock

+ + +

Buying stock is a typical example that many will use that involves +multiple commodities in the same transaction. The type of the share +(AAPL for Apple Inc.) and the share purchase price in the currency +unit you made the purchase in ($ for AAPL). Yes, the typical +convention is as follows: +

+
+
2004/05/01 Stock purchase
+    Assets:Broker                     50 AAPL @ $30.00
+    Expenses:Broker:Commissions        $19.95
+    Assets:Broker                  $-1,519.95
+
+ +

This assumes you have a brokerage account that is capable of managing +both liquid and commodity assets. Now, on the day of the sale: +

+
+
2005/08/01 Stock sale
+    Assets:Broker                    -50 AAPL {$30.00} @ $50.00
+    Expenses:Broker:Commissions        $19.95
+    Income:Capital Gains           $-1,000.00
+    Assets:Broker                   $2,480.05
+
+ +

You can, of course, elide the amount of the last posting. It is there +for clarity’s sake. +

+

The ‘{$30.00}’ is a lot price. You can also use a lot date, +‘[2004/05/01]’, or both, in case you have several lots of the +same price/date and your taxation model is based on +longest-held-first. +

+
+ + + +

4.5.3 Fixing Lot Prices

+ + + +

Commodities that you keep in order to sell at a later time have +a variable value that fluctuates with the market prices. Commodities +that you consume should not fluctuate in value, but stay at the lot +price they were purchased at. As an extension of “lot pricing”, you +can fix the per-unit price of a commodity. +

+

For example, say you buy 10 gallons of gas at $1.20. In future +“value” reports, you don’t want these gallons reported in terms of +today’s price, but rather the price when you bought it. At the same +time, you also want other kinds of commodities—like stocks— +reported in terms of today’s price. +

+

This is supported as follows: +

+
+
2009/01/01 Shell
+    Expenses:Gasoline             11 GAL {=$2.299}
+    Assets:Checking
+
+ +

This transaction actually introduces a new commodity, ‘GAL +{=$2.29}’, whose market value disregards any future changes in the +price of gasoline. +

+

If you do not want price fixing, you can specify this same transaction +in one of two ways, both equivalent (note the lack of the equal sign +compared to the transaction above): +

+
+
2009/01/01 Shell
+    Expenses:Gasoline             11 GAL {$2.299}
+    Assets:Checking
+
+2009/01/01 Shell
+    Expenses:Gasoline             11 GAL @ $2.299
+    Assets:Checking
+
+ +

There is no difference in meaning between these two forms. Why do +both exist, you ask? To support things like this: +

+
+
2009/01/01 Shell
+    Expenses:Gasoline             11 GAL {=$2.299} @ $2.30
+    Assets:Checking
+
+ +

This transaction says that you bought 11 gallons priced at $2.299 per +gallon at a cost to you of $2.30 per gallon. Ledger +auto-generates a balance posting in this case to Equity:Capital Losses +to reflect the 1.1 cent difference, which is then balanced by +Assets:Checking because its amount is null. +

+
+ + + +

4.5.4 Complete control over commodity pricing

+ + + +

Ledger allows you to have very detailed control over how your +commodities are valued. You can fine tune the results given using the +--market or --exchange COMMODITY options. There +are now several points of interception; you can specify the valuation +method: +

+
    +
  1. on a commodity itself, +
  2. on a posting, via metadata (effect is largely the same as #1), +
  3. on an xact, which then applies to all postings in that xact, +
  4. on any posting via an automated transaction, +
  5. on a per-account basis, +
  6. on a per-commodity basis, +
  7. by changing the journal default of market. +
+ +

Fixated pricing (such as ‘{=$20}’) still plays a role in this +scheme. As far as valuation goes, it’s shorthand for writing +‘((s,d,t -> market($20,d,t)))’. +

+

A valuation function receives three arguments: +

+
+
source
+

A string identifying the commodity whose price is being asked for +(example: ‘EUR’). +

+
+
date
+

The reference date the price should be relative. +

+
+
target
+

A string identifying the “target” commodity, or the commodity the +returned price should be in. This argument is null if --market +was used instead of --exchange COMMODITY. +

+
+
+ +

The valuation function should return an amount. If you’ve written +your function in Python, you can return something like +‘Amount("$100")’. If the function returns an explicit value, +that value is always used, regardless of the commodity, the date, or +the desired target commodity. For example, +

+
+
define myfunc_seven(s, d, t) = 7 EUR
+
+ +

In order to specify a fixed price, but still valuate that price into +the target commodity, use something like this: +

+
+
define myfunc_five(s, d, t) = market(5 EUR, d, t)
+
+ +

The value directive sets the valuation used for all commodities +used in the rest of the data stream. This is the fallback, if nothing +more specific is found. +

+
+
value myfunc_seven
+
+ +

You can set a specific valuation function on a per-commodity basis. +Instead of defining a function, you can also pass a lambda. +

+
+
commodity $
+    value s, d, t -> 6 EUR
+
+ +

Each account can also provide a default valuation function for any +commodities transferred to that account. +

+
+
account Expenses:Food5
+    value myfunc_five
+
+ +

The metadata field ‘Value’, if found, overrides the valuation +function on a transaction-wide or per-posting basis. +

+
+
= @XACT and Food
+    ; Value:: 8 EUR
+    (Equity)                     $1
+
+= @POST and Dining
+    (Expenses:Food9)             $1
+        ; Value:: 9 EUR
+
+ +

Lastly, you can specify the valuation function/value for any specific +amount using the ‘(( ))’ commodity annotation. +

+
+
2012-03-02 KFC
+    Expenses:Food2               $1 ((2 EUR))
+    Assets:Cash2
+
+2012-03-03 KFC
+    Expenses:Food3               $1
+        ; Value:: 3 EUR
+    Assets:Cash3
+
+2012-03-04 KFC
+    ; Value:: 4 EUR
+    Expenses:Food4               $1
+    Assets:Cash4
+
+2012-03-05 KFC
+    Expenses:Food5               $1
+    Assets:Cash5
+
+2012-03-06 KFC
+    Expenses:Food6               $1
+    Assets:Cash6
+
+2012-03-07 KFC
+    Expenses:Food7                1 CAD
+    Assets:Cash7
+
+2012-03-08 XACT
+    Expenses:Food8               $1
+    Assets:Cash8
+
+2012-03-09 POST
+    Expenses:Dining9             $1
+    Assets:Cash9
+
+ +
+
$ ledger reg -V food
+
+ +
+
12-Mar-02 KFC                   Expenses:Food2                2 EUR        2 EUR
+12-Mar-03 KFC                   Expenses:Food3                3 EUR        5 EUR
+12-Mar-04 KFC                   Expenses:Food4                4 EUR        9 EUR
+12-Mar-05 KFC                   Expenses:Food5                   $1           $1
+                                                                           9 EUR
+12-Mar-06 KFC                   Expenses:Food6                   $1           $2
+                                                                           9 EUR
+12-Mar-07 KFC                   Expenses:Food7                1 CAD           $2
+                                                                           1 CAD
+                                                                           9 EUR
+12-Mar-08 XACT                  Expenses:Food8                   $1           $3
+                                                                           1 CAD
+                                                                           9 EUR
+
+ +
+ + + +

4.6 Keeping it Consistent

+ + + +

Sometimes Ledger’s flexibility can lead to difficulties. Using a +freeform text editor to enter transactions makes it easy to keep the +data, but also easy to enter accounts or payees inconsistently or with +spelling errors. +

+

In order to combat inconsistency you can define allowable accounts and +payees. For simplicity, create a separate text file and define accounts +and payees like +

+
+
account Expenses
+account Expenses:Utilities
+
+ +

Using the --strict option will cause Ledger to complain if any +accounts are not previously defined: +

+
+
$ ledger bal --strict
+Warning: "FinanceData/Master.dat", line 6: Unknown account 'Liabilities:Tithe Owed'
+Warning: "FinanceData/Master.dat", line 8: Unknown account 'Liabilities:Tithe Owed'
+Warning: "FinanceData/Master.dat", line 15: Unknown account 'Allocation:Equities:Domestic'
+
+ +

If you have a large Ledger register already created use the +accounts command to get started: +

+
+
$ ledger accounts >> Accounts.dat
+
+ +

You will have to edit this file to add the account directive in +front of every line. +

+
+ + + +

4.7 Journal Format

+ +

The ledger file format is quite simple, but also very flexible. It +supports many options, though typically the user can ignore most of +them. They are summarized below. +

+ + + + + +
+ + + +

4.7.1 Transactions and Comments

+ +

The initial character of each line determines what the line means, and +how it should be interpreted. Allowable initial characters are: +

+
+
NUMBER
+

A line beginning with a number denotes a transaction. It may be +followed by any number of lines, each beginning with white-space, to +denote the transaction’s account postings. The format of the first +line is: +

+
+
DATE[=EDATE] [*|!] [(CODE)] DESC
+
+ +

If ‘*’ appears after the date (with optional effective date), it +indicates the transaction is “cleared”, which can mean whatever the +user wants it to mean. If ‘!’ appears after the date, it +indicates the transaction is “pending”; i.e., tentatively cleared +from the user’s point of view, but not yet actually cleared. If +a CODE appears in parentheses, it may be used to indicate +a check number, or the type of the posting. Following these is the +payee, or a description of the posting. +

+

The format of each following posting is: +

+
+
  ACCOUNT  AMOUNT  [; NOTE]
+
+ +

The ACCOUNT may be surrounded by parentheses if it is a virtual +posting, or square brackets if it is a virtual posting that +must balance. The AMOUNT can be followed by a per-unit +posting cost, by specifying @ AMOUNT, or a complete +posting cost with @@ AMOUNT. Lastly, the NOTE may +specify an actual and/or effective date for the posting by using +the syntax [ACTUAL_DATE] or [=EFFECTIVE_DATE] or +[ACTUAL_DATE=EFFECTIVE_DATE] (see Virtual postings). +

+
+
P
+
+ + +

Specifies a historical price for a commodity. These are usually found +in a pricing history file (see the --download (-Q) option). +The syntax is: +

+
+
P DATE SYMBOL PRICE
+
+ +
+
=
+
+ + +

An automated transaction. A value expression must appear after the +equal sign. +

+

After this initial line there should be a set of one or more postings, +just as if it were a normal transaction. If the amounts of the postings +have no commodity, they will be applied as multipliers to whichever real +posting is matched by the value expression (see Automated Transactions). +

+
+
~
+
+ + +

A periodic transaction. A period expression must appear after the tilde. +

+

After this initial line there should be a set of one or more +postings, just as if it were a normal transaction. +

+
+
; # % | *
+
+ +

A line beginning with a semicolon, pound, percent, bar or asterisk +indicates a comment, and is ignored. Comments will not be returned in +a “print” response. +

+
+
indented ;
+
+

If the semicolon is indented and occurs inside a transaction, it is +parsed as a persistent note for its preceding category. These notes or +tags can be used to augment the reporting and filtering capabilities of +Ledger. +

+
+
+ +
+ + + +

4.7.2 Command Directives

+ + + +
+
beginning of line
+

Command directives must occur at the beginning of a line. Use of +‘!’ and ‘@’ is deprecated. +

+
+
account
+
+ +

Pre-declare valid account names. This only has an effect if +--strict or --pedantic is used (see below). The +account directive supports several optional sub-directives, if +they immediately follow the account directive and if they begin with +whitespace: +

+
+
account Expenses:Food
+    note This account is all about the chicken!
+    alias food
+    payee ^(KFC|Popeyes)$
+    check commodity == "$"
+    assert commodity == "$"
+    eval print("Hello!")
+    default
+
+ +

The note sub-directive associates a textual note with the +account. This can be accessed later using the note value +expression function in any account context. +

+

The alias sub-directive, which can occur multiple times, allows +the alias to be used in place of the full account name anywhere that +account names are allowed. +

+

The payee sub-directive, which can occur multiple times, +provides regexes that identify the account if that payee is +encountered and an account within its transaction ends in the name +"Unknown". Example: +

+
+
2012-02-27 KFC
+    Expenses:Unknown      $10.00  ; Read now as "Expenses:Food"
+    Assets:Cash
+
+ +

The check and assert directives warn or raise an error +(respectively) if the given value expression evaluates to false within +the context of any posting. +

+

The eval directive evaluates the value expression in the +context of the account at the time of definition. At the moment this +has little value. +

+

The default directive specifies that this account should be +used as the “balancing account” for any future transactions that +contain only a single posting. +

+
+
apply account
+
+

Sets the root for all accounts following this directive. Ledger +supports a hierarchical tree of accounts. It may be convenient to +keep two “root accounts”. For example you may be tracking your +personal finances and your business finances. In order to keep them +separate you could preface all personal accounts with ‘personal:’ +and all business accounts with ‘business:’. You can easily split +out large groups of transactions without manually editing them using +the account directive. For example: +

+
+
apply account Personal
+2011/11/15  Supermarket
+    Expenses:Groceries      $ 50.00
+    Assets:Checking
+
+ +

Would result in all postings going into +‘Personal:Expenses:Groceries’ and ‘Personal:Assets:Checking’ +until an ‘end apply account’ directive was found. +

+
+
apply fixed
+
+ + +

A fixed block is used to set fixated prices (see Fixated prices and costs) for a series of transactions. It’s purely a typing saver, for +use when entering many transactions with fixated prices. +

+

Thus, the following: +

+
+
apply fixed CAD $0.90
+2012-04-10 Lunch in Canada
+    Assets:Wallet            -15.50 CAD
+    Expenses:Food            15.50 CAD
+
+2012-04-11 Second day Dinner in Canada
+    Assets:Wallet            -25.75 CAD
+    Expenses:Food            25.75 CAD
+end apply fixed
+
+ +

is equivalent to this: +

+
+
2012-04-10 Lunch in Canada
+    Assets:Wallet            -15.50 CAD {=$0.90}
+    Expenses:Food            15.50 CAD  {=$0.90}
+
+2012-04-11 Second day Dinner in Canada
+    Assets:Wallet            -25.75 CAD  {=$0.90}
+    Expenses:Food            25.75 CAD   {=$0.90}
+
+ +
+
alias
+
+ +

Define an alias for an account name. If you have a deeply nested tree +of accounts, it may be convenient to define an alias, for example: +

+
+
alias Dining=Expenses:Entertainment:Dining
+alias Checking=Assets:Credit Union:Joint Checking Account
+
+2011/11/28 YummyPalace
+    Dining        $10.00
+    Checking
+
+ +

The aliases are only in effect for transactions read in after the alias +is defined and are affected by account directives that precede +them. +

+
+
$ ledger bal --no-total ^Exp
+
+ +
+
              $10.00  Expenses:Entertainment:Dining
+
+ +

With the option --recursive-aliases, aliases can refer to other +aliases, the following example produces exactly the same transactions +and account names as the preceding one: +

+
+
alias Entertainment=Expenses:Entertainment
+alias Dining=Entertainment:Dining
+alias Checking=Assets:Credit Union:Joint Checking Account
+
+2011/11/30 ChopChop
+  Dining          $10.00
+  Checking
+
+ +
+
$ ledger balance --no-total --recursive-aliases ^Exp
+
+ +
+
              $10.00  Expenses:Entertainment:Dining
+
+ +

The option --no-aliases completely disables alias expansion. +All accounts are read verbatim as they are in the ledger file. +

+
+
assert
+
+ +

An assertion can throw an error if a condition is not met during +Ledger’s run. +

+
+
assert <VALUE EXPRESSION BOOLEAN RESULT>
+
+ +
+
bucket
+
+ +

Defines the default account to use for balancing transactions. +Normally, each transaction has at least two postings, which must +balance to zero. Ledger allows you to leave one posting with no +amount and automatically balance the transaction in the +posting. The bucket allows you to fill in all postings and +automatically generate an additional posting to the bucket account +balancing the transaction. If any transaction is unbalanced, it +will automatically be balanced against the bucket account. +The following example sets ‘Assets:Checking’ as the bucket: +

+
+
bucket Assets:Checking
+2011/01/25 Tom's Used Cars
+    Expenses:Auto                    $ 5,500.00
+
+2011/01/27 Book Store
+    Expenses:Books                       $20.00
+
+2011/12/01 Sale
+    Assets:Checking:Business            $ 30.00
+
+ +
+
capture
+
+ + + +

Directs Ledger to replace any account matching a regex with the given +account. For example: +

+
+
capture  Expenses:Deductible:Medical  Medical
+
+ +

Would cause any posting with ‘Medical’ in its name to be replaced +with ‘Expenses:Deductible:Medical’. +

+

Ledger will display the mapped payees in print and +register reports. +

+
+
check
+
+ +

A check issues a warning if a condition is not met during Ledger’s +run. +

+
+
check <VALUE EXPRESSION BOOLEAN RESULT>
+
+ +
+
comment
+
+ +

Start a block comment, closed by end comment. +

+
+
commodity
+
+ +

Pre-declare commodity names. This only has an effect if +--strict or --pedantic is used (see below). +

+
+
commodity $
+commodity CAD
+
+ +

The commodity directive supports several optional +sub-directives, if they immediately follow the commodity directive +and—if they are on successive lines—begin with whitespace: +

+
+
commodity $
+   note American Dollars
+   format $1,000.00
+   nomarket
+   alias USD
+   default
+
+ +

The note sub-directive associates a textual note with the +commodity. At present this has no value other than documentation. +

+

The format sub-directive gives you a way to tell Ledger how to +format this commodity. In the future, using this directive will disable +Ledger’s observation of other ways that commodity is used, and will +provide the “canonical” representation. +

+

The nomarket sub-directive states that the commodity’s price +should never be auto-downloaded. +

+

The alias sub-directive states that any commodity matching this +symbol is to use the commodity declared in this block. +

+

The default sub-directive marks this as the “default” commodity. +

+
+
define
+
+

Allows you to define value expressions for future use. For example: +

+
+
define var_name=$100
+
+2011/12/01 Test
+    Expenses  (var_name*4)
+    Assets
+
+ +

The posting will have a cost of $400. +

+
+
end
+
+

Closes block commands like apply or comment. +

+
+
expr
+
+ +
+
include
+
+

Include the stated file as if it were part of the current file. The file +name can contain a wildcard (‘*’) to refer to multiple files (e.g. +‘bank/*.ledger’). +

+
+
payee
+
+ + + +

The payee directive supports two optional sub-directives, if they +immediately follow the payee directive and—if it is on a successive +line—begins with whitespace: +

+
+
payee KFC
+    alias KENTUCKY FRIED CHICKEN
+    uuid 2a2e21d434356f886c84371eebac6e44f1337fda
+
+ +

The alias sub-directive provides a regex which, if it matches +a parsed payee, the declared payee name is substituted: +

+
+
2012-02-27 KENTUCKY FRIED CHICKEN  ; will be read as being 'KFC'
+
+ +

The uuid sub-directive specifies that a transaction with exactly +the uuid given should have the declared payee name substituted: +

+
+
2014-05-13 UNHELPFUL PAYEE  ; will be read as being 'KFC'
+    ; UUID: 2a2e21d434356f886c84371eebac6e44f1337fda
+
+ +

Ledger will display the mapped payees in print and +register reports. +

+
+
apply tag
+
+

Allows you to designate a block of transactions and assign the same +tag to all. Tags can have values and may be nested. +

+
+
apply tag hastag
+apply tag nestedtag: true
+
+2011/01/25 Tom's Used Cars
+    Expenses:Auto                    $ 5,500.00
+    ; :nobudget:
+    Assets:Checking
+
+2011/01/27 Book Store
+    Expenses:Books                       $20.00
+    Liabilities:MasterCard
+
+end apply tag
+
+2011/12/01 Sale
+    Assets:Checking:Business            $ 30.00
+    Income:Sales
+
+end apply tag
+
+ +

is the equivalent of: +

+
+
2011/01/25 Tom's Used Cars
+    ; :hastag:
+    ; nestedtag: true
+    Expenses:Auto                    $ 5,500.00
+    ; :nobudget:
+    Assets:Checking
+
+2011/01/27 Book Store
+    ; :hastag:
+    ; nestedtag: true
+    Expenses:Books                       $20.00
+    Liabilities:MasterCard
+
+2011/12/01 Sale
+    ; :hastag:
+    Assets:Checking:Business            $ 30.00
+    Income:Sales
+
+ + + +
+
tag
+
+ +

Pre-declares tag names. This only has an effect if --strict or +--pedantic is used (see below). +

+
+
tag Receipt
+tag CSV
+
+ +

The tag directive supports two optional sub-directives, if they +immediately follow the tag directive and—if on a successive +line—begin with whitespace: +

+
+
tag Receipt
+  check value =~ /pattern/
+  assert value != "foobar"
+
+ +

The check and assert sub-directives warn or error +(respectively) if the given value expression evaluates to false within +the context of any use of the related tag. In such a context, +“value” is bound to the value of the tag (which may be something else +but a string if typed metadata is used!). Such checks or assertions are +not called if no value is given. +

+
+
test
+
+ +

This is a synonym for comment and must be closed by an +end tag. +

+
+
year
+
+

Denotes the year used for all subsequent transactions that give a date +without a year. The year should appear immediately after the +directive, for example: year 2004. This is useful at the +beginning of a file, to specify the year for that file. If all +transactions specify a year, however, this command has no effect. +

+
+
+ +

The following single letter commands may be at the beginning of a line +alone, for backwards compatibility with older Ledger versions. +

+
+
A
+
+ +

See bucket. +

+
+
Y
+
+ +

See year. +

+
+
N SYMBOL
+
+

Indicates that pricing information is to be ignored for a given +symbol, nor will quotes ever be downloaded for that symbol. Useful +with a home currency, such as the dollar ‘$’. It is recommended +that these pricing options be set in the price database file, which +defaults to ~/.pricedb. The syntax for this command is: +

+
+
N SYMBOL
+
+ +
+
D AMOUNT
+
+ +

Specifies the default commodity to use, by specifying an amount in the +expected format. The xact command will use this commodity as +the default when none other can be determined. This command may be used +multiple times, to set the default flags for different commodities; +whichever is seen last is used as the default commodity. For example, +to set US dollars as the default commodity, while also setting the +thousands flag and decimal flag for that commodity, use: +

+
+
D $1,000.00
+
+ +
+
C AMOUNT1 = AMOUNT2
+
+

Specifies a commodity conversion, where the first amount is given to +be equivalent to the second amount. The first amount should use the +decimal precision desired during reporting: +

+
+
C 1.00 Kb = 1024 bytes
+
+ +
+
I, i, O, o, b, h
+
+ + + + + +

These four relate to timeclock support, which permits Ledger to read +timelog files. See timeclock’s documentation for more info on the +syntax of its timelog files. +

+
+
+ +
+ + + +

4.8 Converting from other formats

+ + +

There are numerous tools to help convert various formats to a Ledger +file. Most banks will generate a comma separated values file that can +easily be parsed into Ledger format using one of those tools. Some of +the most popular tools are: +

+ + +

Directly pulling information from banks is outside the scope of +Ledger’s function. +

+
+ + + +

4.9 Archiving Previous Years

+ + + +

After a while, your journal can get to be pretty large. While this +will not slow down Ledger—it’s designed to process journals very +quickly—things can start to feel “messy”; and it’s a universal +complaint that when finances feel messy, people avoid them. +

+

Thus, archiving the data from previous years into their own files can +offer a sense of completion, and freedom from the past. But how to +best accomplish this with the ledger program? There are two commands +that make it very simple: print, and equity. +

+

Let’s take an example file, with data ranging from year 2000 until +2004. We want to archive years 2000 and 2001 to their own file, +leaving 2002–2004 in the current file. So, use print to +output all the earlier transactions to a file called +ledger-old.dat: +

+
+
$ ledger -f ledger.dat -b 2000 -e 2002 print > ledger-old.dat
+
+ +

Note that -e limits output to transactions before the +date specified. +

+

To delete older data from the current ledger file, use print +again, this time specifying year 2002 as the starting date: +

+
+
$ ledger -f ledger.dat -b 2002 print > x
+$ mv x ledger.dat
+
+ +

However, now the current file contains only postings from 2002 +onward, which will not yield accurate present-day balances, because the +net income from previous years is no longer being tallied. To +compensate for this, we must append an equity report for the old ledger +at the beginning of the new one: +

+
+
$ ledger -f ledger-old.dat equity > equity.dat
+$ cat equity.dat ledger.dat > x
+$ mv x ledger.dat
+$ rm equity.dat
+
+ +

Now the balances reported from ledger.dat are identical to what +they were before the data was split. +

+

How often should you split your ledger? You never need to, if you +don’t want to. Even eighty years of data will not slow down ledger +much, and that’s just using present day hardware! Or, you can keep +the previous and current year in one file, and each year before that +in its own file. It’s really up to you, and how you want to organize +your finances. For those who also keep an accurate paper trail, it +might be useful to archive the older years to their own files, then +burn those files to a CD to keep with the paper records—along with +any electronic statements received during the year. In the arena of +organization, just keep in mind this maxim: Do whatever keeps you +doing it. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

5 Transactions

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.1 Basic format

+ +

The most basic form of transaction is: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash                 $-20.00
+
+ +

This transaction has a date, a payee or description, a target account +(the first posting), and a source account (the second posting). Each +posting specifies what action is taken related to that account. +

+

A transaction can have any number of postings: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash                 $-10.00
+    Liabilities:Credit          $-10.00
+
+ +
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.2 Eliding amounts

+ +

The first thing you can do to make things easier is elide amounts. +That is, if exactly one posting has no amount specified, Ledger will +infer the inverse of the other postings’ amounts: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash                 $-10.00
+    Liabilities:Credit                   ; same as specifying $-10
+
+ +

If the other postings use multiple commodities, Ledger will copy the +empty posting N times and fill in the negated values of the various +commodities: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Expenses:Tips                 $2.00
+    Assets:Cash              EUR -10.00
+    Assets:Cash              GBP -10.00
+    Liabilities:Credit
+
+ +

This transaction is identical to writing: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Expenses:Tips                 $2.00
+    Assets:Cash              EUR -10.00
+    Assets:Cash              GBP -10.00
+    Liabilities:Credit          $-22.00
+    Liabilities:Credit        EUR 10.00
+    Liabilities:Credit        GBP 10.00
+
+ +
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.3 Auxiliary dates

+ + +

You can associate a second date with a transaction by following the +primary date with an equals sign: +

+
+
2012-03-10=2012-03-08 KFC
+    Expenses:Food                $20.00
+    Assets:Cash                 $-20.00
+
+ +

What this auxiliary date means is entirely up to you. The only use +Ledger has for it is that if you specify --aux-date, then all +reports and calculations (including pricing) will use the auxiliary +date as if it were the primary date. +

+
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.4 Codes

+ +

A transaction can have a textual “code”. This has no meaning and is +only displayed by the print command. Checking accounts often use +codes like DEP, XFER, etc., as well as check numbers. This is to give +you a place to put those codes: +

+
+
2012-03-10 (#100) KFC
+    Expenses:Food                $20.00
+    Assets:Checking
+
+ +
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.5 Transaction state

+ + + + +

A transaction can have a “state”: cleared, pending, or uncleared. The +default is uncleared. To mark a transaction cleared, put an asterisk +‘*’ after the date, before the code or payee: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

To mark it pending, use a ‘!’: +

+
+
2012-03-10 ! KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

What these mean is entirely up to you. The --cleared option +limits reports to only cleared items, while --uncleared +shows both uncleared and pending items, and --pending shows +only pending items. +

+

I use cleared to mean that I’ve reconciled the transaction with my +bank statement, and pending to mean that I’m in the middle of +a reconciliation. +

+

When you clear a transaction, that’s really just shorthand for +clearing all of its postings. That is: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

Is the same as writing: +

+
+
2012-03-10 KFC
+    * Expenses:Food                $20.00
+    * Assets:Cash
+
+ +

You can mark individual postings as cleared or pending, in case one +“side” of the transaction has cleared, but the other hasn’t yet: +

+
+
2012-03-10 KFC
+    Liabilities:Credit            $100.00
+    * Assets:Checking
+
+ +
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.6 Transaction notes

+ +

After the payee, and after at least one tab or two spaces (or a space +and a tab), which Ledger calls a “hard separator”, you may +introduce a note about the transaction using the ‘;’ character: +

+
+
2012-03-10 * KFC                ; yum, chicken...
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

Notes can also appear on the next line, so long as that line begins +with whitespace: +

+
+
2012-03-10 * KFC                ; yum, chicken...
+    ; and more notes...
+    Expenses:Food                $20.00
+    Assets:Cash
+
+2012-03-10 * KFC
+    ; just these notes...
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

A transaction’s note is shared by all its postings. This becomes +significant when querying for metadata (see below). To specify that +a note belongs only to one posting, place it after a hard separator +after the amount, or on its own line preceded by whitespace: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00  ; posting #1 note
+    Assets:Cash
+      ; posting #2 note, extra indentation is optional
+
+ +
+ + + +

5.7 Metadata

+ +

One of Ledger’s more powerful features is the ability to associate +typed metadata with postings and transactions (by which I mean all of +a transaction’s postings). This metadata can be queried, displayed, +and used in calculations. +

+

The are two forms of metadata: plain tags, and tag/value pairs. +

+ + + + + + +
+ +
+

+Next: , Previous: , Up: Metadata   [Contents][Index]

+
+ +

5.7.1 Metadata tags

+ +

To tag an item, put any word not containing whitespace between two +colons inside a comment: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+      ; :TAG:
+
+ +

You can gang up multiple tags by sharing colons: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+      ; :TAG1:TAG2:TAG3:
+
+ + + + + +
+ +
+

+Previous: , Up: Metadata tags   [Contents][Index]

+
+ +

5.7.1.1 Payee metadata tag

+ + + + + +

“Payee” is a special metadata field. If set on a posting, it will be +used as the payee name for that posting. This affects the +register report, the payees report, and the +--by-payee option. +

+

This is useful when for example you deposit 4 checks at a time to the +bank. On the bank statement, there is just one amount ‘$400’, but +you can specify from whom each check came, as shown by example +below: +

+
+
2010-06-17 Sample
+    Assets:Bank        $400.00
+    Income:Check1     $-100.00  ; Payee: Person One
+    Income:Check2     $-100.00  ; Payee: Person Two
+    Income:Check3     $-100.00  ; Payee: Person Three
+    Income:Check4     $-100.00  ; Payee: Person Four
+
+ +

When reporting with +

+
+
$ ledger reg
+
+ +

it appears as: +

+
+
10-Jun-17 Sample                Assets:Bank                 $400.00      $400.00
+          Person One            Income:Check1              $-100.00      $300.00
+          Person Two            Income:Check2              $-100.00      $200.00
+          Person Three          Income:Check3              $-100.00      $100.00
+          Person Four           Income:Check4              $-100.00            0
+
+ +

This shows that they are all in the same transaction (which is why the +date is not repeated), but they have different payees now. +

+

If using the --strict or --pedantic options, you must +declare this tag to avoid warnings and errors. +

+

The payee name used with the tag is not enforced by the +--check-payees option, due to a bug: +https://github.com/ledger/ledger/issues/556. +

+
+ +
+

+Next: , Previous: , Up: Metadata   [Contents][Index]

+
+ +

5.7.2 Metadata values

+ +

To associate a value with a tag, use the syntax “Key: Value”, where +the value can be any string of characters. Whitespace is needed after +the colon, and cannot appear in the Key: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+      ; MyTag: This is just a bogus value for MyTag
+
+ +
+ +
+

+Previous: , Up: Metadata   [Contents][Index]

+
+ +

5.7.3 Typed metadata

+ +

If a metadata tag ends in ::, its value will be parsed as a value +expression and stored internally as a value rather than as a string. +For example, although I can specify a date textually like so: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+      ; AuxDate: 2012/02/30
+
+ +

This date is just a string, and won’t be parsed as a date unless its +value is used in a date-context (at which time the string is parsed +into a date automatically every time it is needed as a date). If on +the other hand I write this: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+      ; AuxDate:: [2012/02/30]
+
+ +

Then it is parsed as a date only once, and during parsing of the +journal file, which would let me know right away that it is an invalid +date. +

+
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.8 Virtual postings

+ + +

Ordinarily, the amounts of all postings in a transaction must balance +to zero. This is non-negotiable. It’s what double-entry accounting +is all about! But there are some tricks up Ledger’s sleeve... +

+

You can use virtual accounts to transfer amounts to an account on the +sly, bypassing the balancing requirement. The trick is that these +postings are not considered “real”, and can be removed from all +reports using --real. +

+

To specify a virtual account, surround the account name with +parentheses: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+    (Budget:Food)               $-20.00
+
+ +

If you want, you can state that virtual postings should balance +against one or more other virtual postings by using brackets (which +look “harder”) rather than parentheses: +

+
+
2012-03-10 * KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+    [Budget:Food]               $-20.00
+    [Equity:Budgets]             $20.00
+
+ +
+ + + +

5.9 Expression amounts

+ +

An amount is a numerical figure with a commodity, but it can also be +any value expression. To indicate this, surround the amount +expression with parentheses: +

+
+
2012-03-10 * KFC
+    Expenses:Food      ($10.00 + $20.00)  ; Ledger adds it up for you
+    Assets:Cash
+
+ +
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.10 Balance verification

+ + + + + + + + + +

If at the end of a posting’s amount (and after the cost too, if there +is one) there is an equals sign, then Ledger will verify that the +total value for that account as of that posting matches the amount +specified. See --permissive option to relax the balance assertions checks. +

+

There are two forms of this features: balance assertions, and balance +assignments. +

+
+ + + +

5.10.1 Balance assertions

+ +

A balance assertion has this general form: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash                 $-20.00 = $500.00
+
+ +

This simply asserts that after subtracting $20.00 from Assets:Cash, +that the resulting total matches $500.00. If not, it is an error. +

+

The assertion has an effect only on the specified commodity. If an account has +multiple commodities, then only the one asserted is verified: +

+
+
2012-03-10 KFC New York
+    Expenses:Food                $20.00
+    Assets:Cash                 $-20.00 = $500.00
+
+2012-03-11 KFC Montreal
+    Expenses:Food                 15.00 CAD
+    Assets:Cash                  -15.00 CAD = $500.00
+
+ +

In this case, the amount in USD of cash (which has not changed) is validated. +Nothing is asserted about the current amount of Canadian dollars in ‘Asset:Cash’. +

+ +

5.10.1.1 Special assertion value 0

+ +

The only value that can be asserted without a commodity is ‘0’. +This results in a cross-commodities assertion, which makes it possible to +assert that an account is totally empty. +

+
+
2012-03-09 Fill Wallet
+    Revenue                      $20.00
+    Revenue                       15.00 CAD
+    Assets:Cash
+
+2012-03-10 KFC New York
+    Expenses:Food                $20.00
+    Assets:Cash                 $-20.00
+
+2012-03-11 KFC Montreal
+    Expenses:Food                 15.00 CAD
+    Assets:Cash                  -15.00 CAD = 0
+
+ +

The last transaction will assert that we are out of cash of any sort. +

+
+ + + +

5.10.2 Balance assignments

+ +

A balance assignment has this form: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash                         = $500.00
+
+ +

This sets the amount of the second posting to whatever it would need to +be for the total in ‘Assets:Cash’ to be $500.00 after the posting. +If the resulting amount is not $-20.00 in this case, it is an error. +

+
+ + + +

5.10.3 Resetting a balance

+ +

Say your book-keeping has gotten a bit out of date, and your Ledger +balance no longer matches your bank balance. You can create an +adjustment transaction using balance assignments: +

+
+
2012-03-10 Adjustment
+    Assets:Cash                         = $500.00
+    Equity:Adjustments
+
+ +

Since the second posting is also null, its value will become the +inverse of whatever amount is generated for the first posting. +

+

This is the only time in ledger when more than one posting’s amount +may be empty—and then only because it’s not truly empty, it is +indirectly provided by the balance assignment’s value. +

+
+ + + +

5.10.4 Balancing transactions

+ + +

As a consequence of all the above, consider the following transaction: +

+
+
2012-03-10 My Broker
+    [Assets:Brokerage]            = 10 AAPL
+
+ +

What this says is: set the amount of the posting to whatever value is +needed so that ‘Assets:Brokerage’ contains 10 AAPL. Then, because +this posting must balance, ensure that its value is zero. This can only +be true if Assets:Brokerage does indeed contain 10 AAPL at that point in +the input file. +

+

A balanced virtual transaction is used simply to indicate to Ledger that +this is not a “real” transaction. It won’t appear in any reports +anyway (unless you use a register report with --empty). +

+
+ + + +

5.11 Posting cost

+ +

When you transfer a commodity from one account to another, sometimes +it gets transformed during the transaction. This happens when you +spend money on gas, for example, which transforms dollars into gallons +of gasoline, or dollars into stocks in a company. +

+

In those cases, Ledger will remember the “cost” of that transaction +for you, and can use it during reporting in various ways. Here’s an +example of a stock purchase: +

+
+
2012-03-10 My Broker
+    Assets:Brokerage             10 AAPL
+    Assets:Brokerage:Cash       $-500.00
+
+ +

This is different from transferring 10 AAPL shares from one account to +another, in this case you are exchanging one commodity for +another. The resulting posting’s cost is $50.00 per share. +

+
+ + + +

5.12 Explicit posting costs

+ +

You can make any posting’s cost explicit using the ‘@’ symbol +after the amount or amount expression: +

+
+
2012-03-10 My Broker
+    Assets:Brokerage             10 AAPL @ $50.00
+    Assets:Brokerage:Cash       $-500.00
+
+ +

When you do this, since Ledger can now figure out the balancing amount +from the first posting’s cost, you can elide the other amount: +

+
+
2012-03-10 My Broker
+    Assets:Brokerage             10 AAPL @ $50.00
+    Assets:Brokerage:Cash
+
+ + + + + +
+ + + +

5.12.1 Primary and secondary commodities

+ + + +

It is a general convention within Ledger that the “top” postings in +a transaction contain the target accounts, while the final posting +contains the source account. Whenever a commodity is exchanged like +this, the commodity moved to the target account is considered +“secondary”, while the commodity used for purchasing and tracked in +the cost is “primary”. +

+

Said another way, whenever Ledger sees a posting cost of the form +"AMOUNT @ AMOUNT", the commodity used in the second amount is marked +“primary”. +

+

The only meaning a primary commodity has is that the --market +(-V) flag will never convert a primary commodity into any other +commodity. --exchange COMMODITY (-X) still will, +however. +

+
+ + + +

5.13 Posting cost expressions

+ +

Just as you can have amount expressions, you can have posting +expressions: +

+
+
2012-03-10 My Broker
+    Assets:Brokerage             10 AAPL @ ($500.00 / 10)
+    Assets:Brokerage:Cash
+
+ +

You can even have both: +

+
+
2012-03-10 My Broker
+    Assets:Brokerage             (5 AAPL * 2) @ ($500.00 / 10)
+    Assets:Brokerage:Cash
+
+ +
+ + + +

5.14 Total posting costs

+ +

The cost figure following the ‘@’ character specifies the +per-unit price for the commodity being transferred. If you’d +like to specify the total cost instead, use ‘@@’: +

+
+
2012-03-10 My Broker
+    Assets:Brokerage             10 AAPL @@ $500.00
+    Assets:Brokerage:Cash
+
+ +

Ledger reads this as if you had written: +

+
+
2012-03-10 My Broker
+    Assets:Brokerage             10 AAPL @ ($500.00 / 10)
+    Assets:Brokerage:Cash
+
+ +
+ + + +

5.15 Virtual posting costs

+ +

Normally whenever a commodity exchange like this happens, the price of +the exchange (such as $50 per share of AAPL, above) is recorded in +Ledger’s internal price history database. To prevent this from +happening in the case of an exceptional transaction, surround the +‘@’ or ‘@@’ with parentheses: +

+
+
2012-03-10 My Brother
+    Assets:Brokerage            1000 AAPL (@) $1
+    Income:Gifts Received
+
+ +
+ + + +

5.16 Commodity prices

+ + +

When a transaction occurs that exchanges one commodity for another, +Ledger records that commodity price not only within its internal price +database, but also attached to the commodity itself. Usually this fact +remains invisible to the user, unless you turn on --lot-prices +to show these hidden price figures. +

+

For example, consider the stock sale given above: +

+
+
2012-03-10 My Broker
+    Assets:Brokerage             10 AAPL @ $50.00
+    Assets:Brokerage:Cash
+
+ +

The commodity transferred into ‘Assets:Brokerage’ is not actually 10 +AAPL, but rather 10 AAPL {$50.00}. The figure in braces after the +amount is called the “lot price”. It’s Ledger’s way of remembering +that this commodity was transferred through an exchange, and that +$50.00 was the price of that exchange. +

+

This becomes significant if you later sell that commodity again. For +example, you might write this: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage:Cash
+    Assets:Brokerage            -10 AAPL @ $75.00
+
+ +

And that would be perfectly fine, but how do you track the capital +gains on the sale? It could be done with a virtual posting: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage:Cash
+    Assets:Brokerage            -10 AAPL @ $75.00
+    (Income:Capital Gains)      $-250.00
+
+ +

But this gets messy since capital gains income is very real, and not +quite appropriate for a virtual posting. +

+

Instead, if you reference that same hidden price annotation, Ledger +will figure out that the price of the shares you’re selling, and the +cost you’re selling them at, don’t balance: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage:Cash       $750.00
+    Assets:Brokerage            -10 AAPL {$50.00} @ $75.00
+
+ +

This transaction will fail because the $250.00 price difference +between the price you bought those shares at, and the cost you’re +selling them for, does not match. The lot price also identifies which +shares you purchased on that prior date. +

+ + + + +
+ +
+

+Previous: , Up: Commodity prices   [Contents][Index]

+
+ +

5.16.1 Total commodity prices

+ +

As a shorthand, you can specify the total price instead of the +per-share price in doubled braces. This goes well with total costs, +but is not required to be used with them: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage:Cash       $750.00
+    Assets:Brokerage            -10 AAPL {{$500.00}} @@ $750.00
+    Income:Capital Gains       $-250.00
+
+ +

It should be noted that this is a convenience only for cases where you +buy and sell whole lots. The {{$500.00}} is not an attribute +of the commodity, whereas {$50.00} is. In fact, when you write +{{$500.00}}, Ledger just divides that value by 10 and sees +{$50.00}. So if you use the print command to look at this +transaction, you’ll see the single braces form in the output. The +double braces price form is a shorthand only. +

+

Plus, it comes with dangers. This works fine: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage            10 AAPL @ $50.00
+    Assets:Brokerage:Cash      $-500.00
+
+2012-04-10 My Broker
+    Assets:Brokerage:Cash       $375.00
+    Assets:Brokerage            -5 AAPL {$50.00} @@ $375.00
+    Income:Capital Gains       $-125.00
+
+2012-04-10 My Broker
+    Assets:Brokerage:Cash       $375.00
+    Assets:Brokerage            -5 AAPL {$50.00} @@ $375.00
+    Income:Capital Gains       $-125.00
+
+ +

But this does not do what you might expect: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage            10 AAPL @ $50.00
+    Assets:Brokerage:Cash      $-500.00
+
+2012-04-10 My Broker
+    Assets:Brokerage:Cash       $375.00
+    Assets:Brokerage            -5 AAPL {{$500.00}} @@ $375.00
+    Income:Capital Gains       $-125.00
+
+2012-04-10 My Broker
+    Assets:Brokerage:Cash       $375.00
+    Assets:Brokerage            -5 AAPL {{$500.00}} @@ $375.00
+    Income:Capital Gains       $-125.00
+
+ +

And in cases where the amounts do not divide into whole figures and +must be rounded, the capital gains figure could be off by a cent. Use +with caution. +

+
+ + + +

5.17 Prices versus costs

+ +

Because lot pricing provides enough information to infer the cost, the +following two transactions are equivalent: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage            10 AAPL @ $50.00
+    Assets:Brokerage:Cash      $-500.00
+
+2012-04-10 My Broker
+    Assets:Brokerage            10 AAPL {$50.00}
+    Assets:Brokerage:Cash      $-500.00
+
+ +

However, note that what you see in some reports may differ, for +example in the print report. Functionally, however, there is no +difference, and neither the register nor the balance report are +sensitive to this difference. +

+
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.18 Fixated prices and costs

+ +

If you bought a stock last year, and ask for its value today, Ledger +will consult its price database to see what the most recent price for +that stock is. You can short-circuit this lookup by “fixing” the +price at the time of a transaction. This is done using +‘{=AMOUNT}’: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage            10 AAPL {=$50.00}
+    Assets:Brokerage:Cash      $-500.00
+
+ +

These 10 AAPL will now always be reported as being worth $50, no +matter what else happens to the stock in the meantime. +

+

Fixated prices are a special case of using lot valuation expressions +(see below) to fix the value of a commodity lot. +

+

Since price annotations and costs are largely interchangeable and +a matter of preference, there is an equivalent syntax for specified +fixated prices by way of the cost: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage            10 AAPL @ =$50.00
+    Assets:Brokerage:Cash      $-500.00
+
+ +

This is the same as the previous transaction, with the same caveats +found in Prices versus costs. +

+
+ + + +

5.19 Lot dates

+ + +

In addition to lot prices, you can specify lot dates and reveal them +with --lot-dates. Other than that, however, they have no +special meaning to Ledger. They are specified after the amount in +square brackets (the same way that dates are parsed in value +expressions): +

+
+
2012-04-10 My Broker
+    Assets:Brokerage:Cash       $375.00
+    Assets:Brokerage            -5 AAPL {$50.00} [2012-04-10] @@ $375.00
+    Income:Capital Gains       $-125.00
+
+ +
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.20 Lot notes

+ + + +

You can also associate arbitrary notes for your own record keeping in +parentheses, and reveal them with --lot-notes. One caveat is +that the note cannot begin with an ‘@’ character, as that would +indicate a virtual cost: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage:Cash       $375.00
+    Assets:Brokerage            -5 AAPL {$50.00} [2012-04-10] (Oh my!) @@ $375.00
+    Income:Capital Gains       $-125.00
+
+ +

You can specify any combination of lot prices, dates or notes, in any +order. They are all optional. +

+

To show all lot information in a report, use --lots. +

+
+ +
+

+Next: , Previous: , Up: Transactions   [Contents][Index]

+
+ +

5.21 Lot value expressions

+ +

Normally when you ask Ledger to display the values of commodities held, +it uses a value expression called “market” to determine the most +recent value from its price database—even downloading prices from the +Internet, if --download (-Q) was specified and a suitable +getquote script is found on your system. +

+

However, you can override this valuation logic by providing +a commodity valuation expression in doubled parentheses. This +expression must result in one of two values: either an amount to +always be used as the per-share price for that commodity; or +a function taking three arguments, which is called to determine that +price. +

+

If you use the functional form, you can either specify a function +name, or a lambda expression. Here’s a function that yields the price +as $10 in whatever commodity is being requested: +

+
+
define ten_dollars(s, date, t) = market($10, date, t)
+
+ +

I can now use that in a lot value expression as follows: +

+
+
2012-04-10 My Broker
+    Assets:Brokerage:Cash       $375.00
+    Assets:Brokerage            -5 AAPL {$50.00} ((ten_dollars)) @@ $375.00
+    Income:Capital Gains       $-125.00
+
+ +

Alternatively, I could do the same thing without pre-defining +a function by using a lambda expression taking three arguments: +

+
+
2012-04-10 My Broker
+    A:B:Cash       $375.00
+    A:B     -5 AAPL {$50.00} ((s, d, t -> market($10, date, t))) @@ $375.00
+    Income:Capital Gains       $-125.00
+
+ +

The arguments passed to these functions have the following meaning: +

+
    +
  • source +The source commodity string, or an amount object. If it is a string, +the return value must be an amount representing the price of the +commodity identified by that string (example: ‘$’). If it is an +amount, return the value of that amount as a new amount (usually +calculated as commodity price times source amount). + +
  • date +The date to use for determining the value. If null, it means no date +was specified, which can mean whatever you want it to mean. + +
  • target +If not null, a string representing the desired target commodity that the +commodity price, or repriced amount, should be valued in. Note that +this string can be a comma-separated list, and that some or all of the +commodities in that list may be suffixed with an exclamation mark, to +indicate what is being desired. + +
+ +

In most cases, it is simplest to either use explicit amounts in your +valuation expressions, or just pass the arguments down to ‘market’ +after modifying them to suit your needs. +

+
+ + + +

5.22 Automated Transactions

+ +

An automated transaction is a special kind of transaction which adds +its postings to other transactions any time one of that other +transactions’ postings matches its predicate. The predicate uses the +same query syntax as the Ledger command-line. +

+

Consider this posting: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

If I write this automated transaction before it in the file: +

+
+
= expr true
+    Foo                          $50.00
+    Bar                         $-50.00
+
+ +

Then the first transaction will be modified during parsing as if I’d +written this: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Foo                          $50.00
+    Bar                         $-50.00
+    Assets:Cash                 $-20.00
+    Foo                          $50.00
+    Bar                         $-50.00
+
+ +

Despite this fancy logic, automated transactions themselves follow +most of the same rules as regular transactions: their postings must +balance (unless you use a virtual posting), you can have metadata, +etc. +

+

One thing you cannot do, however, is elide amounts in an automated +transaction. +

+ + + + + + + + + + + + +
+ + + +

5.22.1 Amount multipliers

+ +

As a special case, if an automated transaction’s posting’s amount +(phew) has no commodity, it is taken as a multiplier upon the matching +posting’s cost. For example: +

+
+
= expr true
+    Foo                           50.00
+    Bar                          -50.00
+
+2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

Then the latter transaction turns into this during parsing: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    Foo                        $1000.00
+    Bar                       $-1000.00
+    Assets:Cash                 $-20.00
+    Foo                        $1000.00
+    Bar                       $-1000.00
+
+ +
+ + + +

5.22.2 Accessing the matching posting’s amount

+ +

If you use an amount expression for an automated transaction’s +posting, that expression has access to all the details of the matched +posting. For example, you can refer to that posting’s amount using +the “amount” value expression variable: +

+
+
= expr true
+    (Foo)                  (amount * 2)  ; same as just "2" in this case
+
+2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

This becomes: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    (Foo)                        $40.00
+    Assets:Cash                 $-20.00
+    (Foo)                       $-40.00
+
+ +
+ + + +

5.22.3 Referring to the matching posting’s account

+ +

Sometimes you want to refer to the account that was matched +in some way within the automated transaction itself. This is +done by using the string ‘$account’, anywhere within the +account part of the automated posting: +

+
+
= food
+    (Budget:$account)                10
+
+2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

Becomes: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    (Budget:Expenses:Food)      $200.00
+    Assets:Cash                 $-20.00
+
+ +

Keep in mind that if you are using --strict or --pedantic you will have to explicitly define an account ‘$account’ to avoid errors. +

+
+
account $account
+
+ +
+ + + +

5.22.4 Applying metadata to every matched posting

+ +

If the automated transaction has a transaction note, that note is +copied (along with any metadata) to every posting that matches the +predicate: +

+
+
= food
+    ; Foo: Bar
+    (Budget:$account)                10
+
+2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

Becomes: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+      ; Foo: Bar
+    (Budget:Expenses:Food)      $200.00
+    Assets:Cash                 $-20.00
+
+ +
+ + + +

5.22.5 Applying metadata to the generated posting

+ +

If the automated transaction’s posting has a note, that note is +carried to the generated posting within the matched transaction: +

+
+
= food
+    (Budget:$account)                10
+      ; Foo: Bar
+
+2012-03-10 KFC
+    Expenses:Food                $20.00
+    Assets:Cash
+
+ +

Becomes: +

+
+
2012-03-10 KFC
+    Expenses:Food                $20.00
+    (Budget:Expenses:Food)      $200.00
+      ; Foo: Bar
+    Assets:Cash                 $-20.00
+
+ +

This is slightly different from the rules for regular transaction +notes, in that an automated transaction’s note does not apply to every +posting within the automated transaction itself, but rather to every +posting it matches. +

+
+ + + +

5.22.6 State flags

+ +

Although you cannot mark an automated transaction as a whole as +cleared or pending, you can mark its postings with a ‘*’ or +‘!’ before the account name, and that state flag gets carried to +the generated posting. +

+
+ + + +

5.22.7 Effective Dates

+ + + +

In the real world, transactions do not take place instantaneously. +Purchases can take several days to post to a bank account. And you may +pay ahead for something for which you want to distribute costs. With +Ledger you can control every aspect of the timing of a transaction. +

+

Say you’re in business. If you bill a customer, you can enter +something like +

+ + +
+
2008/01/01=2008/01/14 Client invoice  ;  estimated date you'll be paid
+    Assets:Accounts Receivable            $100.00
+    Income: Client name
+
+ +

Then, when you receive the payment, you change it to +

+
+
2008/01/01=2008/01/15 Client invoice ;  actual date money received
+    Assets:Accounts Receivable            $100.00
+    Income: Client name
+
+ +

and add something like +

+
+
2008/01/15 Client payment
+    Assets:Checking                       $100.00
+    Assets:Accounts Receivable
+
+ +

Now +

+
+
$ ledger --begin 2008/01/01 --end 2008/01/14 bal Income
+
+ +

gives you your accrued income in the first two weeks of the year, and +

+
+
$ ledger --effective --begin 2008/01/01 --end 2008/01/14 bal Income
+
+ +

gives you your cash basis income in the same two weeks. +

+

Another use is distributing costs out in time. As an example, suppose +you just prepaid into a local vegetable co-op that sustains you +through the winter. It costs $225 to join the program, so you write +a check. You don’t want your October grocery budget to be blown +because you bought food ahead, however. What you really want is for +the money to be evenly distributed over the next six months so that +your monthly budgets gradually take a hit for the vegetables you’ll +pick up from the co-op, even though you’ve already paid for them. +

+
+
2008/10/16 * (2090) Bountiful Blessings Farm
+    Expenses:Food:Groceries                  $ 37.50  ; [=2008/10/01]
+    Expenses:Food:Groceries                  $ 37.50  ; [=2008/11/01]
+    Expenses:Food:Groceries                  $ 37.50  ; [=2008/12/01]
+    Expenses:Food:Groceries                  $ 37.50  ; [=2009/01/01]
+    Expenses:Food:Groceries                  $ 37.50  ; [=2009/02/01]
+    Expenses:Food:Groceries                  $ 37.50  ; [=2009/03/01]
+    Assets:Checking
+
+ +

This entry accomplishes this. Every month you’ll see an +automatic $37.50 deficit like you should, while your checking account +really knows that it debited $225 this month. +

+

And using the --effective option, the initial date will be +overridden by the effective dates. +

+
+
$ ledger --effective register Groceries
+
+ +
+
08-Oct-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50      $ 37.50
+08-Nov-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50      $ 75.00
+08-Dec-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50     $ 112.50
+09-Jan-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50     $ 150.00
+09-Feb-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50     $ 187.50
+09-Mar-01 Bountiful Blessings.. Expense:Food:Groceries      $ 37.50     $ 225.00
+
+ +
+ + + +

5.22.8 Periodic Transactions

+ + +

A periodic transaction starts with a tilde ‘~’ followed by a period +expression (see Period Expressions). Periodic transactions are used for budgeting and +forecasting only, they have no effect without the --budget +option specified. For examples and details, see Budgeting and Forecasting. +

+
+ + + +

5.22.9 Concrete Example of Automated Transactions

+ +

As a Bahá’í, I need to compute Huqúqu’lláh whenever I acquire assets. +It is similar to tithing for Jews and Christians, or to Zakát for +Muslims. The exact details of computing Huqúqu’lláh are somewhat +complex, but if you have further interest, please consult the Web. +

+

Ledger makes this otherwise difficult law very easy. Just set up an +automated posting at the top of your ledger file: +

+
+
; This automated transaction will compute Huqúqu'lláh based on this
+; journal's postings.  Any accounts that match will affect the
+; Liabilities:Huququ'llah account by 19% of the value of that posting.
+
+= /^(?:Income:|Expenses:(?:Business|Rent$|Furnishings|Taxes|Insurance))/
+  (Liabilities:Huququ'llah)               0.19
+
+ +

This automated posting works by looking at each posting in the +ledger file. If any match the given value expression, 19% of the +posting’s value is applied to the ‘Liabilities:Huququ'llah’ +account. So, if $1000 is earned from ‘Income:Salary’, $190 is +added to ‘Liabilities:Huqúqu'lláh’; if $1000 is spent on Rent, +$190 is subtracted. +

+
+
2003/01/01 (99) Salary
+  Income:Salary  -$1000
+  Assets:Checking
+
+2003/01/01 (100) Rent
+  Expenses:Rent  $500
+  Assets:Checking
+
+ +

The ultimate balance of Huqúqu’lláh reflects how +much is owed in order to fulfill one’s obligation to Huqúqu’lláh. +When ready to pay, just write a check to cover the amount shown in +‘Liabilities:Huququ'llah’. That transaction would look like: +

+
+
2003/01/01 (101) Baha'i Huqúqu'lláh Trust
+    Liabilities:Huququ'llah          $1,000.00
+    Assets:Checking
+
+ +

That’s it. To see how much Huqúq is currently owed based on your +ledger transactions, use: +

+
+
$ ledger balance Liabilities:Huquq
+
+ +
+
                $-95  Liabilities:Huququ'llah
+
+ +

This works fine, but omits one aspect of the law: that Huqúq is only +due once the liability exceeds the value of 19 mithqáls of gold (which +is roughly 2.22 ounces). So what we want is for the liability to +appear in the balance report only when it exceeds the present day +value of 2.22 ounces of gold. This can be accomplished using the +command: +

+
+
$ ledger -Q -t "/Liab.*Huquq/?(a/P{2.22 AU}<={-1.0}&a):a" bal liab
+
+ +

With this command, the current price for gold is downloaded, and the +Huqúqu’lláh is reported only if its value exceeds that of 2.22 ounces +of gold. If you wish the liability to be reflected in the parent +subtotal either way, use this instead: +

+
+
$ ledger -Q -T "/Liab.*Huquq/?(O/P{2.22 AU}<={-1.0}&O):O" bal liab
+
+ +

In some cases, you may wish to refer to the account of whichever posting +matched your automated transaction’s value expression. To do this, use +the special account name ‘$account’: +

+
+
= /^Some:Long:Account:Name/
+    [$account]  -0.10
+    [Savings]    0.10
+
+ +

This example causes 10% of the matching account’s total to be deferred +to the ‘Savings’ account—as a balanced virtual posting, which +may be excluded from reports by using --real. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

6 Building Reports

+ + + + + + + + +
+ + + +

6.1 Introduction

+ +

The power of Ledger comes from the incredible flexibility in its +reporting commands, combined with formatting commands. Some options +control what is included in the calculations, and formatting controls +how it is displayed. The combinations are infinite. This chapter will +show you the basics of combining various options and commands. In the +next chapters you will find details about the specific commands and +options. +

+
+ +
+

+Next: , Previous: , Up: Building Reports   [Contents][Index]

+
+ +

6.2 Balance Reports

+ + + + + + +
+ + + +

6.2.1 Controlling the Accounts and Payees

+ +

The balance report is the most commonly used report. The simplest +invocation is: +

+
+
$ ledger balance -f drewr3.dat
+
+ +

which will print the balances of every account in your journal. +

+
+
         $ -3,804.00  Assets
+          $ 1,396.00    Checking
+             $ 30.00      Business
+         $ -5,200.00    Savings
+         $ -1,000.00  Equity:Opening Balances
+          $ 6,654.00  Expenses
+          $ 5,500.00    Auto
+             $ 20.00    Books
+            $ 300.00    Escrow
+            $ 334.00    Food:Groceries
+            $ 500.00    Interest:Mortgage
+         $ -2,030.00  Income
+         $ -2,000.00    Salary
+            $ -30.00    Sales
+            $ -63.60  Liabilities
+            $ -20.00    MasterCard
+            $ 200.00    Mortgage:Principal
+           $ -243.60    Tithe
+--------------------
+           $ -243.60
+
+ +

Most times, this is more than you want. Limiting the results to +specific accounts is as easy as entering the names of the accounts +after the command: +

+
+
$ ledger balance -f drewr3.dat Auto MasterCard
+
+ +
+
          $ 5,500.00  Expenses:Auto
+            $ -20.00  Liabilities:MasterCard
+--------------------
+          $ 5,480.00
+
+ +

Note the implicit logical or between ‘Auto’ and +‘Mastercard’. +

+

If you want the entire contents of a branch of your account tree, use +the highest common name in the branch: +

+
+
$ ledger balance -f drewr3.dat Income
+
+ +
+
         $ -2,030.00  Income
+         $ -2,000.00    Salary
+            $ -30.00    Sales
+--------------------
+         $ -2,030.00
+
+ +

You can use general regular expressions in nearly any place Ledger +needs a string: +

+
+
$ ledger balance -f drewr3.dat ^Bo
+
+ +

This first example looks for any account starting with ‘Bo’, of +which there are none. +

+
+
$ ledger balance -f drewr3.dat Bo
+
+ +
+
             $ 20.00  Expenses:Books
+
+ +

This second example looks for any account containing ‘Bo’, which is +‘Expenses:Books’. +

+ + + +

If you want to know exactly how much you have spent in a particular +account on a particular payee, the following are equivalent: +

+
+
$ ledger balance Auto:Fuel and Chevron
+
+ +
+
$ ledger balance --limit 'account=~/Fuel/' and 'payee=~/Chev/'
+
+ +

will show you the amount expended on gasoline at Chevron. The second +example is the first example of the very powerful expression language +available to shape reports. The first example may be easier to +remember, but learning to use the second will open up far more +possibilities. +

+

If you want to exclude specific accounts from the report, you can +exclude multiple accounts with parentheses: +

+
+
$ ledger bal Expenses and not (Expenses:Drinks or Expenses:Candy or Expenses:Gifts)
+
+ +
+ + + +

6.2.2 Controlling Formatting

+ +

These examples all use the default formatting for the balance report. +Customizing the formatting allows you to see only what you want, or +interface Ledger with other programs. For examples and details, +see Format Strings and Asset Allocation. +

+
+ + + +

6.3 Typical queries

+ +

A query such as the following shows all expenses since last +October, sorted by total: +

+
+
$ ledger -b "last oct" -S T bal ^expenses
+
+ +

From left to right the options mean: Show transactions since last +October; sort by the absolute value of the total; and report the balance +for all accounts that begin with ‘expenses’. +

+ + + + +
+ +
+

+Previous: , Up: Typical queries   [Contents][Index]

+
+ +

6.3.1 Reporting monthly expenses

+ + + + + + +

The following query makes it easy to see monthly expenses, with each +month’s expenses sorted by the amount: +

+
+
$ ledger -M --period-sort "(amount)" reg ^expenses
+
+ +

Now, you might wonder where the money came from to pay for these things. +To see that report, add --related (-r), which shows the +“related account” postings: +

+
+
$ ledger -M --period-sort "(amount)" -r reg ^expenses
+
+ +

But maybe this prints too much information. You might just want to +see how much you’re spending with your MasterCard. That kind of query +requires the use of a display predicate, since the postings +calculated must match ‘^expenses’, while the postings +displayed must match ‘mastercard’. The command would be: +

+
+
$ ledger -M -r --display 'account=~/mastercard/' reg ^expenses
+
+ +

This query says: Report monthly subtotals; report the “related +account” postings; display only related postings whose +account matches ‘mastercard’, and base the calculation on +postings matching ‘^expenses’. +

+

This works just as well for reporting the overall total, too: +

+
+
$ ledger -s -r --display "account=~/mastercard/" reg ^expenses
+
+ +

The --subtotal (-s) option subtotals all postings, just as +--monthly (-M) subtotaled by the month. The running total in +both cases is off, however, since a display expression is being used. +

+
+ +
+

+Previous: , Up: Building Reports   [Contents][Index]

+
+ +

6.4 Advanced Reports

+ + + + + + +
+ + + +

6.4.1 Asset Allocation

+ +

A very popular method of managing portfolios is to control the +percent allocation of assets by certain categories. The mix of +categories and the weights applied to them vary by investing +philosophy, but most follow a similar pattern. Tracking asset +allocation in ledger is not difficult but does require some additional +effort to describe how the various assets you own contribute to the +asset classes you want to track. +

+

In our simple example we assume you want to apportion your assets into +the general categories of domestic and international equities (stocks) +and a combined category of bonds and cash. For illustrative purposes, +we will use several publicly available mutual funds from Vanguard. +The three funds we will track are the Vanguard 500 IDX FD Signal +(VIFSX), the Vanguard Target Retirement 2030 (VTHRX), and the Vanguard +Short Term Federal Fund (VSGBX). Each of these funds allocates assets +to different categories of the investment universe and in different +proportions. When you buy a share of VTHRX, that share is partially +invested in equities, and partially invested in bonds and cash. Below +is the asset allocation for each of the instruments listed above: +

+ + + + + + +
DomesticGlobal
SymbolEquityEquitybonds/cash
VIFSX100%
VTHRX24.0%56.3%19.7%
VSGBX100%
+ +

These numbers are available from the prospectus of any publicly +available mutual fund. Of course a single stock issue is 100% equity +and a single bond issue is 100% bonds. +

+

We track purchases of specific investments using the symbol of that +investment as its commodity. How do we tell Ledger that a share of +VTHRX is 24% Domestic equity? Enter automatic transactions and +virtual accounts. +

+

At the top of our ledger we enter automatic transactions that describe +these proportions to Ledger. In the same entries we set up virtual +accounts that let us separate these abstract calculations from our +actual balances. +

+

For the three instruments listed above, those automatic transactions +would look like: +

+
+
= expr ( commodity == 'VIFSX' )
+    (Allocation:Equities:Domestic)             1.000
+
+= expr ( commodity == 'VTHRX' )
+    (Allocation:Equities:Global)               0.240
+    (Allocation:Equities:Domestic)             0.563
+    (Allocation:Bonds/Cash)                    0.197
+
+= expr ( commodity == 'VBMFX')
+    (Allocation:Bonds/Cash)                    1.000
+
+2015-01-01 Buy VIFSX
+    Assets:Broker                                100 VIFSX
+    Assets:Cash                              $-10000
+
+2015-01-01 Buy VTHRX
+    Assets:Broker                                 10 VTHRX
+    Assets:Cash                              $-10000
+
+2015-01-01 Buy VBMFX
+    Assets:Broker                                  1 VBMFX
+    Assets:Cash                              $-10000
+
+ +

How do these work? First the ‘=’ sign at the beginning of the +line tells ledger this is an automatic transaction to be applied when +the condition following the ‘=’ is true. After the ‘=’ sign +is a value expression (see Value Expressions) that returns true +any time a posting contains the commodity of interest. +

+

The following line gives the proportions (not percentages) of each unit +of commodity that belongs to each asset class. Whenever Ledger sees a +buy or sell of a particular commodity it will credit or debit these +virtual accounts with that proportion of the number of shares moved. +

+

Now that Ledger understands how to distribute the commodities amongst +the various asset classes how do we get a report that tells us our +current allocation? Using the balance command and some tricky +formatting! +

+
+
ledger bal Allocation --current --format "\
+        %-17((depth_spacer)+(partial_account))\
+        %10(percent(market(display_total), market(parent.total)))\
+        %16(market(display_total))\n%/"
+
+ +

Which yields: +

+
+
        Allocation                  100.00%                  $30000
+          Bonds/Cash                 39.90%                  $11970
+          Equities                   60.10%                  $18030
+            Domestic                 86.69%                  $15630
+            Global                   13.31%                   $2400
+
+ +

Let’s look at the Ledger invocation a bit closer. The command above is +split into lines for clarity. The first line is very vanilla Ledger +asking for the current balances of the account in the “Allocation” +tree, using a special formatter. +

+ + + +

The magic is in the formatter. The second line simply tells Ledger to +print the partial account name indented by its depth in the tree. The +third line is where we calculate and display the percentages. The +display_total command gives the values of the total calculated +for the account in this line. The parent.total command gives +the total for the next level up in the tree. percent formats +their ratio as a percentage. The fourth line tells ledger to display +the current market value of the line. The last two characters +‘%/’ tell Ledger what to do for the last line, in this case, +nothing. +

+
+ +
+

+Previous: , Up: Advanced Reports   [Contents][Index]

+
+ +

6.4.2 Visualizing with Gnuplot

+ + + + + + + +

If you have the “Gnuplot” program installed, you can graph any of the +above register reports. The script to do this is included in the ledger +distribution, and is named contrib/report. Install report +anywhere along your PATH, and then use report instead of +ledger when doing a register report. The only thing to keep in +mind is that you must specify --amount-data (-j) or +--total-data (-J) to indicate whether “Gnuplot” should plot +the amount, or the running total. For example, this command plots total +monthly expenses made on your MasterCard. +

+
+
$ report -j -M -r --display "account =~ /mastercard/" reg ^expenses
+
+ +

The report script is a very simple Bourne shell script, that +passes a set of scripted commands to “Gnuplot”. Feel free to modify +the script to your liking, since you may prefer histograms to line +plots, for example. +

+

Here are some useful plots: +

+
+
report -j -M reg ^expenses         # monthly expenses
+report -J reg checking             # checking account balance
+report -J reg ^income ^expenses    # cash flow report
+
+# net worth report, ignoring non-$ postings
+
+report -J -l "Ua>={\$0.01}" reg ^assets ^liab
+
+# net worth report starting last February. the use of a display
+# predicate (-d) is needed, otherwise the balance will start at
+# zero, and thus the y-axis will not reflect the true balance
+
+report -J -l "Ua>={\$0.01}" -d "d>=[last feb]" reg ^assets ^liab
+
+ +

The last report uses both a calculation predicate --limit +EXPR (-l) and a display predicate --display EXPR +(-d). The calculation predicate limits the report to postings whose +amount is greater than or equal to $1 (which can only happen if the +posting amount is in dollars). The display predicate limits the +transactions displayed to just those since last February, even +though those transactions from before will be computed as part of the +balance. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

7 Reporting Commands

+ + + + + + + +
+ + + +

7.1 Primary Financial Reports

+ + + + + + + + +
+ + + +

7.1.1 The balance command

+ + +

The balance command reports the current balance of all +accounts. It accepts a list of optional regexes, which confine the +balance report to the matching accounts. If an account contains +multiple types of commodities, each commodity’s total is reported +separately. +

+
+ + + +

7.1.2 The equity command

+ + +

The equity command prints out account balances as if they +were transactions. This makes it easy to establish the starting +balances for an account, such as when Archiving Previous Years. +

+
+ + + +

7.1.3 The register command

+ + + + +

The register command displays all the postings occurring in +a single account, line by line. The account regex must be specified as +the only argument to this command. If any regexes occur after the +required account name, the register will contain only those postings +that match, which makes it very useful for hunting down a particular +posting. +

+

The output from register is very close to what a typical +checkbook, or single-account ledger, would look like. It also shows a +running balance. The final running balance of any register should +always be the same as the current balance of that account. +

+

If you have “Gnuplot” installed, you may plot the amount or running +total of any register by using the script report, which is +included in the Ledger distribution. The only requirement is that you +add either --amount-data (-j) or --total-data (-J) to +your register command, in order to plot either the amount or +total column, respectively. +

+
+ + + +

7.1.4 The print command

+ + +

The print command prints out ledger transactions in a textual +format that can be parsed by Ledger. They will be properly formatted, +and output in the most economic form possible. The print +command also takes a list of optional regexes, which will cause only +those postings which match in some way to be printed. +

+

The print command can be a handy way to clean up a ledger +file whose formatting has gotten out of hand. +

+
+ + + +

7.2 Reports in other Formats

+ + + + + + + + + + + +
+ + + +

7.2.1 Comma Separated Values files

+ + + + + + +
+ + + +

7.2.1.1 The csv command

+ + +

The csv command prints the desired ledger +transactions in a csv format suitable for importing into other programs. +You can specify the transactions to print using all the normal +limiting and searching functions. +

+
+ + + +

7.2.1.2 The convert command

+ + + + + +

The convert command parses a comma separated value (csv) file +and prints Ledger transactions. Many banks offer csv file downloads. +Unfortunately, the file formats, aside from the commas, are all +different. The ledger convert command tries to help as much +as it can. +

+

Your bank’s csv files will have fields in different orders from other +banks, so there must be a way to tell Ledger what to expect. Insert +a line at the beginning of the csv file that describes the fields to +Ledger. +

+

For example, this is a portion of a csv file downloaded from a credit +union in the United States: +

+
+
Account Name: VALUFIRST CHECKING
+Account Number: 71
+Date Range: 11/13/2011 - 12/13/2011
+
+Transaction Number,Date,Description,Memo,Amount Debit,Amount Credit,Balance,Check Number,Fees
+767718,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-8.80,,00001640.04,,
+767406,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-1.03,,00001648.84,,
+683342,12/13/2011,"Visa Checking","NetFlix Date 12/12/11 000326585896 5968",-21.85,,00001649.87,,
+639668,12/13/2011,"Withdrawal","ID: 1741472662 CO: XXAA.COM PAYMNT",-236.65,,00001671.72,,
+1113648,12/12/2011,"Withdrawal","Tuscan IT #00037657",-29.73,,00001908.37,,
+
+ +

Unfortunately, as it stands Ledger cannot read it, but you can. Ledger +expects the first line to contain a description of the fields on each +line of the file. The fields ledger can recognize contain these +case-insensitive strings date, posted, code, +payee or desc or description, amount, +cost, total, and note. +

+

Delete the account description lines at the top, and replace the first +line in the data above with: +

+
+
,date,payee,note,amount,,,code,
+
+ +

Then execute ledger like this: +

+
+
$ ledger convert download.csv --input-date-format "%m/%d/%Y"
+
+ +

Where the --input-date-format DATE_FORMAT option tells +ledger how to interpret the dates. +

+

Importing csv files is a lot of work, but is very amenable to +scripting. +

+

If there are columns in the bank data you would like to keep in your +ledger data, besides the primary fields described above, you can name +them in the field descriptor list and Ledger will include them in the +transaction as meta data if it doesn’t recognize the field name. For +example, if you want to capture the bank transaction number and it +occurs in the first column of the data use: +

+
+
transid,date,payee,note,amount,,,code,
+
+ +

Ledger will include ‘; transid: 767718’ in the first transaction +from the file above. +

+ + + + + +

The convert command accepts four options. They are +--invert which inverts the amount field, --auto-match +which automatically matches an account from the Ledger journal for every +CSV line, --account STR which you can use to specify the +account to balance against, and --rich-data which stores +additional tag/value pairs. +

+

Using the two first lines of the above csv file, +

+
+
,date,payee,note,amount,,,code,
+767718,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-8.80,,00001640.04,,
+767406,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-1.03,,00001648.84,,
+
+ +

and launching the below command, +

+
+
$ ledger convert download.csv --input-date-format "%m/%d/%Y" \
+  --invert --account Assets:MyBank --rich-data \
+  --file sample.dat --now=2012/01/13
+
+ +

you will get the result: +

+
+
2011/12/13 * Withdrawal  ;ACE HARDWARE 16335 S HOUGHTON RD
+    ; CSV: 767718,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-8.80,,00001640.04,,
+    ; Imported: 2012/01/13
+    ; UUID: dfdc3c3d5c54c6967dd39d5b4e4fd1ea76e87233
+    Expenses:Unknown                             8.8
+    Assets:MyBank
+
+2011/12/13 * Withdrawal  ;ACE HARDWARE 16335 S HOUGHTON RD
+    ; CSV: 767406,12/13/2011,"Withdrawal","ACE HARDWARE 16335 S HOUGHTON RD",-1.03,,00001648.84,,
+    ; Imported: 2012/01/13
+    ; UUID: 63086448b1f29f7fd6efb11ea40660185a213f9d
+    Expenses:Unknown                            1.03
+    Assets:MyBank
+
+ +

The three added metadata are: ‘CSV’ as the original line from csv +file, ‘Imported’ as the date when the csv file was imported into +Ledger, and ‘UUID’ as a checksum of original csv line. +

+

If an entry with the same ‘UUID’ tag is already included in the +normal ledger file (specified via --file FILE (-f) or via +the environment variable LEDGER_FILE) this entry will not be +printed again. +

+

In the output above, the account is ‘Expenses:Unknown’ for CSV +lines. You can use the --auto-match option to automatically +match an account from your Ledger journal. +

+

You can also use convert with payee and account +directives. First, you can use the payee and alias +directive to rewrite the payee field based on some rules. Then +you can use the account and its payee directive to specify the +account. I use it like this, for example: +

+
+
payee Aldi
+    alias ^ALDI SUED SAGT DANKE
+account Aufwand:Einkauf:Lebensmittel
+    payee ^(Aldi|Alnatura|Kaufland|REWE)$
+
+ +

Note that it may be necessary for the output of ‘ledger convert’ +to be passed through ledger print a second time if you want to +match on the new payee field. During the ledger convert run, +only the original payee name as specified in the csv data seems to be +used. +

+
+ + + +

7.2.2 The lisp command

+ + + +

The lisp command prints results in a form that can be read +directly by Emacs Lisp. The format of the sexp is: +

+
+
((BEG-POS CLEARED DATE CODE PAYEE
+  (ACCOUNT AMOUNT)...)  ; list of postings
+ ...)                   ; list of transactions
+
+ +

emacs can also be used as a synonym for lisp. +

+
+ + + +

7.2.3 Emacs org Mode

+ + +

Org mode has a sub-system known as Babel which allows for literate +programming. This allows you to mix text and code within the same +document and automatically execute code which may generate results +which will then appear in the text. +

+

One of the languages supported by Babel is Ledger, so that you can have +ledger commands embedded in a text file and have the output of ledger +commands also appear in the text file. The output can be updated +whenever any new ledger entries are added. +

+

For instance, the following Org mode text document snippet illustrates +a very naive but still useful application of the Babel system: +

+
+
* A simple test of ledger in an org file
+The following are some entries and I have requested that ledger be run
+to generate a balance on the accounts.  I could have asked for
+a register or, in fact, anything at all the ledger can do through
+command-line options.
+
+#+begin_src ledger :cmdline bal :results value
+2010/01/01 * Starting balance
+  assets:bank:savings       £1300.00
+  income:starting balances
+2010/07/22 * Got paid
+  assets:bank:chequing      £1000.00
+  income:salary
+2010/07/23 Rent
+  expenses:rent              £500.00
+  assets:bank:chequing
+#+end_src
+
+#+results:
+:            £1800.00  assets:bank
+:             £500.00    chequing
+:            £1300.00    savings
+:             £500.00  expenses:rent
+:           £-2300.00  income
+:           £-1000.00    salary
+:           £-1300.00    starting balances
+
+ +

Typing C-c C-c anywhere in the “ledger source code block” will +invoke ledger on the contents of that block and generate a “results” +block. The results block can appear anywhere in the file but, by +default, will appear immediately below the source code block. +

+

You can combine multiple source code blocks before executing ledger and +do all kinds of other wonderful things with Babel (and Org mode). +

+
+ + + +

7.2.4 Org mode with Babel

+ +

Using Babel, it is possible to record financial transactions +conveniently in an org file and subsequently generate the financial +reports required. +

+

As of Org mode 7.01, Ledger support is provided. Check the Babel +documentation on Worg for instructions on how to achieve this but +I currently do this directly as follows: +

+
+
(org-babel-do-load-languages
+ 'org-babel-load-languages
+ '((ledger . t)         ;this is the important one for this tutorial
+  ))
+
+ +

Once Ledger support in Babel has been enabled, we can proceed to +include Ledger entries within an org file. There are three ways (at +least) in which these can be included: +

+
    +
  1. place all Ledger entries within one single source block and execute this +block with different arguments to generate the appropriate reports, + +
  2. place Ledger entries in more than one source block and use the +noweb literary programming approach, supported by Babel, to +combine these into one block elsewhere in the file for processing by +Ledger, + +
  3. place Ledger entries in different source blocks and use tangle to +generate a Ledger file which you can subsequently process using Ledger +directly. +
+ +

The first two are described in more detail in this short tutorial. +

+ + + + + + + + + + + +
+ + + +

7.2.4.1 Embedded Ledger example with single source block

+ +

The easiest, albeit possibly least useful, way in which to use Ledger +within an org file is to use a single source block to record all Ledger +entries. The following is an example source block: +

+
+
#+name: allinone
+#+begin_src ledger
+2010/01/01 * Starting balance
+  assets:bank:savings       £1300.00
+  income:starting balances
+2010/07/22 * Got paid
+  assets:bank:chequing      £1000.00
+  income:salary
+2010/07/23 Rent
+  expenses:rent              £500.00
+  assets:bank:chequing
+2010/07/24 Food
+  expenses:food              £150.00
+  assets:bank:chequing
+2010/07/31 * Interest on bank savings
+  assets:bank:savings          £3.53
+  income:interest
+2010/07/31 * Transfer savings
+  assets:bank:savings        £250.00
+  assets:bank:chequing
+2010/08/01 got paid again
+  assets:bank:chequing      £1000.00
+  income:salary
+#+end_src
+
+ +

In this example, we have combined both expenses and income into one set +of Ledger entries. We can now generate register and balance reports (as +well as many other types of reports) using Babel to invoke Ledger with +specific arguments. The arguments are passed to Ledger using the +:cmdline header argument. In the code block above, there is no +such argument so the system takes the default. For Ledger code blocks, +the default :cmdline argument is bal and the result of +evaluating this code block (C-c C-c) would be: +

+
+
#+results: allinone()
+:            £2653.53  assets:bank
+:            £1100.00    chequing
+:            £1553.53    savings
+:             £650.00  expenses
+:             £150.00    food
+:             £500.00    rent
+:           £-3303.53  income
+:              £-3.53    interest
+:           £-2000.00    salary
+:           £-1300.00    starting balances
+
+ +

If, instead, you wished to generate a register of all the transactions, +you would change the #+begin_src line for the code block to +include the required command-line option: +

+
+
#+begin_src ledger :cmdline reg
+
+ +

Evaluating the code block again would generate a different report. +

+

Having to change the actual directive on the code block and re-evaluate +makes it difficult to have more than one view of your transactions and +financial state. Eventually, Babel will support passing arguments to +#+call evaluations of code blocks but this support is missing +currently. Instead, we can use the concepts of literary programming, as +implemented by the noweb features of Babel, to help us. +

+
+ + + +

7.2.4.2 Multiple Ledger source blocks with noweb

+ +

The noweb feature of Babel allows us to expand references to +other code blocks within a code block. For Ledger, this can be used to +group transactions according to type, say, and then bring various sets +of transactions together to generate reports. +

+

Using the same transactions used above, we could consider splitting +these into expenses and income, as follows: +

+
+ + + +

7.2.4.3 Income Entries

+ +

The first set of entries relates to income, either monthly pay or +interest, all typically going into one of my bank accounts. Here, I have +placed several entries, but we could have had each entry in a separate +src block. Note that all code blocks you wish to refer to later +must have the :noweb yes header argument specified. +

+
+
#+name: income
+#+begin_src ledger :noweb yes
+2010/01/01 * Starting balance
+  assets:bank:savings       £1300.00
+  income:starting balances
+2010/07/22 * Got paid
+  assets:bank:chequing      £1000.00
+  income:salary
+2010/07/31 * Interest on bank savings
+  assets:bank:savings          £3.53
+  income:interest
+2010/07/31 * Transfer savings
+  assets:bank:savings        £250.00
+  assets:bank:chequing
+2010/08/01 got paid again
+  assets:bank:chequing      £1000.00
+  income:salary
+#+end_src
+
+ +
+ + + +

7.2.4.4 Expenses

+ +

The following entries relate to personal expenses, such as rent and +food. Again, these have all been placed in a single src block but +could have been done individually. +

+
+
#+name: expenses
+#+begin_src ledger :noweb yes
+2010/07/23 Rent
+  expenses:rent              £500.00
+  assets:bank:chequing
+2010/07/24 Food
+  expenses:food              £150.00
+  assets:bank:chequing
+#+end_src
+
+ +
+ + + +

7.2.4.5 Financial Summaries

+ +

Given the ledger entries defined above in the income and expenses code +blocks, we can now refer to these using the noweb expansion directives, +<<name>>. We can now define different code blocks to generate +specific reports for those transactions. Below are two examples, one to +generate a balance report and one to generate a register report of all +transactions. +

+
+ + + +

7.2.4.6 An overall balance summary

+ + +

The overall balance of your account and expenditure with a breakdown +according to category is specified by passing the :cmdline bal +argument to Ledger. This code block can now be evaluated (C-c C-c) +and the results generated by incorporating the transactions referred to +by the <<income>> and <<expenses>> lines. +

+
+
#+name: balance
+#+begin_src ledger :cmdline bal :noweb yes
+<<income>>
+<<expenses>>
+#+end_src
+
+#+results: balance
+:            £2653.53  assets:bank
+:            £1100.00    chequing
+:            £1553.53    savings
+:             £650.00  expenses
+:             £150.00    food
+:             £500.00    rent
+:           £-3303.53  income
+:              £-3.53    interest
+:           £-2000.00    salary
+:           £-1300.00    starting balances
+
+ +

If you want a less detailed breakdown of where your money is, you can +specify the --collapse (-n) flag (i.e. ‘:cmdline -n bal’) +to tell Ledger to exclude sub-accounts in the report. +

+
+
#+begin_src ledger :cmdline -n bal :noweb yes
+<<income>>
+<<expenses>>
+#+end_src
+
+#+results:
+:            £2653.53  assets
+:             £650.00  expenses
+:           £-3303.53  income
+
+ +
+ + + +

7.2.4.7 Generating a monthly register

+ + + +

You can also generate a monthly register (the reg command) by +executing the following src block. This presents a summary of +transactions for each monthly period (the --monthly (-M) +argument) with a running total in the final column (which should be 0 at +the end if all the entries are correct). +

+
+
#+name: monthlyregister
+#+begin_src ledger :cmdline -M reg :noweb yes
+<<income>>
+<<expenses>>
+#+end_src
+
+#+results: monthlyregister
+:2010/01/01 - 2010/01/31         assets:bank:savings       £1300.00    £1300.00
+:                                in:starting balances     £-1300.00           0
+:2010/07/01 - 2010/07/31         assets:bank:chequing       £100.00     £100.00
+:                                assets:bank:savings        £253.53     £353.53
+:                                expenses:food              £150.00     £503.53
+:                                expenses:rent              £500.00    £1003.53
+:                                income:interest             £-3.53    £1000.00
+:                                income:salary            £-1000.00           0
+:2010/08/01 - 2010/08/01         assets:bank:chequing      £1000.00    £1000.00
+:                                income:salary            £-1000.00           0
+
+ +

We could also generate a monthly report on our assets showing how these +are increasing (or decreasing!). In this case, the final column will be +the running total of the assets in our ledger. +

+
+
#+name: monthlyassetsregister
+#+begin_src ledger :cmdline -M reg assets :noweb yes
+<<income>>
+<<expenses>>
+#+end_src
+
+#+results: monthlyassetsregister
+: 2010/01/01 - 2010/01/31         assets:bank:savings       £1300.00    £1300.00
+: 2010/07/01 - 2010/07/31         assets:bank:chequing       £100.00    £1400.00
+:                                 assets:bank:savings        £253.53    £1653.53
+: 2010/08/01 - 2010/08/01         assets:bank:chequing      £1000.00    £2653.53
+
+ +
+ + + +

7.2.4.8 Summary

+ +

This short tutorial shows how Ledger entries can be embedded in an org +file and manipulated using Babel. However, only simple Ledger features +have been illustrated; please refer to the Ledger documentation for +examples of more complex operations on a ledger. +

+
+ + + +

7.2.5 The pricemap command

+ + +

If you have the graphviz graph visualization package installed, +ledger can generate a graph of the relationship between your various +commodities. The output file is in the “dot” format. +

+

This is probably not very interesting, unless you have many different +commodities valued in terms of each other. For example, multiple +currencies and multiple investments valued in those currencies. +

+
+ + + +

7.2.6 The xml command

+ + +

By default, Ledger uses a human-readable data format, and displays its +reports in a manner meant to be read on screen. For the purpose of +writing tools which use Ledger, however, it is possible to read and +display data using XML. This section documents that format. +

+

The general format used for Ledger data is: +

+
+
<?xml version="1.0"?>
+<ledger>
+  <xact>...</xact>
+  <xact>...</xact>
+  <xact>...</xact>...
+</ledger>
+
+ +

The data stream is enclosed in a ledger tag, which contains a +series of one or more transactions. Each xact describes one +transaction and contains a series of one or more postings: +

+
+
<xact>
+  <en:date>2004/03/01</en:date>
+  <en:cleared/>
+  <en:code>100</en:code>
+  <en:payee>John Wiegley</en:payee>
+  <en:postings>
+    <posting>...</posting>
+    <posting>...</posting>
+    <posting>...</posting>...
+  </en:postings>
+</xact>
+
+ +

The date format for en:date is always YYYY/MM/DD. The +en:cleared tag is optional, and indicates whether the posting has +been cleared or not. There is also an en:pending tag, for +marking pending postings. The en:code and en:payee tags +both contain whatever text the user wishes. +

+

After the initial transaction data, there must follow a set of postings +marked with en:postings. Typically these postings will all +balance each other, but if not they will be automatically balanced into +an account named ‘Unknown’. +

+

Within the en:postings tag is a series of one or more +posting’s, which have the following form: +

+
+
<posting>
+  <tr:account>Expenses:Computer:Hardware</tr:account>
+  <tr:amount>
+    <value type="amount">
+      <amount>
+        <commodity flags="PT">$</commodity>
+        <quantity>90.00</quantity>
+      </amount>
+    </value>
+  </tr:amount>
+</posting>
+
+ +

This is a basic posting. It may also begin with +tr:virtual and/or tr:generated tags, to indicate virtual +and auto-generated postings. Then follows the tr:account +tag, which contains the full name of the account the posting is +related to. Colons separate parent from child in an account name. +

+

Lastly follows the amount of the posting, indicated by +tr:amount. Within this tag is a value tag, of which +there are four different kinds, each with its own format: +

+
    +
  1. Boolean, +
  2. integer, +
  3. amount, +
  4. balance. +
+ +

The format of a Boolean value is true or false +surrounded by a boolean tag, for example: +

+
+
<boolean>true</boolean>
+
+ +

The format of an integer value is the numerical value surrounded by an +integer tag, for example: +

+
+
<integer>12036</integer>
+
+ +

The format of an amount contains two members, the commodity and the +quantity. The commodity can have a set of flags that indicate how to +display it. The meaning of the flags (all of which are optional) are: +

+
+
P
+

The commodity is prefixed to the value. +

+
+
S
+

The commodity is separated from the value by a space. +

+
+
T
+

Thousands markers are used to display the amount. +

+
+
E
+

The format of the amount is European, with period used as a thousands +marker, and comma used as the decimal point. +

+
+
+ +

The actual quantity for an amount is an integer of arbitrary size. +Ledger uses the GNU multiple precision arithmetic library to handle +such values. The XML format assumes the reader to be equally capable. +Here is an example amount: +

+
+
<value type="amount">
+  <amount>
+    <commodity flags="PT">$</commodity>
+    <quantity>90.00</quantity>
+  </amount>
+</value>
+
+ +

Lastly, a balance value contains a series of amounts, each with a +different commodity. Unlike the name, such a value does need to +balance. It is called a balance because it sums several amounts. For +example: +

+
+
<value type="balance">
+  <balance>
+    <amount>
+      <commodity flags="PT">$</commodity>
+      <quantity>90.00</quantity>
+    </amount>
+    <amount>
+      <commodity flags="TE">DM</commodity>
+      <quantity>200.00</quantity>
+    </amount>
+  </balance>
+</value>
+
+ +

That is the extent of the XML data format used by Ledger. It will +output such data if the xml command is used, and can read +the same data. +

+
+ + + +

7.2.7 prices and pricedb commands

+ + + + +

The prices command displays the price history for matching +commodities. The --average (-A) option is useful with this +report, to display the running average price, or --deviation +(-D) to show each price’s deviation from that average. +

+

There is also a pricedb command which outputs the same +information as prices, but does so in a format that can be +parsed by Ledger. This is useful for generating and tidying up +pricedb database files. +

+
+ + + +

7.3 Reports about your Journals

+ + + + + + + + + + + + +
+ + + +

7.3.1 accounts

+ + +

The accounts command reports all of the accounts in the +journal. Following the command with a regular expression will limit the +output to accounts matching the regex. The output is sorted by name. +Using the --count option will tell you how many entries use +each account. +

+
+ + + +

7.3.2 payees

+ + +

The payees command reports all of the unique payees in the +journal. Using the --count option will tell you how many +entries use each payee. To filter the payees displayed you must use the +prefix @: +

+
+
$ ledger payees @Nic
+
+
+
Nicolas
+Nicolas BOILABUS
+Oudtshoorn Municipality
+Vaca Veronica
+
+ +
+ +
+

+Next: , Previous: , Up: Reports about your Journals   [Contents][Index]

+
+ +

7.3.3 commodities

+ + +

Report all commodities present in the journals under consideration. The +output is sorted by name. Using the --count option will tell +you how many entries use each commodity. +

+
+ +
+

+Next: , Previous: , Up: Reports about your Journals   [Contents][Index]

+
+ +

7.3.4 tags

+ + + +

The tags command reports all of the tags in the journal. The +output is sorted by name. Using the --count option will tell +you how many entries use each tag. Using the --values option +will report the values used by each tag. +

+
+ +
+

+Next: , Previous: , Up: Reports about your Journals   [Contents][Index]

+
+ +

7.3.5 xact

+ + + + +

The xact command simplifies the creation of new transactions. +It works on the principle that 80% of all postings are variants of +earlier postings. Here’s how it works: +

+

Say you currently have this posting in your ledger file: +

+
+
2004/03/15 * Viva Italiano
+    Expenses:Food                       $12.45
+    Expenses:Tips                        $2.55
+    Liabilities:MasterCard             $-15.00
+
+ +

Now it’s ‘2004/4/9’, and you’ve just eaten at ‘Viva Italiano’ +again. The exact amounts are different, but the overall form is the +same. With the xact command you can type: +

+
+
$ ledger xact 2004/4/9 viva food 11 tips 2.50
+
+ +

This produces the following output: +

+
+
2004/04/09 Viva Italiano
+    Expenses:Food                             $11.00
+    Expenses:Tips                              $2.50
+    Liabilities:MasterCard
+
+ +

It works by finding a past posting matching the regular expression +‘viva’, and assuming that any accounts or amounts specified will be +similar to that earlier posting. If Ledger does not succeed in +generating a new transaction, an error is printed and the exit code is +set to ‘1’. +

+

Here are a few more examples of the xact command, assuming +the above journal transaction: +

+
+
$ ledger xact 4/9 viva 11.50
+$ ledger xact 4/9 viva 11.50 checking # (from `checking')
+$ ledger xact 4/9 viva food 11.50 tips 8
+$ ledger xact 4/9 viva food 11.50 tips 8 cash
+$ ledger xact 4/9 viva food $11.50 tips $8 cash
+$ ledger xact 4/9 viva dining "DM 11.50"
+
+ +

draft and entry are both synonyms of +xact. entry is provided for backwards compatibility +with Ledger 2.X. +

+
+ +
+

+Next: , Previous: , Up: Reports about your Journals   [Contents][Index]

+
+ +

7.3.6 stats

+ + + +

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+
+ +
+

+Previous: , Up: Reports about your Journals   [Contents][Index]

+
+ +

7.3.7 select

+ + +

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+
+ + + +

8 Command-Line Syntax

+ + + + + + + + +
+ + + +

8.1 Basic Usage

+ +

This chapter describes Ledger’s features and options. You may wish to +survey this to get an overview before diving into the Ledger Tutorial and more detailed examples that follow. +

+

Ledger has a very simple command-line interface, named—enticingly +enough—ledger. It supports a few reporting commands, and +a large number of options for refining the output from those commands. +The basic syntax of any ledger command is: +

+
+
$ ledger [OPTIONS...] COMMAND [ARGS...]
+
+ +

After the command word there may appear any number of arguments. For +most commands, these arguments are regular expressions that cause the +output to relate only to postings matching those regular expressions. +For the xact command, the arguments have a special meaning, +described below. +

+

The regular expressions arguments always match the account name that +a posting refers to. To match on the payee of the transaction +instead, precede the regular expression with ‘payee’ or +‘@’. For example, the following balance command reports account +totals for rent, food and movies, but only those whose payee matches +Freddie: +

+
+
$ ledger bal rent food movies payee freddie
+
+ +

or +

+
+
$ ledger bal rent food movies @freddie
+
+ +

There are many, many command options available with the ledger +program, and it takes a while to master them. However, none of them are +required to use the basic reporting commands. +

+
+ + + +

8.2 Command-Line Quick Reference

+ + + + + + + + + + + +
+ + + +

8.2.1 Basic Reporting Commands

+ +
+
balance + +
+
bal + +
+

Show account balances. +

+
+
register + +
+
reg + +
+

Show all transactions with running total. +

+
+
csv + +
+
+

Show transactions in csv format, for exporting to other programs. +

+
+
print + +
+

Print transactions in a format readable by ledger. +

+
+
xml + +
+

Produce XML output of the register command. +

+
+
lisp + +
+
emacs + +
+

Produce s-expression output, suitable for Emacs. +

+
+
equity + +
+

Print account balances as transactions. +

+
+
prices + +
+

Print price history for matching commodities. +

+
+
pricedb + +
+

Print price history for matching commodities in a format readable by +ledger. +

+
+
xact + +
+

Generate transactions based on previous postings. +

+
+
+ +
+ + + +

8.2.2 Basic Options

+ +
+
--help + +
+
-h + +
+

Display the man page for ledger. +

+
+
--version + +
+

Print version information and exit. +

+
+
--file FILE + +
+
-f FILE + +
+

Read FILE as a ledger file. +

+
+
--output FILE + +
+
-o FILE + +
+

Redirect output to FILE. +

+
+
--init-file FILE + +
+
-i FILE + +
+

Specify an options file. +

+
+
--import FILE + +
+

Import FILE as Python module. +

+
+
--account STR + +
+
-a STR + +
+

Specify default account STR for QIF file postings. +

+
+
+ +
+ + + +

8.2.3 Report Filtering

+ +
+
--current + +
+
-c + +
+

Display only transactions on or before the current date. +

+
+
--begin DATE + +
+
-b DATE + +
+

Limit the processing to transactions on or after DATE. +

+
+
--end DATE + +
+
-e DATE + +
+

Limit the processing to transactions before DATE. +

+
+
--period PERIOD_EXPRESSION + +
+
-p PERIOD_EXPRESSION + +
+

Limit the processing to transactions in PERIOD_EXPRESSION. +

+
+
--period-sort VEXPR + +
+

Sort postings within each period according to VEXPR. +

+
+
--cleared + +
+
-C + +
+

Display only cleared postings. +

+
+
--dc + +
+

Display register or balance in debit/credit format. +

+
+
--uncleared + +
+
-U + +
+

Display only uncleared postings. +

+
+
--real + +
+
-R + +
+

Display only real postings. +

+
+
--actual + +
+
-L + +
+

Display only actual postings, not automated ones. +

+
+
--related + +
+
-r + +
+

Display related postings. +

+
+
--budget + +
+

Display how close your postings meet your budget. +

+
+
--add-budget + +
+

Show unbudgeted postings. +

+
+
--unbudgeted + +
+

Show only unbudgeted postings. +

+
+
--forecast-while VEXPR + +
+
--forecast VEXPR + +
+

Project balances into the future. +

+
+
--limit EXPR + +
+
-l EXPR + +
+

Limit which postings are used in calculations by EXPR. +

+
+
--amount EXPR + +
+
-t EXPR + +
+

Change value expression reported in register report. +

+
+
--total VEXPR + +
+
-T VEXPR + +
+

Change the value expression used for “totals” column in +register and balance reports. +

+
+
+ +
+ + + +

8.2.4 Error Checking and Calculation Options

+ +
+
--strict + +
+

Accounts, tags or commodities not previously declared will cause +warnings. +

+
+
--pedantic + +
+

Accounts, tags or commodities not previously declared will cause errors. +

+
+
--check-payees + +
+

Enable strict and pedantic checking for payees as well as accounts, +commodities and tags. This only works in conjunction with +--strict or --pedantic. +

+
+
--immediate + +
+

Instruct ledger to evaluate calculations immediately rather than lazily. +

+
+
+ +
+ + + +

8.2.5 Output Customization

+ +
+
--collapse + +
+
-n + +
+

Collapse transactions with multiple postings. +

+
+
--subtotal + +
+
-s + +
+

Report register as a single subtotal. +

+
+
--by-payee + +
+
-P + +
+

Report subtotals by payee. +

+
+
--empty + +
+
-E + +
+

Include empty accounts in the report. +

+
+
--weekly + +
+
-W + +
+

Report posting totals by week. +

+
+
--quarterly + +
+

Report posting totals by quarter. +

+
+
--yearly + +
+
-Y + +
+

Report posting totals by year. +

+
+
--dow + +
+

Report posting totals by day of week. +

+
+
--sort VEXPR + +
+
-S VEXPR + +
+

Sort a report using VEXPR. +

+
+
--wide + +
+
-w + +
+

Assume 132 columns instead of 80. +

+
+
--head INT + +
+

Report the first INT postings. +

+
+
--tail INT + +
+

Report the last INT postings. +

+
+
--pager FILE + +
+

Direct output to FILE pager program. +

+
+
--no-pager + +
+

Direct output to stdout, avoiding pager program. +

+
+
--average + +
+
-A + +
+

Report the average posting value. +

+
+
--deviation + +
+
-D + +
+

Report each posting’s deviation from the average. +

+
+
--percent + +
+
-% + +
+

Show subtotals in the balance report as percentages. +

+
+
--pivot TAG + +
+

Produce a pivot table of the TAG type specified. +

+
+
--amount-data + +
+
-j + +
+

Show only the date and value columns to format the output for plots. +

+
+
--plot-amount-format FORMAT_STRING + +
+

Specify the format for the plot output. +

+
+
--total-data + +
+
-J + +
+

Show only the date and total columns to format the output for plots. +

+
+
--plot-total-format FORMAT_STRING + +
+

Specify the format for the plot output. +

+
+
--display EXPR + +
+
-d EXPR + +
+

Display only postings that meet the criteria in the EXPR. +

+
+
--date-format DATE_FORMAT + +
+
-y DATE_FORMAT + +
+

Change the basic date format used in reports. +

+
+
--format FORMAT_STRING + +
+
--balance-format FORMAT_STRING + +
+
--register-format FORMAT_STRING + +
+
--prices-format FORMAT_STRING + +
+
-F FORMAT_STRING + +
+

Set the reporting format for various reports. +

+
+
--anon + +
+

Print the ledger register with anonymized accounts and payees, useful +for filing bug reports. +

+
+
+ +
+ + + +

8.2.6 Grouping Options

+ +
+
--by-payee + +
+
-P + +
+

Group postings by common payee names. +

+
+
--daily + +
+
-D + +
+

Group postings by day. +

+
+
--weekly + +
+
-W + +
+

Group postings by week. +

+
+
--monthly + +
+
-M + +
+

Group postings by month. +

+
+
--quarterly + +
+

Group postings by quarter. +

+
+
--yearly + +
+
-Y + +
+

Group postings by year. +

+
+
--dow + +
+

Group by day of weeks. +

+
+
--subtotal + +
+
-s + +
+

Group postings together, similar to the balance report. +

+
+
+ +
+ + + +

8.2.7 Commodity Reporting

+ +
+
--price-db FILE + +
+

Use FILE for retrieving stored commodity prices. +

+
+
--price-exp INT + +
+
--leeway INT + +
+
-Z INT + +
+

Set expected freshness of prices in INT minutes. +

+
+
--download + +
+
-Q + +
+

Download quotes using the script named getquote. +

+ +
+
--quantity + +
+
-O + +
+

Report commodity totals without conversion. +

+
+
--basis + +
+
-B + +
+

Report cost basis. +

+
+
--market + +
+
-V + +
+

Report last known market value. +

+
+
--gain + +
+
-G + +
+

Report net gain or loss for commodities that have a price history. +

+
+
+ +
+ + + +

8.3 Detailed Option Description

+ + + + + + + + + + + + +
+ + + +

8.3.1 Global Options

+ +

Options for Ledger reports affect three separate scopes of operation: +Global, Session, and Report. In practice there is very little +difference between these scopes. Ledger 3.0 contains provisions for +GUIs, which would make use of the different scopes by keeping an +instance of Ledger running in the background and running multiple +sessions with multiple reports per session. +

+
+
--args-only + +
+

Ignore all environment and init-file settings and +use only command-line arguments to control Ledger. Useful for debugging +or testing small journal files not associated with your main financial +database. +

+
+
--debug CODE + +
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +If ledger has been built with debug options this will provide extra data during +the run. +

+
+
--help + +
+
-h + +
+

Display the man page for ledger. +

+
+
--init-file FILE + +
+

Specify the location of the init file. The default is home directory +~/.ledgerrc, or current directory ./.ledgerrc if not found +in home directory. +

+
+
--options + +
+

Display the options in effect for this Ledger invocation, along with +their values and the source of those values, for example: +

+
+
$ ledger --options bal --cleared
+
+ +
+
===============================================================================
+[Global scope options]
+             --args-only                                             --args-only
+
+[Session scope options]
+                  --file = A9349E4.dat                               --file
+
+[Report scope options]
+               --cleared                                             --cleared
+               --columns = 80                                        --columns
+                 --limit = cleared                                   --cleared
+===============================================================================
+              $15.00  Expenses
+              $12.45    Food
+               $2.55    Tips
+             $-15.00  Liabilities:MasterCard
+--------------------
+                   0
+
+ +

For the source column, a value starting with a ‘-’ or ‘--’ +indicated the source was a command-line argument. If the entry starts +with a ‘$’, the source was an environment variable. If the source +is ?normalize the value was set internally by ledger, in +a function called normalize_options. +

+
+
--script FILE + +
+

Execute a ledger script. +

+
+
--trace INT + +
+

Enable tracing. The INT specifies the level of trace desired. +

+
+
--verbose + +
+
-v + +
+

Print detailed information on the execution of Ledger. +

+
+
--verify + +
+

Enable additional assertions during run-time. This causes a significant +slowdown. When combined with --debug CODE ledger will +produce memory trace information. +

+
+
--verify-memory + +
+

Verify that every constructed object is properly destructed. This is for +debugging purposes only. +

+
+
--version + +
+

Print version information and exit. +

+
+
+ +
+ + + +

8.3.2 Session Options

+ +

Options for Ledger reports affect three separate scopes of operation: +Global, Session, and Report. In practice there is very little +difference between these scopes. Ledger 3.0 contains provisions for +GUIs, which would make use of the different scopes by keeping an +instance of Ledger running in the background and running multiple +sessions with multiple reports per session. +

+
+
--check-payees + +
+

Enable strict and pedantic checking for payees as well as accounts, +commodities and tags. This only works in conjunction with +--strict or --pedantic. +

+
+
--day-break + +
+

Break up register report of timelog entries that span multiple +days by day. +

+
+
--decimal-comma + +
+

Direct Ledger to parse journals using the European standard comma as +a decimal separator, not the usual period. +

+
+
--download + +
+
-Q + +
+

Direct Ledger to download prices. +

+
+
--explicit + +
+

Direct Ledger to require pre-declarations for entities (such as accounts, +commodities and tags) rather than taking entities from cleared +transactions as defined. This option is useful in combination with +--strict or --pedantic. +

+
+
--file FILE + +
+
-f FILE + +
+

Specify the input FILE for this invocation. +

+ +
+
--input-date-format DATE_FORMAT + +
+

Specify the input date format for journal entries. For example, +

+
+
$ ledger convert Export.csv --input-date-format "%m/%d/%Y"
+
+ +

Would convert the Export.csv file to ledger format, assuming +the dates in the CSV file are like 12/23/2009 (see Date and Time Format Codes). +

+
+
--master-account STR + +
+

Prepend all account names with the argument. +

+
+
$ ledger -f drewr3.dat bal --no-total --master-account HUMBUG
+
+ +
+
                   0  HUMBUG
+         $ -3,804.00    Assets
+          $ 1,396.00      Checking
+             $ 30.00        Business
+         $ -5,200.00      Savings
+         $ -1,000.00    Equity:Opening Balances
+          $ 6,654.00    Expenses
+          $ 5,500.00      Auto
+             $ 20.00      Books
+            $ 300.00      Escrow
+            $ 334.00      Food:Groceries
+            $ 500.00      Interest:Mortgage
+         $ -2,030.00    Income
+         $ -2,000.00      Salary
+            $ -30.00      Sales
+            $ 180.00    Liabilities
+            $ -20.00      MasterCard
+            $ 200.00      Mortgage:Principal
+
+ +
+
--no-aliases + +
+

Ledger does not expand any aliases if this option is specified. +

+
+
--pedantic + +
+

Accounts, tags or commodities not previously declared will cause errors. +

+
+
--permissive + +
+

Quiet balance assertions. +

+
+
--price-db FILE + +
+

Specify the location of the price entry data file. +

+
+
--price-exp INT + +
+
--leeway INT + +
+
-Z INT + +
+

Set the expected freshness of price quotes, in INT minutes. That +is, if the last known quote for any commodity is older than this value, +and if --download is being used, then the Internet will be +consulted again for a newer price. Otherwise, the old price is still +considered to be fresh enough. +

+
+
--strict + +
+

Ledger normally silently accepts any account or commodity in a posting, +even if you have misspelled a commonly used one. The option +--strict changes that behavior. While running with +--strict, Ledger interprets all cleared transactions as +correct, and if it encounters a new account or commodity (same as +a misspelled commodity or account) it will issue a warning giving you +the file and line number of the problem. +

+
+
--recursive-aliases + +
+

Normally, ledger only expands aliases once. With this option, ledger +tries to expand the result of alias expansion recursively, until no more +expansions apply. +

+
+
--time-colon + +
+

The --time-colon option will display the value for a seconds +based commodity as real hours and minutes. +

+

For example 8100 seconds by default will be displayed as 2.25 whereas +with the --time-colon option they will be displayed as 2:15. +

+
+
--value-expr VEXPR + +
+

Set a global value expression annotation. +

+
+
+ +
+ + + +

8.3.3 Report Options

+ +

Options for Ledger reports affect three separate scopes of operation: +Global, Session, and Report. In practice there is very little +difference between these scopes. Ledger 3.0 contains provisions for +GUIs, which would make use of the different scopes by keeping an +instance of Ledger running in the background and running multiple +sessions with multiple reports per session. +

+
+
--abbrev-len INT + +
+

Set the minimum length an account can be abbreviated to if it doesn’t +fit inside the account-width. If INT is zero, then the +account name will be truncated on the right. If INT is greater +than account-width then the account will be truncated on the +left, with no shortening of the account names in order to fit into the +desired width. +

+
+
--account STR + +
+

Prepend STR to all accounts reported. That is, the option +‘--account Personal’ would tack ‘Personal:’ to the beginning +of every account reported in a balance report or register report. +

+
+
--account-width INT + +
+

Set the width of the account column in the register report +to INT characters. +

+
+
--actual + +
+
-L + +
+

Report only real transactions, ignoring all automated or virtual +transactions. +

+
+
--add-budget + +
+

Show only unbudgeted postings. +

+
+
--amount EXPR + +
+
-t EXPR + +
+

Apply the given value expression to the posting amount (see Value Expressions). Using --amount EXPR you can apply an +arbitrary transformation to the postings. +

+
+
--amount-data + +
+
-j + +
+

On a register report print only the date and amount of postings. +Useful for graphing and spreadsheet applications. +

+
+
--amount-width INT + +
+

Set the width in characters of the amount column in the +register report. +

+
+
--anon + +
+

Anonymize registry output, mostly for sending in bug reports. +

+
+
--auto-match + +
+

When generating a ledger transaction from a CSV file using the +convert command, automatically match an account from the +Ledger journal. +

+
+
--aux-date + +
+
--effective + +
+

Show auxiliary dates for all calculations (see Effective Dates). +

+
+
--average + +
+
-A + +
+

Print average values over the number of transactions instead of +running totals. +

+
+
--balance-format FORMAT_STRING + +
+

Specify the format to use for the balance report (see Format Strings). The default is: +

+
+
"%(justify(scrub(display_total), 20, -1, true, color))"
+"  %(!options.flat ? depth_spacer : \"\")"
+"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
+"%$1\n%/"
+"--------------------\n"
+
+ +
+
--base + +
+

Reduce convertible commodities down the bottom of the conversion, e.g. +display time in seconds. This also applies to custom commodity +conversions (see Commodity equivalences). +

+
+
--basis + +
+
-B + +
+
--cost + +
+

Report the cost basis on all posting. +

+
+
--begin DATE + +
+

Specify the start DATE of all calculations. Transactions before +that date will be ignored. +

+
+
--bold-if VEXPR + +
+

Print the entire line in bold if the given value expression is true +(see Value Expressions). +

+
+
$ ledger reg Expenses --begin Dec --bold-if "amount>100"
+
+ +

list all transactions since the beginning of December and print in +bold any posting greater than $100. +

+
+
--budget + +
+

Only display budgeted items. In a register report this +displays transactions in the budget, in a balance report this displays +accounts in the budget (see Budgeting and Forecasting). +

+
+
--budget-format FORMAT_STRING + +
+

Specify the format to use for the budget report (see Format Strings). The default is: +

+
+
"%(justify(scrub(get_at(display_total, 0)), 12, -1, true, color))"
+" %(justify(-scrub(get_at(display_total, 1)), 12, "
+"           12 + 1 + 12, true, color))"
+" %(justify(scrub(get_at(display_total, 1) + "
+"                 get_at(display_total, 0)), 12, "
+"           12 + 1 + 12 + 1 + 12, true, color))"
+" %(ansify_if("
+"   justify((get_at(display_total, 1) ? "
+"            (100% * quantity(scrub(get_at(display_total, 0)))) / "
+"             -quantity(scrub(get_at(display_total, 1))) : 0), "
+"           5, -1, true, false),"
+"   magenta if (color and get_at(display_total, 1) and "
+"               (abs(quantity(scrub(get_at(display_total, 0))) / "
+"                    quantity(scrub(get_at(display_total, 1)))) >= 1))))"
+"  %(!options.flat ? depth_spacer : \"\")"
+"%-(ansify_if(partial_account(options.flat), blue if color))\n"
+"%/%$1 %$2 %$3 %$4\n%/"
+"%(prepend_width ? \" \" * int(prepend_width) : \"\")"
+"------------ ------------ ------------ -----\n"
+
+ +
+
--by-payee + +
+
-P + +
+

Group the register report by payee. +

+
+
--cleared + +
+
-C + +
+

Consider only transactions that have been cleared for display and +calculation. +

+
+
--cleared-format FORMAT_STRING + +
+

Specify the format to use for the cleared report (see Format Strings). The default is: +

+
+
"%(justify(scrub(get_at(total_expr, 0)), 16, 16 + prepend_width, "
+" true, color))  %(justify(scrub(get_at(total_expr, 1)), 18, "
+" 36 + prepend_width, true, color))"
+"    %(latest_cleared ? format_date(latest_cleared) : \"         \")"
+"    %(!options.flat ? depth_spacer : \"\")"
+"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
+"%$1  %$2    %$3\n%/"
+"%(prepend_width ? \" \" * prepend_width : \"\")"
+"----------------    ----------------    ---------\n"
+
+ +
+
--collapse + +
+
-n + +
+

By default ledger prints all accounts in an account tree. With +--collapse it prints only the top level account specified. +

+
+
--collapse-if-zero + +
+

Collapse the account display only if it has a zero balance. +

+
+
--color + +
+
--ansi + +
+

Use color if the terminal supports it. +

+
+
--columns INT + +
+

Specify the width of the register report in characters. +

+
+
--count + +
+

Direct ledger to report the number of items when appended to the +commodities, accounts or payees command. +

+
+
--csv-format FORMAT_STRING + +
+

Specify the format to use for the csv report (see Format Strings). The default is: +

+
+
"%(quoted(date)),"
+"%(quoted(code)),"
+"%(quoted(payee)),"
+"%(quoted(display_account)),"
+"%(quoted(commodity(scrub(display_amount)))),"
+"%(quoted(quantity(scrub(display_amount)))),"
+"%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\"))),"
+"%(quoted(join(note | xact.note)))\n"
+
+ +
+
--current + +
+

Shorthand for ‘--limit "date <= today"’. +

+
+
--daily + +
+
-D + +
+

Shorthand for ‘--period "daily"’. +

+
+
--date EXPR + +
+

Transform the date of the transaction using EXPR. +

+
+
--date-format DATE_FORMAT + +
+
-y DATE_FORMAT + +
+

Specify the format ledger should use to read and print dates +(see Date and Time Format Codes). +

+
+
--date-width INT + +
+

Specify the width, in characters, of the date column in the +register report. +

+
+
--datetime-format DATETIME_FORMAT + +
+

Specify the format ledger should use to print datetimes. +

+
+
--dc + +
+

Display register or balance in debit/credit format If you use +--dc with either the register (reg) or +balance (bal) commands, you will now get extra columns. +The register goes from this: +

+
+
12-Mar-10 Employer           Assets:Cash                $100        $100
+                             Income:Employer           $-100           0
+12-Mar-10 KFC                Expenses:Food               $20         $20
+                             Assets:Cash                $-20           0
+12-Mar-10 KFC - Rebate       Assets:Cash                  $5          $5
+                             Expenses:Food               $-5           0
+12-Mar-10 KFC - Food & Reb.. Expenses:Food               $20         $20
+                             Expenses:Food               $-5         $15
+                             Assets:Cash                $-15           0
+
+ +

To this: +

+
+
12-Mar-10 Employer       Assets:Cash        $100           0        $100
+                         In:Employer           0        $100           0
+12-Mar-10 KFC            Expens:Food         $20           0         $20
+                         Assets:Cash           0         $20           0
+12-Mar-10 KFC - Rebate   Assets:Cash          $5           0          $5
+                         Expens:Food           0          $5           0
+12-Mar-10 KFC - Food &.. Expens:Food         $20           0         $20
+                         Expens:Food           0          $5         $15
+                         Assets:Cash           0         $15           0
+
+ +

Where the first column is debits, the second is credits, and the third +is the running total. Only the running total may contain negative +values. +

+

For the balance report without --dc: +

+
+
                 $70  Assets:Cash
+                 $30  Expenses:Food
+               $-100  Income:Employer
+--------------------
+                   0
+
+ +

And with --dc it becomes this: +

+
+
          $105            $35            $70  Assets:Cash
+           $40            $10            $30  Expenses:Food
+             0           $100          $-100  Income:Employer
+--------------------------------------------
+          $145           $145              0
+
+ +
+
--depth INT + +
+

Limit the depth of the account tree. In a balance report, for example, +a ‘--depth 2’ statement will print balances only for accounts with +two levels, i.e. ‘Expenses:Entertainment’ but not +‘Expenses:Entertainment:Dining’. This is a display predicate, which +means it only affects display, not the total calculations. +

+
+
--deviation + +
+

Report each posting’s deviation from the average. It is only meaningful +in the register and prices reports. +

+
+
--display EXPR + +
+

Display only lines that satisfy the expression EXPR. +

+
+
--display-amount EXPR + +
+

Apply a transformation to the displayed amount. This happens +after calculations occur. +

+
+
--display-total EXPR + +
+

Apply a transformation to the displayed total. This happens after +calculations occur. +

+
+
--dow + +
+
--days-of-week + +
+

Group transactions by the day of the week. +

+
+
$ ledger reg Expenses --dow --collapse
+
+ +

Will print all Expenses totaled for each day of the week. +

+
+
--empty + +
+
-E + +
+

Include empty accounts in the report and in average calculations. +

+
+
--end DATE + +
+

Specify the end DATE for a transaction to be considered in the +report. All transactions on or after this date are ignored. +

+
+
--equity + +
+

Related to the equity command (see The equity command). Gives current account balances in the form of a register +report. +

+
+
--exact + +
+

Report beginning and ending of periods by the date of the first and last +posting occurring in that period. +

+
+
--exchange COMMODITY + +
+
-X COMMODITY + +
+

Display values in terms of the given COMMODITY. The latest +available price is used. The syntax +-X COMMODITY1:COMMODITY2 displays values in COMMODITY1 +in terms of COMMODITY2 using the latest available price, but +will not automatically covert any other commodities to +COMMODITY2. Multiple -X arguments may be used on a +single command-line (as in +-X COMMODITY1:COMMODITY2 -X COMMODITY3:COMMODITY2), +which is particularly useful for situations where many prices are +available for reporting in terms of COMMODITY2, but only a few +should be displayed that way. +

+
+
--flat + +
+

Force the full names of accounts to be used in the balance report. The +balance report will not use an indented tree. +

+
+
--force-color + +
+

Output TTY color codes even if the TTY doesn’t support them. Useful +for TTYs that don’t advertise their capabilities correctly. +

+
+
--force-pager + +
+

Force Ledger to paginate its output. +

+
+
--forecast-while VEXPR + +
+
--forecast VEXPR + +
+

Continue forecasting while VEXPR is true. +

+
+
--forecast-years INT + +
+

Forecast at most INT years into the future. +

+
+
--format FORMAT_STRING + +
+
-F FORMAT_STRING + +
+

Use the given format string to print output. +

+
+
--gain + +
+
-G + +
+
--change + +
+

Report on gains using the latest available prices. +

+
+
--generated + +
+

Include auto-generated postings (such as those from automated +transactions) in the report, in cases where you normally wouldn’t want +them. +

+
+
--group-by EXPR + +
+

Group transactions together in the register report. +EXPR can be anything, although most common would be payee +or commodity. The tags() function is also useful here. +

+
+
--group-title-format FORMAT_STRING + +
+

Set the format for the headers that separates the report sections of +a grouped report. Only has an effect with a --group-by +EXPR register report. +

+
+
$ ledger reg Expenses --group-by "payee" --group-title-format "------------------------ %-20(value) ---------------------\n"
+
+
+
------------------------ 7-Eleven             ---------------------
+2011/08/13 7-Eleven              Expenses:Auto:Misc          $ 5.80       $ 5.80
+
+------------------------ AAA Dues             ---------------------
+2011/06/02 AAA Dues              Expenses:Auto:Misc        $ 215.00     $ 215.00
+
+------------------------ ABC Towing and Wrecking ---------------------
+2011/03/17 ABC Towing and Wrec..  Expenses:Auto:Hobbies      $ 48.20      $ 48.20
+...
+
+ +
+
--head INT + +
+
--first INT + +
+

Print the first INT entries. Opposite of --tail +INT. +

+
+
--historical + +
+
-H + +
+

Value commodities at the time of their acquisition. +

+
+
--immediate + +
+

Evaluate calculations immediately rather than lazily. +

+
+
--inject + +
+

Use Expected amounts in calculations. In case you know +what amount a transaction should be, but the actual transaction has the +wrong value you can use metadata to specify the expected amount: +

+
+
2012-03-12  Paycheck
+    Income  $-990;  Expected:: $-1000.00
+    Checking
+
+ +

Then using the command ledger reg --inject=Expected Income would +treat the transaction as if the “Expected Value” was actual. +

+
+
--invert + +
+

Change the sign of all reported values. +

+
+
--limit EXPR + +
+
-l EXPR + +
+

Only transactions that satisfy EXPR are considered in +calculations and for display. +

+
+
--lot-dates + +
+

Report the date on which each commodity in a balance report was +purchased. +

+
+
--lot-notes + +
+
--lot-tags + +
+

Report the tag attached to each commodity in a balance report. +

+
+
--lot-prices + +
+

Report the price at which each commodity in a balance report was +purchased. +

+
+
--lots + +
+

Report the date and price at which each commodity was purchased in +a balance report. +

+
+
--lots-actual + +
+

Preserve the uniqueness of commodities so they aren’t merged during +reporting without printing the lot annotations. +

+
+
--market + +
+
-V + +
+

Use the latest market value for all commodities. +

+
+
--meta TAG + +
+

In the register report, prepend the transaction with the value of the +given TAG. +

+
+
--meta-width INT + +
+

Specify the width of the Meta column used for the --meta +TAG options. +

+
+
--monthly + +
+
-M + +
+

Synonym for ‘--period "monthly"’. +

+
+
--no-aliases + +
+

Aliases are completely ignored. +

+
+
--no-color + +
+

Suppress any color TTY output. +

+
+
--no-pager + +
+

Direct output to stdout, avoiding pager program. +

+
+
--no-revalued + +
+

Stop Ledger from showing <Revalued> postings. This option is useful +in combination with the --exchange or --market option. +

+
+
--no-rounding + +
+

Don’t output ‘<Adjustment>’ postings. Note that this will cause the +running total to often not add up! Its main use is for +--amount-data (-j) and --total-data (-J) reports. +

+
+
--no-titles + +
+

Suppress the output of group titles. +

+
+
--no-total + +
+

Suppress printing the final total line in a balance report. +

+
+
--now DATE + +
+

Define the current date in case you want to calculate in the past or +future using --current. +

+
+
--only FIXME + +
+

This is a postings predicate that applies after certain transforms have +been executed, such as periodic gathering. +

+
+
--output FILE + +
+

Redirect the output of ledger to the file defined in FILE. +

+
+
--pager FILE + +
+

Direct output to FILE pager program. +

+
+
--payee VEXPR + +
+

Sets a value expression for formatting the payee. In the +register report this prevents the second entry from having +a date and payee for each transaction. +

+
+
--payee-width INT + +
+

Set the number of columns dedicated to the payee in the register +report to INT. +

+
+
--pending + +
+

Use only postings that are marked pending. +

+
+
--percent + +
+
-% + +
+

Calculate the percentage value of each account in balance reports. +Only works for accounts that have a single commodity. +

+
+
--period PERIOD_EXPRESSION + +
+

Define a period expression that sets the time period during which +transactions are to be accounted. For a register report only +the transactions that satisfy the period expression with be displayed. +For a balance report only those transactions will be accounted +in the final balances. +

+
+
--pivot TAG + +
+

Produce a balance pivot report around the given TAG. For +example, if you have multiple cars and track each fuel purchase in +‘Expenses:Auto:Fuel’ and tag each fuel purchase with a tag +identifying which car the purchase was for ‘; Car: Prius’, then the +command: +

+
+
$ ledger bal Fuel --pivot "Car" --period "this year"
+
+
+
           $ 3491.26  Car
+           $ 1084.22    M3:Expenses:Auto:Fuel
+            $ 149.65    MG V11:Expenses:Auto:Fuel
+            $ 621.89    Prius:Expenses:Auto:Fuel
+           $ 1635.50    Sienna:Expenses:Auto:Fuel
+             $ 42.69  Expenses:Auto:Fuel
+--------------------
+           $ 3533.95
+
+ +

See Metadata values. +

+
+
--plot-amount-format FORMAT_STRING + +
+

Define the output format for an amount data plot. See Visualizing with Gnuplot. +

+
+
--plot-total-format FORMAT_STRING + +
+

Define the output format for a total data plot. See Visualizing with Gnuplot. +

+
+
--prepend-format FORMAT_STRING + +
+

Prepend STR to every line of the output. +

+
+
--prepend-width INT + +
+

Reserve INT spaces at the beginning of each line of the output. +

+
+
--price + +
+
-I + +
+

Use the price of the commodity purchase for performing calculations. +

+
+
--pricedb-format FORMAT_STRING + +
+

Set the format expected for the historical price file. +

+
+
--prices-format FORMAT_STRING + +
+

Set the format for the prices report. +

+
+
--primary-date + +
+
--actual-dates + +
+

Show primary dates for all calculations (see Effective Dates). +

+
+
--quantity + +
+
-O + +
+

Report commodity totals (this is the default). +

+
+
--quarterly + +
+

Synonym for ‘--period "quarterly"’. +

+
+
--raw + +
+

In the print report, show transactions using the exact same +syntax as specified by the user in their data file. Don’t do any +massaging or interpreting. This can be useful for minor cleanups, like +just aligning amounts. +

+
+
--real + +
+
-R + +
+

Account using only real transactions ignoring virtual and automatic +transactions. +

+
+
--register-format FORMAT_STRING + +
+

Define the output format for the register report. +

+
+
--related + +
+

In a register report show the related account. This is the +other side of the transaction. +

+
+
--related-all + +
+

Show all postings in a transaction, similar to --related but +show both sides of each transaction. +

+
+
--revalued + +
+

Report discrepancy in values for manual reports by inserting <Revalued> +postings. This is implied when using the --exchange or +--market option. +

+
+
--revalued-only + +
+

Show only <Revalued> postings. +

+
+
--revalued-total FIXME + +
+

Display the sum of the revalued postings as the running total, which serves +to show unrealized capital in a gain/losses report. +

+
+
--rich-data + +
+
--detail + +
+

When generating a ledger transaction from a CSV file using the +convert command, add CSV, Imported, and UUID metadata. +

+
+
--seed INT + +
+

Set the random seed to INT for the generate command. +Used as part of development testing. +

+
+
--sort VEXPR + +
+
-S VEXPR + +
+

Sort the register report based on the value expression given +to sort. +

+
+
--sort-all FIXME + +
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+
+
--sort-xacts VEXPR + +
+
--period-sort VEXPR + +
+

Sort the postings within transactions using the given value expression. +

+
+
--start-of-week INT + +
+

Tell ledger to use a particular day of the week to start its “weekly” +summary. ‘--start-of-week=1’ specifies Monday as the start of the +week. +

+
+
--subtotal + +
+
-s + +
+

Cause all transactions in a register report to be collapsed +into a single, subtotaled transaction. +

+
+
--tail INT + +
+
--last INT + +
+

Report only the last INT entries. Only useful in +a register report. +

+
+
--time-report + +
+

Add two columns to the balance report to show the earliest checkin and +checkout times for timelog entries. +

+
+
--total VEXPR + +
+
-T VEXPR + +
+

Define a value expression used to calculate the total in reports. +

+
+
--total-data + +
+
-J + +
+

Show only dates and totals to format the output for plots. +

+
+
--total-width INT + +
+

Set the width of the total field in the register report. +

+
+
--truncate CODE + +
+

Indicates how truncation should happen when the contents of columns +exceed their width. Valid arguments are ‘leading’, ‘middle’, +and ‘trailing’. The default is smarter than any of these three, +as it considers sub-names within the account name (that style is +called “abbreviate”). +

+
+
--unbudgeted + +
+

Show only unbudgeted postings. +

+
+
--uncleared + +
+
-U + +
+

Use only uncleared transactions in calculations and reports. +

+
+
--unrealized + +
+

Show generated unrealized gain and loss accounts in the balance +report. +

+
+
--unrealized-gains STR + +
+

Allow the user to specify what account name should be used for +unrealized gains. Defaults to ‘"Equity:Unrealized Gains"’. +Often set in one’s ~/.ledgerrc file to change the default. +

+
+
--unrealized-losses STR + +
+

Allow the user to specify what account name should be used for +unrealized losses. Defaults to ‘"Equity:Unrealized Losses"’. +Often set in one’s ~/.ledgerrc file to change the default. +

+
+
--unround + +
+

Perform all calculations without rounding and display results to full +precision. +

+
+
--values + +
+

Shows the values used by each tag when used in combination with the +tags command. +

+
+
--weekly + +
+
-W + +
+

Synonym for ‘--period "weekly"’. +

+
+
--wide + +
+

Let the register report use 132 columns instead of 80 (the default). +Identical to ‘--columns "132"’. +

+
+
--yearly + +
+
-Y + +
+

Synonym for ‘--period "yearly"’. +

+
+
+ +
+ + + +

8.3.4 Basic options

+ +

These are the most basic command options. Most likely, the user will +want to set them using environment variables (see Environment variables), instead of using actual command-line options: +

+
+
--help + +
+
-h + +
+

Display the man page for ledger. +

+
+
--version + +
+

Print the current version of ledger and exits. This is useful for +sending bug reports, to let the author know which version of ledger you +are using. +

+
+
--file FILE + +
+
-f FILE + +
+

Read FILE as a ledger file. FILE can be ‘-’ which is +a synonym for ‘/dev/stdin’. This command may be used multiple +times. Typically, the environment variable LEDGER_FILE is set, +rather than using this command-line option. +

+
+
--output FILE + +
+
-o FILE + +
+

Redirect output from any command to FILE. By default, all output +goes to standard output. +

+
+
--init-file FILE + +
+
-i FILE + +
+

Causes FILE to be read by ledger before any other ledger file. +This file may not contain any postings, but it may contain option +settings. To specify options in the init file, use the same syntax as +on the command-line, but put each option on its own line. Here is an +example init file: +

+
+
--price-db ~/finance/.pricedb
+--wide
+; ~/.ledgerrc ends here
+
+ +

Option settings on the command-line or in the environment always take +precedence over settings in the init file. +

+
+
--account STR + +
+
-a STR + +
+

Specify the default account which QIF file postings are assumed to +relate to. +

+
+
+ +
+ + + +

8.3.5 Report filtering

+ +

These options change which postings affect the outcome of a +report, in ways other than just using regular expressions: +

+
+
--current + +
+
-c + +
+

Display only transactions occurring on or before the current date. +

+
+
--begin DATE + +
+
-b DATE + +
+

Constrain the report to transactions on or after DATE. Only +transactions after that date will be calculated, which means that the +running total in the balance report will always start at zero with the +first matching transaction. (Note: This is different from using +--display EXPR to constrain what is displayed). +

+
+
--end DATE + +
+
-e DATE + +
+

Constrain the report so that transactions on or after DATE are +not considered. +

+
+
--period PERIOD_EXPRESSION + +
+
-p PERIOD_EXPRESSION + +
+

Set the reporting period to STR. This will subtotal all matching +transactions within each period separately, making it easy to see +weekly, monthly, quarterly, etc., posting totals. A period string can +even specify the beginning and end of the report range, using simple +terms like ‘last June’ or ‘next month’. For more details on +period expressions, see Period Expressions. +

+
+
--period-sort VEXPR + +
+

Sort the postings within each reporting period using the value +expression EXPR. This is most often useful when reporting +monthly expenses, in order to view the highest expense categories at +the top of each month: +

+
+
$ ledger -M --period-sort total reg ^Expenses
+
+ +
+
--cleared + +
+
-C + +
+

Display only postings whose transaction has been marked “cleared” +(by placing an asterisk to the right of the date). +

+
+
--uncleared + +
+
-U + +
+

Display only postings whose transaction has not been marked “cleared” +(i.e., if there is no asterisk to the right of the date). +

+
+
--real + +
+
-R + +
+

Display only real postings, not virtual. (A virtual posting is +indicated by surrounding the account name with parentheses or brackets; +see Virtual postings for more information). +

+
+
--actual + +
+
-L + +
+

Display only actual postings, and not those created by automated +transactions. +

+
+
--related + +
+
-r + +
+

Display postings that are related to whichever postings would +otherwise have matched the filtering criteria. In the register +report, this shows where money went to, or the account it came from. +In the balance report, it shows all the accounts affected by +transactions having a related posting. For example, if a file had +this transaction: +

+
+
2004/03/20 Safeway
+    Expenses:Food                       $65.00
+    Expenses:Cash                       $20.00
+    Assets:Checking                    $-85.00
+
+ +

And the register command was: +

+
+
$ ledger -f example.dat -r register food
+
+ +

The following would be printed, showing the postings related to the +posting that matched: +

+
+
04-Mar-20 Safeway               Expenses:Cash                $20.00       $20.00
+                                Assets:Checking             $-85.00      $-65.00
+
+ +
+
--budget + +
+

Useful for displaying how close your postings meet your budget. +--add-budget also shows unbudgeted postings, while +--unbudgeted shows only those. --forecast VEXPR +is a related option that projects your budget into the future, showing +how it will affect future balances. See Budgeting and Forecasting. +

+
+
--limit EXPR + +
+
-l EXPR + +
+

Limit which postings take part in the calculations of a report. +

+
+
--amount EXPR + +
+
-t EXPR + +
+

Change the value expression used to calculate the “value” column in +the register report, the amount used to calculate account +totals in the balance report, and the values printed in the +equity report. See Value Expressions. +

+
+
--total VEXPR + +
+
-T VEXPR + +
+

Set the value expression used for the “totals” column in the +register and balance reports. +

+
+
+ + + + + + + +
+ + + +

8.3.6 Output customization

+ +

These options affect only the output, but not which postings are +used to create it: +

+
+
--collapse + +
+
-n + +
+

Cause transactions in a register report with multiple +postings to be collapsed into a single, subtotaled transaction. +

+
+
--subtotal + +
+
-s + +
+

Cause all transactions in a register report to be collapsed +into a single, subtotaled transaction. +

+
+
--by-payee + +
+
-P + +
+

Report subtotals by payee. +

+
+
--empty + +
+
-E + +
+

Include even empty accounts in the balance report. +

+
+
--weekly + +
+
-W + +
+

Report posting totals by the week. The week begins on whichever day of +the week begins the month containing that posting. To set a specific +begin date, use a period string, such as ‘weekly from DATE’. +

+
+
--monthly + +
+
-M + +
+

Report posting totals by month. +

+
+
--yearly + +
+
-Y + +
+

Report posting totals by year. For more complex periods, use +--period. +

+
+
--period PERIOD_EXPRESSION + +
+

Option described above. +

+
+
--dow + +
+

Report posting totals for each day of the week. This is an easy way +to see if weekend spending is more than on weekdays. +

+
+
--sort VEXPR + +
+
-S VEXPR + +
+

Sort a report by comparing the values determined using the value +expression VEXPR. For example, using ‘-S "-abs(total)"’ in +the balance report will sort account balances from greatest to +least, using the absolute value of the total. For more on how to use +value expressions, see Value Expressions. +

+
+
--pivot TAG + +
+

Produce a pivot table around the TAG provided. This requires +meta data using valued tags. +

+
+
--wide + +
+
-w + +
+

Cause the default register report to assume 132 columns +instead of 80. +

+
+
--head INT + +
+

Cause only the first INT transactions to be printed. This is +different from using the command-line utility head, which would +limit to the first INT postings. --tail INT outputs +only the last INT transactions. Both options may be used +simultaneously. If a negative amount is given, it will invert the +meaning of the flag (instead of the first five transactions being +printed, for example, it would print all but the first five). +

+
+
--pager FILE + +
+

Tell Ledger to pass its output to the given FILE pager program; +very useful when the output is especially long. This behavior can be +made the default by setting the LEDGER_PAGER environment variable. +

+
+
--no-pager + +
+

Tell Ledger to not pass its output to a pager program; useful +when a pager is set by default. +

+
+
--average + +
+
-A + +
+

Report the average posting value. +

+
+
--deviation + +
+
-D + +
+

Report each posting’s deviation from the average. It is only meaningful +in the register and prices reports. +

+
+
--percent + +
+
-% + +
+

Show account subtotals in the balance report as percentages of +the parent account. +

+ +
+
--amount-data + +
+
-j + +
+

Change the register report so that it prints nothing but the +date and the value column, and the latter without commodities. This is +only meaningful if the report uses a single commodity. This data can +then be fed to other programs, which could plot the date, analyze it, +etc. +

+
+
--total-data + +
+
-J + +
+

Change the register report so that it prints nothing but the +date and total columns, without commodities. +

+
+
--display EXPR + +
+
-d EXPR + +
+

Limit which postings or accounts are actually displayed in a report. +They might still be calculated, and be part of the running total of a +register report, for example, but they will not be displayed. This is +useful for seeing last month’s checking postings, against a running +balance which includes all posting values: +

+
+
$ ledger -d "d>=[last month]" reg checking
+
+ +

The output from this command is very different from the following, +whose running total includes only postings from the last month +onward: +

+
+
$ ledger -p "last month" reg checking
+
+ +

Which is more useful depends on what you’re looking to know: the total +amount for the reporting range (using --period +PERIOD_EXPRESSION (-p)), or simply a display restricted to the +reporting range (using --display EXPR (-d)). +

+
+
--date-format DATE_FORMAT + +
+
-y DATE_FORMAT + +
+

Change the basic date format used by reports. The default uses a date +like ‘2004/08/01’, which represents the default date format of +%Y/%m/%d. To change the way dates are printed in general, the +easiest way is to put --date-format DATE_FORMAT in the +Ledger initialization file ~/.ledgerrc (or the file referred to +by LEDGER_INIT). +

+
+
--format FORMAT_STRING + +
+
-F FORMAT_STRING + +
+

Set the reporting format for whatever report ledger is about to make. +See Format Strings. There are also specific format commands for +each report type: +

+
+
--balance-format FORMAT_STRING + +
+

Define the output format for the balance report. The default +(defined in report.h is: +

+
+
"%(ansify_if(
+        justify(scrub(display_total), 20,
+                20 + int(prepend_width), true, color),
+                  bold if should_bold))
+        %(!options.flat ? depth_spacer : \"\")
+      %-(ansify_if(
+         ansify_if(partial_account(options.flat), blue if color),
+                   bold if should_bold))\n%/
+      %$1\n%/
+      %(prepend_width ? \" \" * int(prepend_width) : \"\")
+      --------------------\n"
+
+ +
+
--cleared-format FORMAT_STRING + +
+

Define the format for the cleared report. The default is: +

+
+
"%(justify(scrub(get_at(display_total, 0)), 16, 16 + int(prepend_width),
+       true, color))  %(justify(scrub(get_at(display_total, 1)), 18,
+       36 + int(prepend_width), true, color))
+          %(latest_cleared ? format_date(latest_cleared) : \"         \")
+          %(!options.flat ? depth_spacer : \"\")
+      %-(ansify_if(partial_account(options.flat), blue if color))\n%/
+      %$1  %$2    %$3\n%/
+      %(prepend_width ? \" \" * int(prepend_width) : \"\")
+      ----------------    ----------------    ---------\n"
+
+ +
+
--register-format FORMAT_STRING + +
+

Define the output format for the register report. The default +(defined in report.h is: +

+
+
"%(ansify_if(
+        ansify_if(justify(format_date(date), int(date_width)),
+                  green if color and date > today),
+                  bold if should_bold))
+       %(ansify_if(
+         ansify_if(justify(truncated(payee, int(payee_width)), int(payee_width)),
+                   bold if color and !cleared and actual),
+                   bold if should_bold))
+       %(ansify_if(
+         ansify_if(justify(truncated(display_account, int(account_width),
+                                     int(abbrev_len)), int(account_width)),
+                   blue if color),
+                   bold if should_bold))
+       %(ansify_if(
+         justify(scrub(display_amount), int(amount_width),
+                 3 + int(meta_width) + int(date_width) + int(payee_width)
+                   + int(account_width) + int(amount_width) + int(prepend_width),
+                 true, color),
+                 bold if should_bold))
+       %(ansify_if(
+         justify(scrub(display_total), int(total_width),
+                 4 + int(meta_width) + int(date_width) + int(payee_width)
+                   + int(account_width) + int(amount_width) + int(total_width)
+                   + int(prepend_width), true, color),
+                 bold if should_bold))\n%/
+      %(justify(\" \", int(date_width)))
+       %(ansify_if(
+         justify(truncated(has_tag(\"Payee\") ? payee : \" \",
+                           int(payee_width)), int(payee_width)),
+                   bold if should_bold))
+       %$3 %$4 %$5\n"
+
+ +
+
--csv-format FORMAT_STRING + +
+

Set the format for csv reports. The default is: +

+
+
"%(quoted(date)),
+ %(quoted(code)),
+ %(quoted(payee)),
+ %(quoted(display_account)),
+ %(quoted(commodity(scrub(display_amount)))),
+ %(quoted(quantity(scrub(display_amount)))),
+ %(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\"))),
+ %(quoted(join(note | xact.note)))\n"
+
+ +
+
--plot-amount-format FORMAT_STRING + +
+

Set the format for amount plots, using the --amount-data (-j) +option. The default is: +

+
+
"%(format_date(date, \"%Y-%m-%d\")) %(quantity(scrub(display_amount)))\n"
+
+ +
+
--plot-total-format FORMAT_STRING + +
+

Set the format for total plots, using the --total-data (-J) +option. The default is: +

+
+
"%(format_date(date, \"%Y-%m-%d\")) %(quantity(scrub(display_total)))\n"
+
+ +
+
--pricedb-format FORMAT_STRING + +
+

Set the format expected for the historical price file. The default is: +

+
+
"P %(datetime) %(display_account) %(scrub(display_amount))\n"
+
+ +
+
--prices-format FORMAT_STRING + +
+

Set the format for the prices report. The default is: +

+
+
"%(date) %-8(display_account) %(justify(scrub(display_amount), 12,
+           2 + 9 + 8 + 12, true, color))\n"
+
+ +
+
+ +
+ + + +

8.3.7 Commodity reporting

+ +

These options affect how commodity values are displayed: +

+
+
--price-db FILE + +
+

Set the file that is used for recording downloaded commodity prices. +It is always read on startup, to determine historical prices. Other +settings can be placed in this file manually, to prevent downloading +quotes for a specific commodity, for example. This is done by adding a +line like the following: +

+
+
; Don't download quotes for the dollar, or timelog values
+N $
+N h
+
+ +

Note: Ledger NEVER writes output to files. You are responsible for +updating the price-db file. The best way is to have your price +download script maintain this file. +

+

The format of the file can be changed by telling ledger to use the +--pricedb-format FORMAT_STRING you define. +

+
+
--price-exp INT + +
+
--leeway INT + +
+
-Z INT + +
+

Set the expected freshness of price quotes, in INT minutes. That +is, if the last known quote for any commodity is older than this value, +and if --download is being used, then the Internet will be +consulted again for a newer price. Otherwise, the old price is still +considered to be fresh enough. +

+
+
--download + +
+
-Q + +
+

Cause quotes to be automagically downloaded, as needed, by running +a script named getquote and expecting that script to return +a value understood by ledger. A sample implementation of +a getquote script, implemented in Perl, is provided in the +distribution. Downloaded quote price are then appended to the price +database, usually specified using the environment variable +LEDGER_PRICE_DB. +

+
+
+ +

There are several different ways that ledger can report the totals it +displays. The most flexible way to adjust them is by using value +expressions, and the --amount EXPR (-t) and +--total VEXPR (-T) options. However, there are also +several “default” reports, which will satisfy most users’ basic +reporting needs: +

+
+
--quantity + +
+
-O + +
+

Report commodity totals (this is the default). +

+
+
--basis + +
+
-B + +
+

Report the cost basis for all postings. +

+
+
--market + +
+
-V + +
+

Use the last known value for commodities to calculate final values. +

+
+
--gain + +
+
-G + +
+

Report the net gain/loss for all commodities in the report that have +a price history. +

+
+
+ +

Often you will be more interested in the value of your entire holdings, +in your preferred currency. It might be nice to know you hold 10,000 +shares of PENNY, but you are more interested in whether or not that is +worth $1000.00 or $10,000.00. However, the current day value of a +commodity can mean different things to different people, depending on +the accounts involved, the commodities, the nature of the transactions, +etc. +

+ + + + +

When you specify --market (-V), or --exchange +COMMODITY (-X), you are requesting that some or all of the +commodities be valuated as of today (or whatever --now +DATE is set to). But what does such a valuation mean? This +meaning is governed by the presence of a VALUE meta-data property, +whose content is an expression used to compute that value. +

+

If no VALUE property is specified, each posting is assumed to have +a default, as if you’d specified a global, automated transaction as +follows: +

+
+
= expr true
+    ; VALUE:: market(amount, date, exchange)
+
+ +

This definition emulates the present day behavior of --market +(-V) and --exchange COMMODITY (-X) (in the case of +‘-X’, the requested commodity is passed via the string +‘exchange’ above). +

+ +

One thing many people have wanted to do is to fixate the valuation of +old European currencies in terms of the Euro after a certain date: +

+
+
= expr commodity == "DM"
+    ; VALUE:: date < [Jun 2008] ? market(amount, date, exchange) : 1.44 EUR
+
+ +

This says: If --now DATE is some old date, use market +prices as they were at that time; but if --now DATE is +past June 2008, use a fixed price for converting Deutsch Mark to Euro. +

+

Or how about never re-valuating commodities used in Expenses, since +they cannot have a different future value: +

+
+
= /^Expenses:/
+    ; VALUE:: market(amount, post.date, exchange)
+
+ +

This says the future valuation is the same as the valuation at the time +of posting. post.date equals the posting’s date, while just ’date’ is +the value of --now DATE (defaults to today). +

+

Or how about valuating miles based on a reimbursement rate during a +specific time period: +

+
+
= expr commodity == "miles" and date >= [2007] and date < [2008]
+    ; VALUE:: market($1.05, date, exchange)
+
+ +

In this case, miles driven in 2007 will always be valuated at $1.05 +each. If you use ‘-X EUR’ to expressly request all amounts in +Euro, Ledger shall convert $1.05 to Euro by whatever means are +appropriate for dollars. +

+

Note that you can have a valuation expression specific to a particular +posting or transaction, by overriding these general defaults using +specific meta-data: +

+
+
2010-12-26 Example
+    Expenses:Food                $20
+    ; Just to be silly, always valuate *these* $20 as 30 DM, no matter what
+    ; the user asks for with -V or -X
+    ; VALUE:: 30 DM
+    Assets:Cash
+
+ +

This example demonstrates that your value expression should be as +symbolic as possible, using terms like ’amount’ and ’date’, rather than +specific amounts and dates. Also, you should pass the amount along to +the function ’market’ so it can be further revalued if the user has +asked for a specific currency. +

+

Or, if it better suits your accounting, you can be less symbolic, +which allows you to report most everything in EUR if you use ‘-X +EUR’, except for certain accounts or postings which should always be +valuated in another currency. For example: +

+
+
= /^Assets:Brokerage:CAD$/
+    ; Always report the value of commodities in this account in
+    ; terms of present day dollars, despite what was asked for
+    ; on the command-line VALUE:: market(amount, date, ‘$’)
+
+ + + + + + + + + + +

Ledger presently has no way of handling such things as FIFO and LIFO. +

+

If you specify an unadorned commodity name, like AAPL, it will balance +against itself. If --lots are not being displayed, then it +will appear to balance against any lot of AAPL. +

+ + +

If you specify an adorned commodity, like AAPL {$10.00}, it will also +balance against itself, and against any AAPL if --lots is not +specified. But if you do specify --lot-prices, for example, +then it will balance against that specific price for AAPL. +

+

Normally when you use --exchange COMMODITY (-X) to +request that amounts be reported in a specific commodity, Ledger uses +these values: +

+
    +
  • Register Report +For the register report, use the value of that commodity on +the date of the posting being reported, with a ‘<Revalued>’ posting +added at the end if today’s value is different from the value of the +last posting. + +
  • Balance Report +For the balance report, use the value of that commodity as of +today. + +
+ +

You can now specify --historical (-H) to ask that all +valuations for any amount be done relative to the date that amount was +encountered. +

+

You can also now use --exchange COMMODITY (-X) (and +--historical (-H)) in conjunction with --basis (-B) +and --price (-I), to see valuation reports of just your basis +costs or lot prices. +

+

Finally, sometimes, you may seek to only report one (or some subset) of +the commodities in terms of another commodity. In this situation, you +can use the syntax --exchange COMMODITY1:COMMODITY2 +to request that ledger always display COMMODITY1 in terms of +COMMODITY2, but you want no other commodities to be automatically +displayed in terms of COMMODITY2 without additional +--exchange options. For example, if you wanted to report EUR +and BTC in terms of USD, but report all other commodities without +conversion to USD, you could use: --exchange EUR:USD --exchange +BTC:USD. +

+
+ + + +

8.3.8 Environment variables

+ +

Every option to ledger may be set using an environment variable if the +option has a long name. For example setting the environment variable +‘LEDGER_DATE_FORMAT="%d.%m.%Y"’ will have the same effect as specifying +‘--date-format '%d.%m.%Y'’ on the command-line. Options on the +command-line always take precedence over environment variable settings, however. +

+

Note that you may also permanently specify option values by placing +option settings in the file ~/.ledgerrc one option per line, for example: +

+
+
--pager /bin/cat
+
+ +
+ + + +

8.4 Period Expressions

+ +

A period expression indicates a span of time, or a reporting interval, +or both. Ledger’s end dates are always exclusive, imagine the date is +followed by 00:00:00 time. They are instants in time not entire days. +The full syntax is: +

+
+
[INTERVAL] [BEGIN] [END]
+
+ +

The optional INTERVAL part may be any one of: +

+
+
every day
+every week
+every month
+every quarter
+every year
+every N days     # N is any integer
+every N weeks
+every N months
+every N quarters
+every N years
+daily
+weekly
+biweekly
+monthly
+bimonthly
+quarterly
+yearly
+
+ +

After the interval, a begin time, end time, both or neither may be +specified. As for the begin time, it can be either of: +

+
+
from <SPEC>
+since <SPEC>
+
+ +

The end time can be either of: +

+
+
to <SPEC>
+until <SPEC>
+
+ +

Where SPEC can be any of: +

+
+
2004
+2004/10
+2004/10/1
+10/1
+october
+oct
+this week  # or day, month, quarter, year
+next week
+last week
+
+ +

The beginning and ending can be given at the same time, if it spans a +single period. In that case, just use SPEC by itself. In that +case, the period ‘oct’, for example, will cover all the days in +October. The possible forms are: +

+
+
<SPEC>
+in <SPEC>
+
+ +

Here are a few examples of period expressions: +

+
+
monthly
+monthly in 2004
+weekly from oct
+weekly from last month
+from sep to oct
+from 10/1 to 10/5
+monthly until 2005
+from apr
+until nov
+last oct
+weekly last august
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

9 Budgeting and Forecasting

+ + + + + + +
+ + + +

9.1 Budgeting

+ + + + + +

Keeping a budget allows you to pay closer attention to your income and +expenses, by reporting how far your actual financial activity is from +your expectations. +

+

To start keeping a budget, put some periodic transactions +(see Periodic Transactions) at the top of your ledger file. A +periodic transaction is almost identical to a regular transaction, except +that it begins with a tilde and has a period expression in place of a +payee. For example: +

+
+
~ Monthly
+    Expenses:Rent               $500.00
+    Expenses:Food               $450.00
+    Expenses:Auto:Gas           $120.00
+    Expenses:Insurance          $150.00
+    Expenses:Phone              $125.00
+    Expenses:Utilities          $100.00
+    Expenses:Movies              $50.00
+    Expenses                    $200.00  ; all other expenses
+    Assets
+
+~ Yearly
+    Expenses:Auto:Repair        $500.00
+    Assets
+
+ +

These two periodic transactions give the usual monthly expenses, as well +as one typical yearly expense. For help on finding out what your +average monthly expenses are for any category, use a command like: +

+
+
$ ledger -p "this year" --monthly --average register ^expenses
+
+ +

The reported totals are the current year’s average for each account. +

+

Once these periodic transactions are defined, creating a budget report is +as easy as adding --budget to the command-line. For example, +a typical monthly expense report would be: +

+
+
$ ledger --monthly register ^expenses
+
+ +

To see the same report balanced against your budget, use: +

+
+
$ ledger --budget --monthly register ^expenses
+
+ +

A budget report includes only those accounts that appear in the budget. +To see all expenses balanced against the budget, use +--add-budget. You can even see only the unbudgeted expenses +using --unbudgeted: +

+
+
$ ledger --unbudgeted --monthly register ^expenses
+
+ +

You can also use these flags with the balance command. +

+
+ + + +

9.2 Forecasting

+ + +

Sometimes it’s useful to know what your finances will look like in the +future, such as determining when an account will reach zero. Ledger +makes this easy to do, using the same periodic transactions as are used +for budgeting. An example forecast report can be generated with: +

+
+
$ ledger --file drewr3.dat --forecast "T>{\$-500.00}" register ^assets ^liabilities
+
+ +

This report continues outputting postings until the running total +is greater than $-500.00. A final posting is always shown, to +inform you what the total afterwards would be. +

+

Forecasting can also be used with the balance report, +but by date only, and not against the running total: +

+
+
$ ledger --forecast "d<[2010]" bal ^assets ^liabilities
+
+ +
+ + + +

10 Time Keeping

+ + +

Ledger directly supports “timelog” entries, which have this form: +

+
+
i 2013/03/28 22:13:00 ACCOUNT[  PAYEE]
+o 2013/03/29 03:39:00
+
+ +

This records a check-in to the given ACCOUNT, and a check-out. You can +be checked-in to multiple accounts at a time, if you wish, and they can +span multiple days (use --day-break to break them up in the +report). The number of seconds between check-in and check-out is +accumulated as time to that ACCOUNT. If the checkout uses a capital +‘O’, the transaction is marked “cleared”. You can use an +optional PAYEE for whatever meaning you like. +

+

Now, there are a few ways to generate this information. You can use +the timeclock.el package, which is part of Emacs. Or you can +write a simple script in whichever language you prefer to emit similar +information. Or you can use Org mode’s time-clocking abilities and +the org2tc script developed by John Wiegley. +

+

These timelog entries can appear in a separate file, or directly in +your main ledger file. The initial ‘i’ and ‘o’ characters +count as Ledger “directives”, and are accepted anywhere that +ordinary transactions are valid. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

11 Value Expressions

+ + + +

Ledger uses value expressions to make calculations for many different +purposes: +

+
    +
  1. The values displayed in reports. + +
  2. For predicates (where truth is anything non-zero), to determine which +postings are calculated (option --limit EXPR (-l)) or +displayed (option --display EXPR (-d)). + +
  3. For sorting criteria, to yield the sort key. + +
  4. In the matching criteria used by automated postings. + +
+ +

Value expressions support most simple math and logic operators, in +addition to a set of functions and variables. +

+ + + +

Display predicates are also very handy with register reports, to +constrain which transactions are printed. For example, the following +command shows only transactions from the beginning of the current month, +while still calculating the running balance based on all transactions: +

+
+
$ ledger -d "d>[this month]" register checking
+
+ +

The advantage of this command’s complexity is that it prints the +running total in terms of all transactions in the register. The +following, simpler command is similar, but totals only the displayed +postings: +

+
+
$ ledger -b "this month" register checking
+
+ + + + + + + + +
+ +
+

+Next: , Previous: , Up: Value Expressions   [Contents][Index]

+
+ +

11.1 Variables

+ + + +

Below are the one letter variables available in any value expression. +For the register and print commands, these variables +relate to individual postings, and sometimes the account affected by a +posting. For the balance command, these variables relate to +accounts, often with a subtle difference in meaning. The use of each +variable for both is specified. +

+
+
t
+

This maps to whatever the user specified with --amount +EXPR (-t). In a register report, --amount +EXPR (-t) changes the value column; in a balance +report, it has no meaning by default. If --amount EXPR +(-t) was not specified, the current report style’s value expression is +used. +

+
+
T
+

This maps to whatever the user specified with --total +VEXPR (-T). In a register report, --total VEXPR +(-T) changes the totals column; in a balance report, this is the value +given for each account. If --total VEXPR (-T) was not +specified, the current report style’s value expression is used. +

+
+
m
+

This is always the present moment/date. +

+
+
+ + + + + + +
+ +
+

+Next: , Previous: , Up: Variables   [Contents][Index]

+
+ +

11.1.1 Posting/account details

+ +
+
d
+

A posting’s date, as the number of seconds past the epoch. This +is always “today” for an account. +

+
+
a
+

The posting’s amount; the balance of an account, without +considering children. +

+
+
b
+

The cost of a posting; the cost of an account, without its +children. +

+
+
v
+

The market value of a posting or an account, without its children. +

+
+
g
+

The net gain (market value minus cost basis), for a posting or an +account, without its children. It is the same as ‘v-b’. +

+
+
l
+

The depth (“level”) of an account. If an account has one parent, +its depth is one. +

+
+
n
+

The index of a posting, or the count of postings affecting an +account. +

+
+
X
+

1’ if a posting’s transaction has been cleared, ‘0’ otherwise. +

+
+
R
+

1’ if a posting is not virtual, ‘0’ otherwise. +

+
+
Z
+

1’ if a posting is not automated, ‘0’ otherwise. +

+
+
+ +
+ +
+

+Previous: , Up: Variables   [Contents][Index]

+
+ +

11.1.2 Calculated totals

+ +
+
O
+

The total of all postings seen so far, or the total of an account +and all its children. +

+
+
N
+

The total count of postings affecting an account and all its +children. +

+
+
+ +
+ +
+

+Next: , Previous: , Up: Value Expressions   [Contents][Index]

+
+ +

11.2 Functions

+ +

The available one letter functions are: +

+
+
-
+

Negates the argument. +

+
+
U
+

The absolute (unsigned) value of the argument. +

+
+
S
+

Strips the commodity from the argument. +

+
+
P
+

The present market value of the argument. The syntax ‘P(x,d)’ is +supported, which yields the market value at time ‘d’. If no date +is given, then the current moment is used. +

+
+
+ +
+ + + +

11.3 Operators

+ +

The operators, in order of precedence, are: +

+
    +
  1. * / +
  2. + - +
  3. ! < > = +
  4. & | ?: +
+ + + + + + +
+ +
+

+Next: , Previous: , Up: Operators   [Contents][Index]

+
+ +

11.3.1 Unary Operators

+ +

not (!) +neg +

+
+ +
+

+Previous: , Up: Operators   [Contents][Index]

+
+ +

11.3.2 Binary Operators

+ +

== +< +<= +> +>= +and +or ++ +- +* +/ +QUERY +COLON +CONS +SEQ +DEFINE +LOOKUP +LAMBDA +CALL +MATCH +

+
+ +
+

+Previous: , Up: Value Expressions   [Contents][Index]

+
+ +

11.4 Complex expressions

+ +

More complicated expressions are possible using: +

+
+
"amount == COMMODITY AMOUNT"
+

The amount can be any kind of amount supported by ledger, +with or without a commodity. Use this for decimal values. +

+
+
/REGEX/
+
account =~ /REGEX/
+

A regular expression that matches against an account’s full name. If +a posting, this will match against the account affected by the +posting. +

+
+
@/REGEX/
+
expr payee =~ /REGEX/
+

A regular expression that matches against a transaction’s payee name. +

+
+
%/REGEX/
+
expr has_tag(/REGEX/)
+
expr has_tag('TAG')
+

A regular expression (REGEX) or string (TAG) that checks for the tags of +a transaction. +

+
+
tag(REGEX) =~ /REGEX/
+

A regular expression that matches a transaction’s tags against its values. +

+
+
expr date =~ /REGEX/
+

Useful for specifying a date in plain terms. For example, you could say +‘expr date =~ /2014/’. +

+
+
expr comment =~ /REGEX/
+

A regular expression that matches against a posting’s comment +field. This searches only a posting’s field, not the transaction’s note +or comment field. For example, ledger reg "expr" "comment =~ +/landline/" will match: +

+
+
2014/1/29  Phone bill
+    Assets:Checking                           $50.00
+    Expenses:Phone                           $-50.00  ; landline bill
+
+ +

but will not match: +

+
+
2014/1/29  Phone bill  ; landline bill
+    ; landline bill
+    Assets:Checking                           $50.00
+    Expenses:Phone                           $-50.00
+
+ +

To match the latter, use ‘ledger reg "expr" "note =~ /landline/"’ +instead. +

+
+
expr note =~ /REGEX/
+

A regular expression that matches against a transaction’s note field. +This searches all comments in the transaction, including comments on +individual postings. Thus, ‘ledger reg "expr" "note =~ /landline/"’ +will match both all the three examples below: +

+
+
2014/1/29  Phone bill
+    Assets:Checking                           $50.00
+    Expenses:Phone                           $-50.00  ; landline bill
+
+ +
+
2014/1/29  Phone bill  ; landline bill
+    Assets:Checking                           $50.00
+    Expenses:Phone                           $-50.00
+
+ +
+
2014/1/29  Phone bill
+    ; landline bill
+    Assets:Checking                           $50.00
+    Expenses:Phone                           $-50.00
+
+ +
+
(EXPR)
+

A sub-expression is nested in parenthesis. This can be useful passing +more complicated arguments to functions, or for overriding the natural +precedence order of operators. +

+
+
expr base =~ /REGEX/
+

A regular expression that matches against an account’s base name. If +a posting, this will match against the account affected by the +posting. +

+
+
expr code =~ /REGEX/
+

A regular expression that matches against the transaction code (the +text that occurs between parentheses before the payee). +

+
+
expr any(KEYWORD =~ /REGEX/)
+

The any keyword is used to specify that at least one posting of +the transaction must match the expression in brackets. For example, +‘ledger -f d reg expr "any(account =~ /Assets:/)"’ can be used to +display all transactions which involve at least one ‘Assets:’ +account. +

+
+
expr all(KEYWORD =~ /REGEX/)
+

The all keyword is used to specify that all postings of a +transactions must match the expression in brackets. For example, +‘ledger -f d reg expr "all(account =~ /Assets:/)"’ can be used to +display all transactions where all accounts are ‘Assets:’. +

+
+
+ +

The query command can be used to see how Ledger interprets +your query. This can be useful if you are not getting the results you +expect (see Pre-Commands). +

+ + + + +
+ + + +

11.4.1 Miscellaneous

+ +

The following Ledger journal data (saved as expr.dat) is used to explain the behaviour of the +functions and variables below: +

+
2015/01/16 * (C0D3) Payee
+  Assets:Cash                 ¤ -123,45
+    ; Payee: PiggyBank
+  Expenses:Office Supplies
+
+ +
+
Function: abs value
+
Function: U value
+

Return the absolute value of the given value, e.g. amount. +

+
$ ledger -f expr.dat --format "%(account) %(abs(amount))\n" reg assets
+
+
+
Assets:Cash ¤ 123,45
+
+
+ +
+
Function: amount_expr
+

Return the calculated amount of the posting according to the --amount +option. +

+ +
+
Function: ansify_if value color bool
+

Render the given expression as a string, applying the proper ANSI escape +codes to display it in the given color if bool is true. It +typically checks the value of the option --color. Since ANSI escape +codes include non-printable character sequences, such as escape ^[ +the following example may not appear as the final result on the command-line. +

+
$ ledger -f expr.dat --format "%(ansify_if(account, blue, options.color))\n" reg
+
+
+
Assets:Cash
+Expenses:Office Supplies
+
+
+ +
+
Function: ceiling value
+

Return the next integer of value toward +infinity. +

+
$ ledger -f expr.dat --format "%(account) %(ceiling(amount))\n" reg
+
+
+
Assets:Cash ¤ -123,00
+Expenses:Office Supplies ¤ 124,00
+
+
+ +
+
Variable: code
+

Return the transaction code, the string between the parenthesis after the date. +

+
$ ledger -f expr.dat --format "%(account) %(code)\n" reg assets
+
+
+
Assets:Cash C0D3
+
+
+ +
+
Variable: commodity
+

Return the commodity of the posting amount. +

+
+
$ ledger -f expr.dat --format "%(account) %(commodity)\n" reg
+
+
+
Assets:Cash ¤
+Expenses:Office Supplies ¤
+
+ +
+
Variable: date
+

Return the date of the posting. +

+
+
$ ledger -f expr.dat --format "%(date) %(account)\n" reg assets
+
+
+
2015/01/16 Assets:Cash
+
+ +
+
Variable: display_amount
+
Variable: t
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ +
+
Variable: display_total
+
Variable: T
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ +
+
Function: floor value
+

Return the next integer of value toward -infinity. +

+
$ ledger -f expr.dat --format "%(account) %(floor(amount))\n" reg
+
+
+
Assets:Cash ¤ -124,00
+Expenses:Office Supplies ¤ 123,00
+
+
+ +
+
Function: format string
+

Evaluate string as format just like the --format option. +

+ +
+
Function: format_date date format
+

Return the date as a string using format. See +strftime (3) for format string details. +

+
$ ledger -f expr.dat --format "%(format_date(date, '%A, %B %d. %Y'))\n" reg assets
+
+
+
Friday, January 16. 2015
+
+
+ +
+
Function: format_datetime datetime format
+

Return the datetime as a string using format. Refer to +strftime (3) for format string details. +

+ +
+
Function: get_at sequence index
+

Return the value in sequence at index. The first element is index 0. +For internal use only. +

+ +
+
Function: is_seq value
+

Return true if value is a sequence. For internal use only. +

+ +
+
Function: join value
+

Replace all newlines in value with \n. +

+ +
+
Function: justify value first_width latter_width right_justify colorize
+

Right or left justify the string representing value. The width +of the field in the first line is given by first_width. For +subsequent lines the width is given by latter_width. If +latter_width=-1, then first_width is used for all lines. +If right_justify=true then the field is right justified within +the width of the field. If it is false, then the field is left +justified and padded to the full width of the field. If +colorize is true, then ledger will honor color settings. +

+
$ ledger -f expr.dat --format "»%(justify(account, 30, 30, true))«\n" reg
+
+
+
»                   Assets:Cash«
+»      Expenses:Office Supplies«
+
+
+ +
+
Function: market value datetime
+
Function: P
+

Return the price of value at datetime. Note that datetime +must be surrounded by brackets in order to be parsed correctly, +e.g. [2012/03/23]. +

+ +
+
Function: nail_down
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ +
+
Variable: now
+
Variable: d
+
Variable: m
+

Return the current datetime. +

+ +
+
Variable: options
+

A variable that allows access to the values of the given command-line options +using the long option names, e.g. to see whether --daily or -D +was given use option.daily. +

+
$ ledger -f expr.dat -X $ -D --format "%(options.daily) %(options.exchange)\n" reg assets
+
+
+
true $
+
+
+ +
+
Function: percent value_a value_b
+

Return the percentage of value_a in relation to value_b (used as 100%) +

+
$ ledger -f expr.dat --format "%(percent(amount, 200))\n" reg
+
+
+
-61.73%
+61.73%
+
+
+ +
+
Function: print value
+

Print value to stdout. For internal use only. +

+ +
+
Function: quantity value
+

Return the quantity of value for values that have a per-unit cost. +

+ +
+
Function: quoted expression
+

Surround expression with double-quotes. If expression contains a double-quote, it will be escaped with a backslash. +

+
$ ledger -f expr.dat --format "%(quoted(account)) %(quoted(amount))\n" reg
+
+
+
"Assets:Cash" "¤ -123,45"
+"Expenses:Office Supplies" "¤ 123,45"
+
+
+ + +
+
Function: round
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ +
+
Function: rounded
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ +
+
Function: roundto value n
+

Return value rounded to n digits. Does not affect formatting. +

+
$ ledger -f expr.dat --format "%(account) %(roundto(amount, 1))\n" reg
+
+
+
Assets:Cash ¤ -123,40
+Expenses:Office Supplies ¤ 123,50
+
+
+ +
+
Function: scrub value
+

Clean value using various transformations such as round, stripping +value annotations, and more. +

+ +
+
Function: should_bold
+

Return true if expression given to --bold-if evaluates to true. For internal use only. +

+ +
+
Function: strip value
+
Function: S
+

Strip value annotation from value. +

+ +
+
Function: to_amount value
+

Convert value to an amount. For internal use only. +

+ +
+
Function: to_balance value
+

Convert value to a balance. For internal use only. +

+ +
+
Function: to_boolean value
+

Convert value to a boolean. For internal use only. +

+ +
+
Function: to_date value
+

Convert value to a date. For internal use only. +

+ +
+
Function: to_datetime value
+

Convert value to a datetime. For internal use only. +

+ +
+
Function: to_int value
+
Function: int value
+

Return the integer value for value. +

+
$ ledger -f expr.dat --format "%(1 + to_int('1'))\n%(2,5 + int(2,5))\n" reg assets
+
+
+
2
+4.5
+
+
+ +
+
Function: to_mask value
+

Convert value to a mask. For internal use only. +

+ +
+
Function: to_sequence value
+

Convert value to a sequence. For internal use only. +

+ +
+
Function: to_string value
+
Function: str value
+

Convert value to a character string. +

+ +
+
Variable: today
+

Return today’s date. +

+
+
$ ledger -f expr.dat --now 2015/01/01 --format "%(today)\n" reg assets
+
+
+
2015/01/01
+
+ +
+
Function: top_amount
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ +
+
Function: total_expr
+

Return the calculated total of the posting according to the --total +option. +

+ +
+
Function: trim value
+

Trim leading and trailing whitespace from value. +

+
$ ledger -f expr.dat --format "»%(trim(' 	Trimmed	 '))«\n" reg assets
+
+
+
»Trimmed«
+
+
+ +
+
Function: truncatedstring total_len account_len
+

Truncate string to total_len ensuring that each account is at least +account_len long. +

+ +
+
Function: unround
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ +
+
Function: unrounded
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ +
+
Function: value_date
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+ + +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

12 Format Strings

+ + + + + + + + + +
+ + + +

12.1 Format String Basics

+ + + + + + + + + + + +

Format strings may be used to change the output format of reports. They +are specified by passing a formatting string to the --format +FORMAT_STRING (-F) option. Within that string, constructs are +allowed which make it possible to display the various parts of an +account or posting in custom ways. +

+

There are several additional flags that allow you to define formats +for specific reports. These are useful to define in your configuration +file and will allow you to run ledger reports from the command-line +without having to enter a new format for each command. +

+
    +
  • --balance-format FORMAT_STRING +
  • --budget-format FORMAT_STRING +
  • --cleared-format FORMAT_STRING +
  • --csv-format FORMAT_STRING +
  • --plot-amount-format FORMAT_STRING +
  • --plot-total-format FORMAT_STRING +
  • --pricedb-format FORMAT_STRING +
  • --prices-format FORMAT_STRING +
  • --register-format FORMAT_STRING +
+ +
+ + + +

12.2 Format String Structure

+ +

Within a format string, a substitution is specified using a percent +‘%’ character. The basic format of all substitutions is: +

+
+
%[-][MIN WIDTH][.MAX WIDTH](VALEXPR)
+
+ +

If the optional minus sign ‘-’ follows the percent character +‘%’, whatever is substituted will be left justified. The default +is right justified. If a minimum width is given next, the substituted +text will be at least that wide, perhaps wider. If a period and +a maximum width is given, the substituted text will never be wider +than this, and will be truncated to fit. Here are some examples: +

+
+
%-20P
+

A transaction’s payee, left justified and padded to 20 characters wide. +

+
+
%20P
+

The same, right justified, at least 20 chars wide. +

+
+
%.20P
+

The same, no more than 20 chars wide. +

+
+
+ +

The expression following the format constraints can be a single letter, +or an expression enclosed in parentheses or brackets. +

+
+ + + +

12.3 Format Expressions

+ + + +

For demonstration purposes the journal data from expr.dat is used. +The allowable expressions are: +

+
+
%
+

Inserts a percent sign. +

+
$ ledger -f expr.dat --format "%%\n" reg assets
+
+
+
%
+
+ +
+
t
+

Inserts the results of the value expression specified by +--amount EXPR (-t). If --amount EXPR (-t) +was not specified, the current report style’s value expression is used. +

+
+
T
+

Inserts the results of the value expression specified by --total +VEXPR (-T). If --total VEXPR (-T) was not +specified, the current report style’s value expression is used. +

+
+
(EXPR)
+

Inserts the amount resulting from the value expression given in +parentheses. To insert five times the total value of an account, for +example, one could say ‘%12(5*O)’. Note: It’s important to put the +five first in that expression, so that the commodity doesn’t get +stripped from the total. +

+
$ ledger -f expr.dat --format "%12(5*O)\n" reg assets
+
+
+
   ¤ -617,25
+
+ +
+
[DATEFMT]
+

Inserts the result of formatting a posting’s date with a date format +string, exactly like those supported by strftime (3). For +example: ‘%[%Y/%m/%d %H:%M:%S]’. +

+
+
S
+

Insert the path name of the file from which the transaction’s data was +read. Only sensible in a register report. +

+
$ ledger -f ~/journal.dat --format "%S\n" reg assets
+
+
+
/home/jwiegley/journal.dat
+
+ +
+
B
+

Inserts the beginning character position of that transaction within the +file. +

+
$ ledger -f expr.dat --format "%B\n" reg assets
+
+
+
26
+
+ +
+
b
+

Inserts the beginning line of that transaction within the file. +

+
$ ledger -f expr.dat --format "%b\n" reg assets
+
+
+
2
+
+ +
+
E
+

Inserts the ending character position of that transaction within the +file. +

+
$ ledger -f expr.dat --format "%E\n" reg assets
+
+
+
90
+
+ +
+
e
+

Inserts the ending line of that transaction within the file. +

+
$ ledger -f expr.dat --format "%e\n" reg assets
+
+
+
3
+
+ +
+
D
+

Returns the date according to the default format. +

+
+
d
+

Returns the date according to the default format. If the transaction +has an effective date, it prints ACTUAL_DATE=EFFECTIVE_DATE. +

+
+
X
+

If a posting has been cleared, this returns a 1, otherwise returns 0. +

+
+
Y
+

This is the same as ‘%X’, except that it only displays a state +character if all of the member postings have the same state. +

+
+
C
+

Inserts the transaction code. This is the value specified between +parentheses on the first line of the transaction. +

+
$ ledger -f expr.dat --format "%C\n" reg assets
+
+
+
(C0D3) 
+
+ +
+
P
+

Inserts the payee related to a posting. +

+
$ ledger -f expr.dat --format "%P\n" reg assets
+
+
+
PiggyBank
+
+ + +
+
A
+

Inserts the full name of an account. +

+
$ ledger -f expr.dat --format "%A\n" reg
+
+
+
Assets:Cash
+Expenses:Office Supplies
+
+ + + +
+
N
+

Inserts the note associated with a posting, if one exists. +

+
$ ledger -f expr.dat --format "%N\n" reg assets
+
+
+
 Payee: PiggyBank
+
+ +
+
/
+

The ‘%/’ construct is special. It separates a format string +between what is printed for the first posting of a transaction, and +what is printed for all subsequent postings. If not used, the +same format string is used for all postings. +

+
$ ledger -f expr.dat --format "%P\n%/%A\n" reg
+
+
+
PiggyBank
+Expenses:Office Supplies
+
+ +
+
+ +
+ + + +

12.4 Balance format

+ + + +

As an example of how flexible the --format FORMAT_STRING +strings can be, the default balance format looks like this (the various +functions are described later): +

+
+
"%(justify(scrub(display_total), 20, -1, true, color))"
+"  %(!options.flat ? depth_spacer : \"\")"
+"%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
+"%$1\n%/"
+"--------------------\n"
+
+ +
+ +
+

+Previous: , Up: Format Strings   [Contents][Index]

+
+ +

12.5 Formatting Functions and Codes

+ + + + + + + + + + + +
+ + + +

12.5.1 Field Widths

+ +

The following codes return the width allocated for the specific fields. +The defaults can be changed using the corresponding command-line +options: +

+
    +
  • date_width +
  • payee_width +
  • account_width +
  • amount_width +
  • total_width +
+ +
+ + + +

12.5.2 Colors

+ +

The character-based formatting ledger can do is limited to the ANSI +terminal character colors and font highlights in a normal TTY session. +

+ + + + + +
redmagentabold
greencyanunderline
yellowwhiteblink
blueblack
+ +
+ + + +

12.5.3 Quantities and Calculations

+ +
+
amount_expr
+
abs
+
commodity
+
display_amount
+
display_total
+
floor
+
get_at
+
is_seq
+
market
+
percent
+
price
+
quantity
+
rounded
+
truncated
+
total_expr
+
top_amount
+
to_boolean
+
to_int
+
to_amount
+
to_balance
+
unrounded
+
+ +
+ + + +

12.5.4 Date Functions

+ + +

The following functions allow you to manipulate and format dates. +

+
+
date
+

Return the date of the current transaction. +

+
+
format_date(date, "FORMAT_STRING")
+

Format the date using the given format string. +

+
+
now
+

Return the current date and time. If the --now DATE +option is defined it will return that value. +

+
+
today
+

Return the current date. If the --now DATE option is +defined it will return that value. +

+
+
to_datetime
+

Convert a string to a date-time value. +

+
+
to_date
+

Convert a string to date value. +

+
+
value_date
+
+ + + + + +
+ + + +

12.5.5 Date and Time Format Codes

+ +

Date and time format are specified as strings of single letter codes +preceded by percent signs. Any separator, or no separator can be +specified. +

+ + + + + + + +
+ + + +

12.5.5.1 Days

+ +

Dates are formed from a combination of day, month and year codes, in +whatever order you prefer: +

+
+
%Y
+

Four digit year. +

+
+
%y
+

Two digit year. +

+
+
%m
+

Two digit month. +

+
+
%d
+

Two digit date. +

+
+
+ +

So "%Y%m%d" yields ‘20111214’ which provides a date that +is simple to sort on. +

+
+ +
+

+Next: , Previous: , Up: Date and Time Format Codes   [Contents][Index]

+
+ +

12.5.5.2 Weekdays

+ +

You can have additional weekday information in your date with ‘%A’ +as +

+
+
%m-%d-%Y %A
+

yields ‘02-10-2010 Wednesday’. +

+
+
%A %m-%d-%Y
+

yields ‘Wednesday 02-10-2010’. +

+
+
+ +

These are options you can select for weekday +

+
+
%a
+

weekday, abbreviated Wed. +

+
+
%A
+

weekday, full Wednesday. +

+
+
%d
+

day of the month (dd), zero padded up to 10. +

+
+
%e
+

day of the month (dd), no leading zero up to 10. +

+
+
%j
+

day of year, zero padded 000–366. +

+
+
%u
+

day of week starting with Monday (1), i.e. mtwtfss 3. +

+
+
%w
+

day of week starting with Sunday (0), i.e. smtwtfs 3. +

+
+
+ +
+ + + +

12.5.5.3 Month

+ +

You can have additional month information in your date with ‘%B’ +as +

+
+
%m-%d-%Y %B
+

yields ‘02-10-2010 February’. +

+
+
%B %m-%d-%Y
+

yields ‘February 02-10-2010’. +

+
+
+ +

These are options you can select for month +

+
+
%m
+

mm’ month as two digits. +

+
+
%b
+

Locale’s abbreviated month, for example ‘02’ might be abbreviated +as ‘Feb’. +

+
+
%B
+

Locale’s full month, variable length, e.g. February. +

+
+
+ +
+ +
+

+Previous: , Up: Date and Time Format Codes   [Contents][Index]

+
+ +

12.5.5.4 Miscellaneous Date Codes

+ +

Additional date format parameters which can be used: +

+
+
%U
+

week number Sunday as first day of week, ranging 01–53. +

+
+
%W
+

week number Monday as first day of week, ranging 01–53. +

+
+
%V
+

week of the year, ranging 01–53. +

+
+
%C
+

century, ranging 00–99. +

+
+
%D
+

yields %m/%d/%y as in ‘02/10/10’. +

+
+
%x
+

locale’s date representation, as ‘02/10/2010’ for the U.S. +

+
+
%F
+

yields %Y-%m-%d as in ‘2010-02-10’. +

+
+
+ +
+ + + +

12.5.6 Text Formatting

+ +

The following format functions allow you limited formatting of text: +

+
+
ansify_if(value, color)
+

Surrounds the string representing value with ANSI codes to give it +color on an TTY display. Has no effect if directed to a file. +

+
+
justify(value, first_width, latter_width, right_justify, colorize)
+

Right or left justify the string representing value. The width +of the field in the first line is given by first_width. For +subsequent lines the width is given by latter_width. If +latter_width=-1, then first_width is use for all lines. +If right_justify=true then the field is right justify within +the width of the field. If it is false, then the field is left +justified and padded to the full width of the field. If +colorize is true, then ledger will honor color settings. +

+
+
join(STR)
+

Replaces line feeds in STR with ‘\n’. +

+
+
quoted(STR)
+

Return STR surrounded by double quotes, ‘"STR"’. +

+
+
strip(value)
+

Values can have numerous annotations, such as effective dates and lot +prices. strip removes these annotations. +

+
+
+ +
+ + + +

12.5.7 Data File Parsing Information

+ +

The following format strings provide locational metadata +regarding the coordinates of entries in the source data file(s) that +generated the posting. +

+
+
filename
+

the name of the ledger data file from whence the posting came, +abbreviated ‘S’. +

+
+
beg_pos
+

character position in filename where entry for posting begins, +abbreviated ‘B’. +

+
+
end_pos
+

character position in filename where entry for posting ends, +abbreviated ‘E’. +

+
+
beg_line
+

line number in filename where entry for posting begins, +abbreviated ‘b’. +

+
+
end_line
+

line number in filename where entry for posting ends, +abbreviated ‘e’. +

+
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

13 Extending with Python

+ +

Python can be used to extend your Ledger experience. But first, +a word must be said about Ledger’s data model, so that other things +make sense later. +

+ + + + + + + + +
+ + + +

13.1 Basic data traversal

+ +

Every interaction with Ledger happens in the context of a Session. +Even if you don’t create a session manually, one is created for you by +the top-level interface functions. The Session is where objects live +like the Commodities that Amounts refer to. +

+

To make a Session useful, you must read a Journal into it, using the +function ‘read_journal‘. This reads Ledger data from the given +file, populates a Journal object within the current Session, and +returns a reference to that Journal object. +

+

Within the Journal live all the Transactions, Postings, and other +objects related to your data. There are also AutomatedTransactions +and PeriodicTransactions, etc. +

+

Here is how you would traverse all the postings in your data file: +

+
+
import ledger
+
+for xact in ledger.read_journal("sample.dat").xacts():
+    for post in xact.posts():
+        print "Transferring %s to/from %s" % (post.amount, post.account)
+
+ +
+ + + +

13.2 Raw versus Cooked

+ +

Ledger data exists in one of two forms: raw and cooked. Raw objects are +what you get from a traversal like the above, and represent exactly what +was seen in the data file. Consider this journal: +

+
+
= true
+    (Assets:Cash)    $100
+
+2012-03-01 KFC
+    Expenses:Food    $100
+    Assets:Credit
+
+ +

In this case, the raw regular transaction in this file is: +

+
+
2012-03-01 KFC
+    Expenses:Food    $100
+    Assets:Credit
+
+ +

While the cooked form is: +

+
+
2012-03-01 KFC
+    Expenses:Food    $100
+    Assets:Credit   $-100
+    (Assets:Cash)    $100
+
+ +

So the easy way to think about raw vs. cooked is that raw is the +unprocessed data, and cooked has had all considerations applied. +

+

When you traverse a Journal by iterating over its transactions, you are +generally looking at raw data. In order to look at cooked data, you +must generate a report of some kind by querying the journal: +

+
+
for post in ledger.read_journal("sample.dat").query("food"):
+    print "Transferring %s to/from %s" % (post.amount, post.account)
+
+ +

The reason why queries iterate over postings instead of transactions is +that queries often return only a “slice” of the transactions they +apply to. You can always get at a matching posting’s transaction by +looking at its xact member: +

+
+
last_xact = None
+for post in ledger.read_journal("sample.dat").query(""):
+    if post.xact != last_xact:
+        for post in post.xact.posts():
+            print "Transferring %s to/from %s" % (post.amount,
+            post.account)
+        last_xact = post.xact
+
+ +

This query ends up reporting every cooked posting in the Journal, but +does it transaction-wise. It relies on the fact that an unsorted report +returns postings in the exact order they were parsed from the journal +file. +

+
+ + + +

13.3 Queries

+ +

The Journal.query() method accepts every argument you can specify on the +command-line, including --options. +

+

Since a query “cooks” the journal it applies to, only one query may be +active for that journal at a given time. Once the query object is gone +(after the for loop), then the data reverts back to its raw state. +

+
+ +
+

+Next: , Previous: , Up: Extending with Python   [Contents][Index]

+
+ +

13.4 Embedded Python

+ +

You can embed Python into your data files using the ’python’ directive: +

+
+
python
+    import os
+    def check_path(path_value):
+        print "%s => %s" % (str(path_value), os.path.isfile(str(path_value)))
+        return os.path.isfile(str(path_value))
+
+tag PATH
+    assert check_path(value)
+
+2012-02-29 KFC
+    ; PATH: somebogusfile.dat
+    Expenses:Food                $20
+    Assets:Cash
+
+ +

Any Python functions you define this way become immediately available as +valexpr functions. +

+
+ + + +

13.5 Amounts

+ +

When numbers come from Ledger, like post.amount, the type of the value +is Amount. It can be used just like an ordinary number, except that +addition and subtraction are restricted to amounts with the same +commodity. If you need to create sums of multiple commodities, use +a Balance. For example: +

+
+
total = Balance()
+for post in ledger.read_journal("sample.dat").query(""):
+    total += post.amount
+print total
+
+ +
+ + + +

14 Ledger for Developers

+ + + + + + + + +
+ + + +

14.1 Internal Design

+ +

Ledger is developed as a tiered set of functionality, where lower tiers +know nothing about the higher tiers. In fact, multiple libraries are +built during the development the process, and link unit tests to these +libraries, so that it is a link error for a lower tier to violate this +modularity. +

+

Those tiers are: +

+
    +
  • Utility code + +

    There’s lots of general utility in Ledger for doing time parsing, using +Boost.Regex, error handling, etc. It’s all done in a way that can be +reused in other projects as needed. +

    +
  • Commoditized Amounts (amount_t, commodity_t and friends) + +

    A numerical abstraction combining multi-precision rational numbers (via +GMP) with commodities. These structures can be manipulated like regular +numbers in either C++ or Python (as Amount objects). +

    +
  • Commodity Pool + +

    Commodities are all owned by a commodity pool, so that future parsing of +amounts can link to the same commodity and established a consistent +price history and record of formatting details. +

    +
  • Balances + +

    Adds the concept of multiple amounts with varying commodities. Supports +simple arithmetic, and multiplication and division with non-commoditized +values. +

    +
  • Price history + +

    Amounts have prices, and these are kept in a data graph which the amount +code itself is only dimly aware of (there’s three points of access so an +amount can query its revalued price on a given date). +

    +
  • Values + +

    Often the higher layers in Ledger don’t care if something is an amount +or a balance, they just want to add stuff to it or print it. For this, +I created a type-erasure class, value_t/Value, into which many things +can be stuffed and then operated on. They can contain amounts, +balances, dates, strings, etc. If you try to apply an operation between +two values that makes no sense (like dividing an amount by a balance), +an error occurs at runtime, rather than at compile-time (as would happen +if you actually tried to divide an amount_t by +a balance_t). +

    +

    This is the core data type for the value expression language. +

    +
  • Value expressions + +

    The next layer up adds functions and operators around the Value concept. +This lets you apply transformations and tests to Values at runtime +without having to bake it into C++. The set of functions available is +defined by each object type in Ledger (posts, accounts, transactions, +etc.), though the core engine knows nothing about these. At its base, +it only knows how to apply operators to values, and how to pass them to +and receive them from functions. +

    +
  • Query expressions + +

    Expressions can be onerous to type at the command-line, so there’s +a shorthand for reporting called “query expressions”. These add no +functionality of their own, but are purely translated from the input +string down to the corresponding value expression, for example the +input string ‘cash’ is translated to ‘(account +=~ /cash/)’. This is a convenience layer. +

    +
  • Format strings + +

    Format strings let you interpolate value expressions into strings, with +the requirement that any interpolated value have a string +representation. Really all this does is calculate the value expression +in the current report context, call the resulting value’s +to_string() method, and stuffs the result into the output string. +It also provides printf-like behavior, such as min/max width, right/left +justification, etc. +

    +
  • Journal items + +

    Next is a base type shared by anything that can appear in a journal: an +item_t. It contains details common to all such parsed entities, like +what file and line it was found on, etc. +

    +
  • Journal posts + +

    The most numerous object found in a Journal, postings are a type of item +that contain an account, an amount, a cost, and metadata. There are +some other complications, like the account can be marked virtual, the +amount could be an expression, etc. +

    +
  • Journal transactions + +

    Postings are owned by transactions, always. This subclass of item_t +knows about the date, the payee, etc. If a date or metadata tag is +requested from a posting and it doesn’t have that information, the +transaction is queried to see if it can provide it. +

    +
  • Journal accounts + +

    Postings are also shared by accounts, though the actual memory is +managed by the transaction. Each account knows all the postings within +it, but contains relatively little information of its own. +

    +
  • The Journal object + +

    Finally, all transactions with their postings, and all accounts, are +owned by a journal_t object. This is the go-to object for +querying and reporting on your data. +

    +
  • Textual journal parser + +

    There is a textual parser, wholly contained in textual.cc, which +knows how to parse text into journal objects, which then get +“finalized” and added to the journal. Finalization is the step that +enforces the double-entry guarantee. +

    +
  • Iterators + +

    Every journal object is “iterable”, and these iterators are defined in +iterators.h and iterators.cc. This iteration logic is kept out of the +basic journal objects themselves for the sake of modularity. +

    +
  • Comparators + +

    Another abstraction isolated to its own layer, this class encapsulating +the comparison of journal objects, based on whatever value expression +the user passed to --sort VEXPR. +

    +
  • Temporaries + +

    Many reports bring pseudo-journal objects into existence, like postings +which report totals in a ‘Total’ account. These objects are +created and managed by a temporaries_t object, which gets used in +many places by the reporting filters. +

    +
  • Option handling + +

    There is an option handling subsystem used by many of the layers further +down. It makes it relatively easy for me to add new options, and to +have those option settings immediately accessible to value expressions. +

    +
  • Session objects + +

    Every journal object is owned by a session, with the session providing +support for that object. In GUI terms, this is the Controller object +for the journal Data object, where every document window would be +a separate session. They are all owned by the global scope. +

    +
  • Report objects + +

    Every time you create any report output, a report object is created to +determine what you want to see. In the Ledger REPL, a new report object +is created every time a command is executed. In CLI mode, only one +report object ever comes into being, as Ledger immediately exits after +displaying the results. +

    +
  • Reporting filters + +

    The way Ledger generates data is this: it asks the session for the +current journal, and then creates an iterator applied to that journal. +The kind of iterator depends on the type of report. +

    +

    This iterator is then walked, and every object yielded from the iterator +is passed to an “item handler”, whose type is directly related to the +type of the iterator. +

    +

    There are many, many item handlers, which can be chained together. Each +one receives an item (post, account, xact, etc.), performs some action +on it, and then passes it down to the next handler in the chain. There +are filters which compute the running totals; that queue and sort all +the input items before playing them back out in a new order; that filter +out items which fail to match a predicate, etc. Almost every reporting +feature in Ledger is related to one or more filters. Looking at +filters.h, there are over 25 of them defined currently. +

    +
  • The filter chain + +

    How filters get wired up, and in what order, is a complex process based +on all the various options specified by the user. This is the job of +the chain logic, found entirely in chain.cc. It took a really +long time to get this logic exactly right, which is why I haven’t +exposed this layer to the Python bridge yet. +

    +
  • Output modules + +

    Although filters are great and all, in the end you want to see stuff. +This is the job of special “leaf” filters called output modules. They +are implemented just like a regular filter, but they don’t have +a “next” filter to pass the data on down to. Instead, they are the +end of the line and must do something with the item that results in the +user seeing something on their screen or in a file. +

    +
  • Select queries + +

    Select queries know a lot about everything, even though they implement +their logic by implementing the user’s query in terms of all the other +features thus presented. Select queries have no functionality of their +own, they are simple a shorthand to provide access to much of Ledger’s +functionality via a cleaner, more consistent syntax. +

    +
  • The Global Scope + +

    There is a master object which owns every other objects, and this is +Ledger’s global scope. It creates the other objects, provides REPL +behavior for the command-line utility, etc. In GUI terms, this is the +Application object. +

    +
  • The Main Driver + +

    This creates the global scope object, performs error reporting, and +handles command-line options which must precede even the creation of the +global scope, such as --debug CODE. +

    +
+ +

And that’s Ledger in a nutshell. All the rest are details, such as +which value expressions each journal item exposes, how many filters +currently exist, which options the report and session scopes define, +etc. +

+
+ + + +

14.2 Journal File Format for Developers

+ +

This chapter offers a complete description of the journal data format, +suitable for implementers in other languages to follow. For users, the +chapter on keeping a journal is less extensive, but more typical of +common usage (see Keeping a Journal). +

+

Data is collected in the form of transactions which occur in one +or more journal files. Each transaction, in turn, is made up of +one or more postings, which describe how amounts flow from +one account to another. Here is an example of the simplest of +journal files: +

+
+
2010/05/31 Just an example
+    Expenses:Some:Account                $100.00
+    Income:Another:Account
+
+ +

In this example, there is a transaction date, a payee, or description of +the transaction, and two postings. The postings show movement of one +hundred dollars from an account within the Income hierarchy, to the +specified expense account. The name and meaning of these accounts is +arbitrary, with no preferences implied, although you will find it useful +to follow standard accounting practices (see Principles of Accounting with Ledger). +

+

Since an amount is missing from the second posting, it is assumed to be +the inverse of the first. This guarantees the cardinal rule of +double-entry accounting: the sum of every transaction must balance to +zero, or it is in error. Whenever Ledger encounters a null +posting in a transaction, it uses it to balance the remainder. +

+

It is also typical, though not enforced, to think of the first posting +as the destination, and the final as the source. Thus, the amount of +the first posting is typically positive. Consider: +

+
+
2010/05/31 An income transaction
+    Assets:Checking       $1,000.00
+    Income:Salary
+
+2010/05/31 An expense transaction
+    Expenses:Dining         $100.00
+    Assets:Checking
+
+ + + + + + + + +
+ + + +

14.2.1 Comments and meta-data

+ +

Comments are generally started using a ‘;’. However, in order to +increase compatibility with other text manipulation programs and methods +three additional comment characters are valid if used at the beginning +of a line: ‘#’, ‘|’, and ‘*’. +

+
+ + + +

14.2.2 Specifying Amounts

+ + +

The heart of a journal is the amounts it records, and this fact is +reflected in the diversity of amount expressions allowed. All of them +are covered here, though it must be said that sometimes, there are +multiple ways to achieve a desired result. +

+

Note: It is important to note that there must be at least two +spaces between the end of the account and the beginning of the amount +(including a commodity designator). +

+ + + + + +
+ + + +

14.2.2.1 Integer Amounts

+ +

In the simplest form, bare decimal numbers are accepted: +

+
+
2010/05/31 An income transaction
+    Assets:Checking        1000.00
+    Income:Salary
+
+ + +

Such amounts may only use an optional period for a decimal point. These +are referred to as integer amounts or uncommoditized +amounts. In most ways they are similar to commoditized amounts, +but for one significant difference: They always display in reports with +full precision. More on this in a moment. For now, a word must +be said about how Ledger stores numbers. +

+

Every number parsed by Ledger is stored internally as an +infinite-precision rational value. Floating-point math is never used, +as it cannot be trusted to maintain precision of values. So, in the +case of ‘1000.00’ above, the internal value is ‘100000/100’. +

+

While rational numbers are great at not losing precision, the question +arises: How should they be displayed? A number like ‘100000/100’ +is no problem, since it represents a clean decimal fraction. But what +about when the number ‘1/1’ is divided by three? How should one +print ‘1/3’, an infinitely repeating decimal? +

+

Ledger gets around this problem by rendering rationals into decimal at +the last possible moment, and only for display. As such, some +rounding must, at times, occur. If this rounding would affect the +calculation of a running total, special accommodation postings are +generated to make you aware it has happened. In practice, it happens +rarely, but even then it does not reflect adjustment of the +internal amount, only the displayed amount. +

+

What has still not been answered is how Ledger rounds values. Should +‘1/3’ be printed as ‘0.33’ or ‘0.33333’? For +commoditized amounts, the number of decimal places is decided by +observing how each commodity is used; but in the case of integer +amounts, an arbitrary factor must be chosen. Initially, this factor +is six. Thus, ‘1/3’ is printed back as ‘0.333333’. +Further, this rounding factor becomes associated with each particular +value, and is carried through mathematical operations. For example, +if that particular number were multiplied by itself, the decimal +precision of the result would be twelve. Addition and subtraction do +not affect precision. +

+

Since each integer amount retains its own display precision, this is +called full precision, as opposed to commoditized amounts, which +always look to their commodity to know what precision they should +round to, and so use commodity precision. +

+
+ + + +

14.2.2.2 Commoditized Amounts

+ +

A commoditized amount is an integer amount which has an +associated commodity. This commodity can appear before or after the +amount, and may or may not be separated from it by a space. Most +characters are allowed in a commodity name, except for the following: +

+
    +
  • Any kind of white-space +
  • Numerical digits +
  • Punctuation: .,;:?! +
  • Mathematical and logical operators: -+*/^&|= +
  • Bracketing characters: <>[](){} +
  • The at symbol: @ +
+ +

And yet, any of these may appear in a commodity name if it is +surrounded by double quotes, for example: +

+
+
100 "EUN+133"
+
+ +

If a quoted commodity is found, it is displayed in quotes as +well, to avoid any confusion as to which part is the amount, and which +part is the commodity. +

+

Another feature of commoditized amounts is that they are reported back +in the same form as parsed. If you specify dollar amounts using +‘$100’, they will print the same; likewise with ‘100 $’ or +‘$100.000’. You may even use decimal commas, such as +‘$100,00’, or thousand-marks, as in ‘$10,000.00’. +

+

These display characteristics become associated with the commodity, +with the result being that all amounts of the same commodity are +reported consistently. Where this is most noticeable is the +display precision, which is determined by the most precise value +seen for a given commodity—in most cases. +

+

Ledger makes a distinction between observed amounts and +unobserved amounts. An observed amount is critiqued by Ledger to +determine how amounts using that commodity should be displayed; +unobserved amounts are significant in their value only—no matter how +they are specified, it does not change how other amounts in that +commodity will be displayed. +

+

An example of this is found in cost expressions, covered next. +

+
+ + + +

14.2.3 Posting costs

+ +

You have seen how to specify either a commoditized or an integer +amount for a posting. But what if the amount you paid for something +was in one commodity, and the amount received was another? There are +two main ways to express this: +

+
+
2010/05/31 Farmer's Market
+    Assets:My Larder           100 apples
+    Assets:Checking                -$20.00
+
+ +

In this example, you have paid twenty dollars for one hundred apples. +The cost to you is twenty cents per apple, and Ledger calculates this +implied cost for you. You can also make the cost explicit using a +cost amount: +

+
+
2010/05/31 Farmer's Market
+    Assets:My Larder           100 apples @ $0.200000
+    Assets:Checking
+
+ +

Here the per-unit cost is given explicitly in the form of a cost +amount; and since cost amounts are unobserved, the use of six +decimal places has no effect on how dollar amounts are displayed in +the final report. You can also specify the total cost: +

+
+
2010/05/31 Farmer's Market
+    Assets:My Larder           100 apples @@ $20
+    Assets:Checking
+
+ +

These three forms have identical meaning. In most cases the first is +preferred, but the second two are necessary when more than two +postings are involved: +

+
+
2010/05/31 Farmer's Market
+    Assets:My Larder           100 apples        @ $0.200000
+    Assets:My Larder           100 pineapples    @ $0.33
+    Assets:My Larder           100 "crab apples" @ $0.04
+    Assets:Checking
+
+ +

Here the implied cost is ‘$57.00’, which is entered into the null +posting automatically so that the transaction balances. +

+
+ + + +

14.2.4 Primary commodities

+ + + +

In every transaction involving more than one commodity, there is +always one which is the primary commodity. This commodity +should be thought of as the exchange commodity, or the commodity used +to buy and sell units of the other commodity. In the fruit examples +above, dollars are the primary commodity. This is decided by Ledger +based on the placement of the commodity in the transaction: +

+
+
2010/05/31 Sample Transaction
+    Expenses               100 secondary
+    Assets                  -50 primary
+
+2010/05/31 Sample Transaction
+    Expenses               100 secondary @ 0.5 primary
+    Assets
+
+2010/05/31 Sample Transaction
+    Expenses               100 secondary @@ 50 primary
+    Assets
+
+ +

The only case where knowledge of primary versus secondary comes into +play is in reports that use the --market (-V) or +--basis (-B) options. With these, only primary commodities are +shown. +

+

If a transaction uses only one commodity, this commodity is also +considered a primary. In fact, when Ledger goes about ensuring that +all transactions balance to zero, it only ever asks this of primary +commodities. +

+
+ + + +

14.3 Developer Commands

+ + + + + + + + + +
+ +
+

+Next: , Previous: , Up: Developer Commands   [Contents][Index]

+
+ +

14.3.1 echo

+ + +

This command simply echoes its argument back to the output. +

+
+ +
+

+Next: , Previous: , Up: Developer Commands   [Contents][Index]

+
+ +

14.3.2 reload

+ + +

Forces ledger to reload any journal files. This function exists to +support external programs controlling a running ledger process and does +nothing for a command-line user. +

+
+ +
+

+Next: , Previous: , Up: Developer Commands   [Contents][Index]

+
+ +

14.3.3 source

+ + +

The source command takes a journal file as an argument and +parses it checking for errors; no other reports are generated, and no +other arguments are necessary. Ledger will return success if no errors +are found. +

+
+ +
+

+Next: , Previous: , Up: Developer Commands   [Contents][Index]

+
+ +

14.3.4 Debug Options

+ +

These options are primarily for Ledger developers, but may be of some +use to a user trying something new. +

+
+
--args-only + +
+

Ignore init files and environment variables for the ledger run. +

+
+
--debug CODE + +
+

If Ledger has been built with debug options this will provide extra +data during the run. The following are the available CODES to +debug: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
account.displaydraft.xactoption.names
account.sortedexpr.calcorg.next_amount
amount.commoditiesexpr.compileorg.next_total
amount.convertexpr.merged.compileparser.error
amount.is_zerofilters.changed_valuepool.commodities
amount.parsefilters.changed_value.roundingpost.assign
amount.pricefilters.collapsepython.init
amount.refsfilters.forecastpython.interp
amount.roundtofilters.intervalquery.mask
amount.truncatefilters.revaluedreport.predicate
amount.unroundformat.abbrevscope.search
annotate.lessformat.exprscope.symbols
archive.journalgenerate.postselect.parse
auto.columnsgenerate.post.stringtextual.include
budget.generatehistory.findtextual.parse
commodity.annotated.striphistory.maptimelog
commodity.annotationsitem.metatimes.epoch
commodity.compareledger.readtimes.interval
commodity.downloadledger.validatetimes.parse
commodity.exchangelookupvalue.sort
commodity.price.findlookup.accountvalue.storage.refcount
commodity.prices.addmask.matchxact.extend
commodity.prices.findmemory.debugxact.extend.cleared
csv.mappingsop.memoryxact.extend.fail
csv.parseoption.argsxact.finalize
+

 

+
+
--trace INT + +
+

Enable tracing. The INT specifies the level of trace desired: +

+ + + + + + + + + + + + + +
LOG_OFF0
LOG_CRIT1
LOG_FATAL2
LOG_ASSERT3
LOG_ERROR4
LOG_VERIFY5
LOG_WARN6
LOG_INFO7
LOG_EXCEPT8
LOG_DEBUG9
LOG_TRACE10
LOG_ALL11
+

 

+
+
--verbose + +
+
-v + +
+

Print detailed information on the execution of Ledger. +

+
+
--verify + +
+

Enable additional assertions during run-time. This causes a significant +slowdown. When combined with --debug CODE ledger will +produce memory trace information. +

+
+
--verify-memory + +
+

Verify that every constructed object is properly destructed. This is for +debugging purposes only. +

+
+
--version + +
+

Print version information and exit. +

+
+
+ +
+ +
+

+Previous: , Up: Developer Commands   [Contents][Index]

+
+ +

14.3.5 Pre-Commands

+ + +

Pre-commands are useful when you aren’t sure how a command or option +will work. The difference between a pre-command and a regular command +is that pre-commands ignore the journal data file completely, nor is +the user’s init file read. +

+
+
eval VEXPR + +
+

Evaluate the given value expression against the model transaction. +

+
+
format FORMAT_STRING + +
+

Print details of how ledger uses the given formatting description and +apply it against a model transaction. +

+
+
generate + +
+

Randomly generates syntactically valid Ledger data from a seed. Used +by the ‘GenerateTests’ harness for development testing. +

+
+
parse VEXPR + +
+
expr VEXPR + +
+

Print details of how ledger uses the given value expression description +and apply it against a model transaction. +

+
+
period PERIOD_EXPRESSION + +
+

Evaluate the given period and report how Ledger interprets it: +

+
+
$ ledger period "this year"  --now 2011-01-01
+
+
+
--- Period expression tokens ---
+TOK_THIS: this
+TOK_YEAR: year
+END_REACHED: <EOF>
+
+--- Before stabilization ---
+   range: in year 2011
+
+--- After stabilization ---
+   range: in year 2011
+   start: 11-Jan-01
+  finish: 12-Jan-01
+
+--- Sample dates in range (max. 20) ---
+ 1: 11-Jan-01
+
+ +
+
query + +
+
args + +
+

Evaluate the given arguments and report how Ledger interprets it against +the following model transaction: +

+
+
$ ledger query "/Book/"
+
+
+
--- Input arguments ---
+("/Book/")
+
+--- Context is first posting of the following transaction ---
+2004/05/27 Book Store
+    ; This note applies to all postings. :SecondTag:
+    Expenses:Books                 20 BOOK @ $10
+    ; Metadata: Some Value
+    ; Typed:: $100 + $200
+    ; :ExampleTag:
+    ; Here follows a note describing the posting.
+    Liabilities:MasterCard        $-200.00
+
+--- Input expression ---
+(account =~ /Book/)
+
+--- Text as parsed ---
+(account =~ /Book/)
+
+--- Expression tree ---
+0x7fd639c0da40    O_MATCH (1)
+0x7fd639c10170     IDENT: account (1)
+0x7fd639c10780     VALUE: /Book/ (1)
+
+--- Compiled tree ---
+0x7fd639c10520    O_MATCH (1)
+0x7fd639c0d6c0     IDENT: account (1)
+0x7fd639c0d680      FUNCTION (1)
+0x7fd639c10780     VALUE: /Book/ (1)
+
+--- Calculated value ---
+true
+
+ +
+
script + +
+

UNDOCUMENTED! Please help by contributing documentation for this feature. +

+
+
template + +
+

Shows the insertion template that the xact sub-command +generates. This is a debugging command. +

+
+
+ +
+ + + +

14.4 Ledger Development Environment

+ + + + + + +
+ + + +

14.4.1 acprep build configuration tool

+ +
+ + + +

14.4.2 Testing Framework

+ +

Ledger source ships with a fairly complete set of tests to verify that +all is well, and no old errors have resurfaced. Tests are run +individually with ctest. All tests can be run using make +check or ninja check depending on which build tool you prefer. +

+

Once built, the ledger executable resides under the build +subdirectory in the source tree. Tests are built and stored in the +test subdirectory for the build. For example, +~/ledger/build/ledger/opt/test. +

+ + + + + +
+ + + +

14.4.2.1 Running Tests

+ +

The complete test suite can be run from the build directory using the +check option for the build tool you use. For example, make +check. The entire test suit lasts around a minute for the optimized +built and many times longer for the debug version. While developing +and debugging, running individual tests can save a great deal of time. +

+

Individual tests can be run from the test subdirectory of the +build location. To execute a single test use ctest -V -R regex, +where the regex matches the name of the test you want to build. +

+

There are nearly 300 tests stored under the test subdirectory +in the main source distribution. They are broken into two broad +categories, baseline and regression. To run the 5FBF2ED8 test, +for example, issue ctest -V -R "5FB". +

+
+ +
+

+Previous: , Up: Testing Framework   [Contents][Index]

+
+ +

14.4.2.2 Writing Tests

+ +

To write a new test first decide to which broad category the test belongs: +baseline or regression. Depending on the category tests are named differently +baseline tests are prefixed with their type, e.g. ‘cmd’ +(see Baseline Test Types for valid types), whereas regressions are either +named after the bug id, e.g. ‘1234.test’ or uuid ‘91416D62.test’. +In case several test files belong to the same bug number the files by appending +_X where ‘X’ is the number of the test, e.g. ‘1234_1.test’, +‘1234_2.test’. +

+

Baseline Test Types: +

+
cmd
+

Ledger commands like register or balance +

+
dir
+

Ledger directives like account or alias +

+
feat
+

Ledger features such as balance assertions in journal file +

+
opt
+

Ledger options such as --period or --format +

+
+ +

A ledger test file contains three sections: +

+
    +
  1. the journal data used for the test, this can be empty in certain +scenarios +
  2. the ledger command-line options used for the test +
  3. the expected output +
+ +

Ledger has a special command directive for tests, everything between +test and end test is treated like a comment, so every +Ledger test is automatically a valid Ledger file. +The test scripts take the remainder of the test line and use +it as command-line arguments for ledger, the text enclosed in test +and end test is expected output, for example: +

+
+
; This is the journal data
+year 2014
+12/24 (C0d3) Santa Claus
+  Assets:Bank         ¤ -150,00
+  Expenses:Presents
+
+; The following line specifies the ledger command-line options for this test and
+; everything between the next line and `end test` specifies the expected output
+test reg --payee=code
+14-Dec-24 C0d3                  Assets:Bank               ¤ -150,00    ¤ -150,00
+14-Dec-24 C0d3                  Expenses:Presents          ¤ 150,00            0
+end test
+
+ +

When it is necessary to test for errors printed to stderr redirect +the test output by adding -> to the test line and match the +expected error text in an __ERROR__ section: +

+
+
2014/01/01 * Acme Corporation
+  Assets:Bank:Checking      ¤  1.000,00
+  [Fund:Vacation]           ¤    300,00
+  [Fund:Studies]            ¤    600,00
+  Income:Salary             ¤ -2.000,00
+
+test reg ->
+__ERROR__
+While parsing file "$FILE", line 5:
+While balancing transaction from "$FILE", lines 1-5:
+> 2014/01/01 * Acme Corporation
+>   Assets:Bank:Checking      ¤  1.000,00
+>   [Fund:Vacation]           ¤    300,00
+>   [Fund:Studies]            ¤    600,00
+>   Income:Salary             ¤ -2.000,00
+Unbalanced remainder is:
+           ¤ -100,00
+Amount to balance against:
+          ¤ 1.900,00
+Error: Transaction does not balance
+end test
+
+ +

A special $FILE variable can be used to match the journal filename +used during the test. +

+

To add new tests to the test suite use the rebuild_cache option for the +build tool you use, for example make rebuild_cache, now the +new tests can be run as documented in Running Tests. +

+
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

15 Major Changes from version 2.6

+ +

The following have been removed from Ledger 3.0: +

+
    +
  • OFX support. + +
  • GnuCash file import. + +
  • The option --performance (-g). + +
  • The balance report now defaults to showing all relevant accounts. This +is the opposite of 2.x. That is, bal in 3.0 does what ‘-s +bal’ did in 2.x. To see 2.6 behavior, use --collapse (-n) +option in 3.0, like ‘bal -n’. The --subtotal (-s) option +no longer has any effect on balance reports. + +
+ +

The following are deprecated in Ledger 3.0: +

+
    +
  • Single character value expressions are deprecated and should be changed +to the new value expressions available in 3.0 + +
  • The following environment variables have been renamed in Ledger 3.0: +
    +
    LEDGER
    +

    is now LEDGER_FILE, +

    +
    LEDGER_INIT
    +

    is now LEDGER_INIT_FILE, +

    +
    PRICE_HIST
    +

    is now LEDGER_PRICE_DB, +

    +
    PRICE_EXP
    +

    is now LEDGER_PRICE_EXP. +

    +
    + +
+ +
+ + + +

Appendix A Example Journal File

+ +

The following journal file is included with the source distribution of +ledger. It is called drewr3.dat and exhibits many ledger +features, include automatic and virtual transactions, +

+
+
; -*- ledger -*-
+
+= /^Income/
+  (Liabilities:Tithe)                    0.12
+
+;~ Monthly
+;  Assets:Checking                     $500.00
+;  Income:Salary
+
+;~ Monthly
+;   Expenses:Food  $100
+;   Assets
+
+2010/12/01 * Checking balance
+  Assets:Checking                   $1,000.00
+  Equity:Opening Balances
+
+2010/12/20 * Organic Co-op
+  Expenses:Food:Groceries             $ 37.50  ; [=2011/01/01]
+  Expenses:Food:Groceries             $ 37.50  ; [=2011/02/01]
+  Expenses:Food:Groceries             $ 37.50  ; [=2011/03/01]
+  Expenses:Food:Groceries             $ 37.50  ; [=2011/04/01]
+  Expenses:Food:Groceries             $ 37.50  ; [=2011/05/01]
+  Expenses:Food:Groceries             $ 37.50  ; [=2011/06/01]
+  Assets:Checking                   $ -225.00
+
+2010/12/28=2011/01/01 Acme Mortgage
+  Liabilities:Mortgage:Principal    $  200.00
+  Expenses:Interest:Mortgage        $  500.00
+  Expenses:Escrow                   $  300.00
+  Assets:Checking                  $ -1000.00
+
+2011/01/02 Grocery Store
+  Expenses:Food:Groceries             $ 65.00
+  Assets:Checking
+
+2011/01/05 Employer
+  Assets:Checking                   $ 2000.00
+  Income:Salary
+
+2011/01/14 Bank
+  ; Regular monthly savings transfer
+  Assets:Savings                     $ 300.00
+  Assets:Checking
+
+2011/01/19 Grocery Store
+  Expenses:Food:Groceries             $ 44.00 ; hastag: not block
+  Assets:Checking
+
+2011/01/25 Bank
+  ; Transfer to cover car purchase
+  Assets:Checking                  $ 5,500.00
+  Assets:Savings
+  ; :nobudget:
+
+apply tag hastag: true
+apply tag nestedtag: true
+2011/01/25 Tom's Used Cars
+  Expenses:Auto                    $ 5,500.00
+  ; :nobudget:
+  Assets:Checking
+
+2011/01/27 Book Store
+  Expenses:Books                       $20.00
+  Liabilities:MasterCard
+end tag
+2011/12/01 Sale
+  Assets:Checking:Business            $ 30.00
+  Income:Sales
+end tag
+
+ +
+ +
+

+Next: , Previous: , Up: Top   [Contents][Index]

+
+ +

Appendix B Miscellaneous Notes

+ +

Various notes from the discussion list that I haven’t incorporated in +to the main body of the documentation. +

+ + + + +
+ + + +

B.1 Cookbook

+ + + + + + +
+ +
+

+Next: , Previous: , Up: Cookbook   [Contents][Index]

+
+ +

B.1.1 Invoking Ledger

+ + +
+
$ ledger --group-by "tag('trip')" bal
+
+
+
$ ledger cleared VWCU NFCU Tithe Misentry
+
+
+
$ ledger register Joint --uncleared
+
+
+
$ ledger register Checking --sort d -d 'd>[2011/04/01]' until 2011/05/25
+
+ +
+ +
+

+Previous: , Up: Cookbook   [Contents][Index]

+
+ +

B.1.2 Ledger Files

+ +
+
= /^Income:Taxable/
+  (Liabilities:Tithe Owed)    -0.1
+= /Noah/
+  (Liabilities:Tithe Owed)    -0.1
+= /Jonah/
+  (Liabilities:Tithe Owed)    -0.1
+= /Tithe/
+  (Liabilities:Tithe Owed)    -1.0
+
+ +
+ + + +

Concepts Index

+ +
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +R +   +S +   +T +   +U +   +W +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

A
account, alias: Command Directives
account, meaning of: Fat-free Accounting
accounts, limiting by: Register Report
accounts, naming: Structuring your Accounts
adorned commodity: Commodity reporting
amounts: Specifying Amounts
assertions: Command Directives
assertions: Command Directives
assets and liabilities: Assets and Liabilities
automated transaction: Transactions and Comments

B
balance report: Balance Report
beginning ledger: Starting up
block comments: Commenting on your Journal
bucket: Command Directives
buying stock: Buying and Selling Stock

C
cleared report: Cleared Report
comma separated variable file reading: The convert command
comments: Transactions and Comments
comments: Command Directives
comments: Command Directives
comments, block: Commenting on your Journal
comments, characters: Commenting on your Journal
commodity: Currency and Commodities
consumable commodity pricing: Fixing Lot Prices
credits and debits: Stating where money goes
csv exporting: Basic Reporting Commands
csv importing: Converting from other formats
csv importing: The convert command
currency: Currency and Commodities
currency symbol display on windows: Using the Windows Command-Line

D
debts are liabilities: Assets and Liabilities
depth_spacer: Asset Allocation
display_total: Asset Allocation
double-entry accounting: Accounting with Ledger

E
effective date of invoice: Effective Dates
effective dates: Effective Dates
Euro conversion: Commodity reporting

F
FIFO/LIFO: Commodity reporting
fixated prices: Command Directives
fixing lot prices: Fixing Lot Prices

G
Gnuplot: Visualizing with Gnuplot

H
historical prices: Transactions and Comments

I
income is negative: Stating where money goes
initial equity: Starting up

J
journals: Start a Journal File

L
LIFO/FIFO: Commodity reporting
limit by payees: Controlling the Accounts and Payees
limiting by accounts: Register Report

M
meaning of account: Fat-free Accounting

N
naming accounts: Structuring your Accounts

O
opening balance: Starting up

P
parent.total: Asset Allocation
Payee metadata tag: Payee metadata tag
periodic transaction: Transactions and Comments
plotting: Visualizing with Gnuplot
posting format details: The Most Basic Entry
postings: Fat-free Accounting
pre-commands: Pre-Commands
pre-declare account: Command Directives
pre-declare commodity: Command Directives
pre-declare tag: Command Directives

R
register report: Register Report
reimbursable expense tracking: Tracking reimbursable expenses

S
spaces in postings: The Most Basic Entry

T
tags: Transactions and Comments
transaction, automated: Transactions and Comments
transaction, periodic: Transactions and Comments
tutorial: Ledger Tutorial

U
uncommoditized amounts: Integer Amounts

W
why is income negative: Stating where money goes
windows cmd.exe: Using the Windows Command-Line

+
Jump to:   A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +R +   +S +   +T +   +U +   +W +   +
+ +
+ +
+

+Previous: , Up: Top   [Contents][Index]

+
+ +

Commands & Options Index

+ +
Jump to:   - +   += +   +~ +   +
+A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +U +   +V +   +X +   +Y +   +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Index Entry  Section

-
-%: Output Customization
-%: Report Options
-%: Output customization
--abbrev-len INT: Report Options
--account STR: The convert command
--account STR: Basic Options
--account STR: Report Options
--account STR: Basic options
--account-width INT: Report Options
--actual: Report Filtering
--actual: Report Options
--actual: Report filtering
--actual-dates: Report Options
--add-budget: Report Filtering
--add-budget: Report Options
--add-budget: Budgeting
--amount EXPR: Report Filtering
--amount EXPR: Report Options
--amount EXPR: Report filtering
--amount EXPR: Variables
--amount EXPR: Format Expressions
--amount-data: Visualizing with Gnuplot
--amount-data: The register command
--amount-data: Output Customization
--amount-data: Report Options
--amount-data: Output customization
--amount-width INT: Report Options
--anon: Output Customization
--anon: Report Options
--ansi: Report Options
--args-only: Global Options
--args-only: Debug Options
--auto-match: The convert command
--auto-match: Report Options
--aux-date: Auxiliary dates
--aux-date: Report Options
--average: prices and pricedb commands
--average: Output Customization
--average: Report Options
--average: Output customization
--balance-format FORMAT_STRING: Output Customization
--balance-format FORMAT_STRING: Report Options
--balance-format FORMAT_STRING: Output customization
--balance-format FORMAT_STRING: Format String Basics
--balance-format FORMAT_STRING: Balance format
--base: Report Options
--basis: Commodity Reporting
--basis: Report Options
--basis: Commodity reporting
--basis: Commodity reporting
--basis: Primary commodities
--begin DATE: Report Filtering
--begin DATE: Report Options
--begin DATE: Report filtering
--bold-if VEXPR: Report Options
--budget: Periodic Transactions
--budget: Report Filtering
--budget: Report Options
--budget: Report filtering
--budget: Budgeting
--budget-format FORMAT_STRING: Report Options
--budget-format FORMAT_STRING: Format String Basics
--by-payee: Working with multiple funds and accounts
--by-payee: Payee metadata tag
--by-payee: Output Customization
--by-payee: Grouping Options
--by-payee: Report Options
--by-payee: Output customization
--change: Report Options
--check-payees: Error Checking and Calculation Options
--check-payees: Session Options
--cleared: Transaction state
--cleared: Report Filtering
--cleared: Report Options
--cleared: Report filtering
--cleared-format FORMAT_STRING: Report Options
--cleared-format FORMAT_STRING: Output customization
--cleared-format FORMAT_STRING: Format String Basics
--collapse: Output Customization
--collapse: Report Options
--collapse: Output customization
--collapse-if-zero: Report Options
--color: Report Options
--columns INT: Report Options
--cost: Report Options
--count: Reports about your Journals
--count: Report Options
--csv-format FORMAT_STRING: Report Options
--csv-format FORMAT_STRING: Output customization
--csv-format FORMAT_STRING: Format String Basics
--current: Report Filtering
--current: Report Options
--current: Report filtering
--daily: Grouping Options
--daily: Report Options
--date EXPR: Report Options
--date-format DATE_FORMAT: Output Customization
--date-format DATE_FORMAT: Report Options
--date-format DATE_FORMAT: Output customization
--date-width INT: Report Options
--datetime-format DATETIME_FORMAT: Report Options
--day-break: Session Options
--day-break: Time Keeping
--days-of-week: Report Options
--dc: Report Filtering
--dc: Report Options
--debug CODE: Global Options
--debug CODE: Debug Options
--decimal-comma: Session Options
--depth INT: Report Options
--detail: Report Options
--deviation: Output Customization
--deviation: Report Options
--deviation: Output customization
--display EXPR: Reporting monthly expenses
--display EXPR: Visualizing with Gnuplot
--display EXPR: Output Customization
--display EXPR: Report Options
--display EXPR: Output customization
--display EXPR: Value Expressions
--display-amount EXPR: Report Options
--display-total EXPR: Report Options
--dow: Output Customization
--dow: Grouping Options
--dow: Report Options
--dow: Output customization
--download: Transactions and Comments
--download: Commodity Reporting
--download: Session Options
--download: Commodity reporting
--effective: Effective Dates
--effective: Report Options
--empty: Balancing transactions
--empty: Output Customization
--empty: Report Options
--empty: Output customization
--end DATE: Report Filtering
--end DATE: Report Options
--end DATE: Report filtering
--equity: Report Options
--exact: Report Options
--exchange COMMODITY: Complete control over commodity pricing
--exchange COMMODITY: Primary and secondary commodities
--exchange COMMODITY: Report Options
--exchange COMMODITY: Commodity reporting
--exchange COMMODITY: Commodity reporting
--explicit: Session Options
--file FILE: Basic Options
--file FILE: Session Options
--file FILE: Basic options
--first INT: Report Options
--flat: Report Options
--force-color: Report Options
--force-pager: Report Options
--forecast VEXPR: Report Filtering
--forecast VEXPR: Report Options
--forecast VEXPR: Forecasting
--forecast-while VEXPR: Report Filtering
--forecast-while VEXPR: Report Options
--forecast-years INT: Report Options
--format FORMAT_STRING: Output Customization
--format FORMAT_STRING: Report Options
--format FORMAT_STRING: Output customization
--format FORMAT_STRING: Format String Basics
--format FORMAT_STRING: Balance format
--gain: Commodity Reporting
--gain: Report Options
--gain: Commodity reporting
--generated: Report Options
--group-by EXPR: Report Options
--group-title-format FORMAT_STRING: Report Options
--head INT: Output Customization
--head INT: Report Options
--head INT: Output customization
--help: Basic Options
--help: Global Options
--help: Basic options
--historical: Report Options
--historical: Commodity reporting
--immediate: Error Checking and Calculation Options
--immediate: Report Options
--import FILE: Basic Options
--init-file FILE: Basic Options
--init-file FILE: Global Options
--init-file FILE: Basic options
--inject: Report Options
--input-date-format DATE_FORMAT: The convert command
--input-date-format DATE_FORMAT: Session Options
--invert: The convert command
--invert: Report Options
--last INT: Report Options
--leeway INT: Commodity Reporting
--leeway INT: Session Options
--leeway INT: Commodity reporting
--limit EXPR: Controlling the Accounts and Payees
--limit EXPR: Visualizing with Gnuplot
--limit EXPR: Report Filtering
--limit EXPR: Report Options
--limit EXPR: Report filtering
--limit EXPR: Value Expressions
--lot-dates: Lot dates
--lot-dates: Report Options
--lot-notes: Lot notes
--lot-notes: Report Options
--lot-prices: Commodity prices
--lot-prices: Report Options
--lot-prices: Commodity reporting
--lot-prices: Commodity reporting
--lot-tags: Report Options
--lots: Lot notes
--lots: Report Options
--lots: Commodity reporting
--lots-actual: Report Options
--market: Commodities and Currencies
--market: Complete control over commodity pricing
--market: Primary and secondary commodities
--market: Commodity Reporting
--market: Report Options
--market: Commodity reporting
--market: Commodity reporting
--market: Primary commodities
--master-account STR: Session Options
--meta TAG: Report Options
--meta-width INT: Report Options
--monthly: Reporting monthly expenses
--monthly: Generating a monthly register
--monthly: Grouping Options
--monthly: Report Options
--monthly: Output customization
--monthly: Budgeting
--no-aliases: Session Options
--no-aliases: Report Options
--no-color: Report Options
--no-pager: Output Customization
--no-pager: Report Options
--no-pager: Output customization
--no-revalued: Report Options
--no-rounding: Report Options
--no-titles: Report Options
--no-total: Report Options
--now DATE: Report Options
--now DATE: Commodity reporting
--now DATE: Date Functions
--only FIXME: Report Options
--options: Global Options
--output FILE: Basic Options
--output FILE: Report Options
--output FILE: Basic options
--pager FILE: Output Customization
--pager FILE: Report Options
--pager FILE: Output customization
--payee VEXPR: Report Options
--payee-width INT: Report Options
--payee=code: Working with multiple funds and accounts
--pedantic: Command Directives
--pedantic: Error Checking and Calculation Options
--pedantic: Session Options
--pending: Transaction state
--pending: Report Options
--percent: Output Customization
--percent: Report Options
--percent: Output customization
--period PERIOD_EXPRESSION: Report Filtering
--period PERIOD_EXPRESSION: Report Options
--period PERIOD_EXPRESSION: Report filtering
--period PERIOD_EXPRESSION: Output customization
--period-sort VEXPR: Reporting monthly expenses
--period-sort VEXPR: Report Filtering
--period-sort VEXPR: Report Options
--period-sort VEXPR: Report filtering
--permissive: Balance verification
--permissive: Session Options
--pivot TAG: Output Customization
--pivot TAG: Report Options
--pivot TAG: Output customization
--plot-amount-format FORMAT_STRING: Output Customization
--plot-amount-format FORMAT_STRING: Report Options
--plot-amount-format FORMAT_STRING: Output customization
--plot-amount-format FORMAT_STRING: Format String Basics
--plot-total-format FORMAT_STRING: Output Customization
--plot-total-format FORMAT_STRING: Report Options
--plot-total-format FORMAT_STRING: Output customization
--plot-total-format FORMAT_STRING: Format String Basics
--prepend-format FORMAT_STRING: Report Options
--prepend-width INT: Report Options
--price: Report Options
--price: Commodity reporting
--price-db FILE: Commodities and Currencies
--price-db FILE: Commodity Reporting
--price-db FILE: Session Options
--price-db FILE: Commodity reporting
--price-exp INT: Commodity Reporting
--price-exp INT: Session Options
--price-exp INT: Commodity reporting
--pricedb-format FORMAT_STRING: Report Options
--pricedb-format FORMAT_STRING: Output customization
--pricedb-format FORMAT_STRING: Format String Basics
--prices-format FORMAT_STRING: Output Customization
--prices-format FORMAT_STRING: Report Options
--prices-format FORMAT_STRING: Output customization
--prices-format FORMAT_STRING: Format String Basics
--primary-date: Report Options
--quantity: Commodity Reporting
--quantity: Report Options
--quantity: Commodity reporting
--quarterly: Output Customization
--quarterly: Grouping Options
--quarterly: Report Options
--raw: Report Options
--real: Working with multiple funds and accounts
--real: Virtual postings
--real: Report Filtering
--real: Report Options
--real: Report filtering
--recursive-aliases: Session Options
--register-format FORMAT_STRING: Output Customization
--register-format FORMAT_STRING: Report Options
--register-format FORMAT_STRING: Output customization
--register-format FORMAT_STRING: Format String Basics
--related: Reporting monthly expenses
--related: Report Filtering
--related: Report Options
--related: Report filtering
--related-all: Report Options
--revalued: Report Options
--revalued-only: Report Options
--revalued-total FIXME: Report Options
--rich-data: The convert command
--rich-data: Report Options
--script FILE: Global Options
--seed INT: Report Options
--sort VEXPR: Output Customization
--sort VEXPR: Report Options
--sort VEXPR: Output customization
--sort-all FIXME: Report Options
--sort-xacts VEXPR: Report Options
--start-of-week INT: Report Options
--strict: Keeping it Consistent
--strict: Command Directives
--strict: Error Checking and Calculation Options
--strict: Session Options
--subtotal: Reporting monthly expenses
--subtotal: An overall balance summary
--subtotal: Output Customization
--subtotal: Grouping Options
--subtotal: Report Options
--subtotal: Output customization
--tail INT: Output Customization
--tail INT: Report Options
--time-colon: Session Options
--time-report: Report Options
--total VEXPR: Report Filtering
--total VEXPR: Report Options
--total VEXPR: Report filtering
--total VEXPR: Variables
--total VEXPR: Format Expressions
--total-data: Visualizing with Gnuplot
--total-data: The register command
--total-data: Output Customization
--total-data: Report Options
--total-data: Output customization
--total-width INT: Report Options
--trace INT: Global Options
--trace INT: Debug Options
--truncate CODE: Report Options
--unbudgeted: Report Filtering
--unbudgeted: Report Options
--unbudgeted: Budgeting
--uncleared: Transaction state
--uncleared: Report Filtering
--uncleared: Report Options
--uncleared: Report filtering
--unrealized: Report Options
--unrealized-gains STR: Report Options
--unrealized-losses STR: Report Options
--unround: Report Options
--value-expr VEXPR: Session Options
--values: tags
--values: Report Options
--verbose: Global Options
--verbose: Debug Options
--verify: Global Options
--verify: Debug Options
--verify-memory: Global Options
--verify-memory: Debug Options
--version: Basic Options
--version: Global Options
--version: Basic options
--version: Debug Options
--weekly: Output Customization
--weekly: Grouping Options
--weekly: Report Options
--weekly: Output customization
--wide: Output Customization
--wide: Report Options
--wide: Output customization
--yearly: Output Customization
--yearly: Grouping Options
--yearly: Report Options
--yearly: Output customization
-A: Output Customization
-A: Report Options
-A: Output customization
-a STR: Basic Options
-a STR: Basic options
-B: Commodity Reporting
-B: Report Options
-B: Commodity reporting
-b DATE: Report Filtering
-b DATE: Report filtering
-c: Report Filtering
-C: Report Filtering
-C: Report Options
-c: Report filtering
-C: Report filtering
-D: Output Customization
-D: Grouping Options
-D: Report Options
-D: Output customization
-d EXPR: Output Customization
-d EXPR: Output customization
-E: Output Customization
-E: Report Options
-E: Output customization
-e DATE: Report Filtering
-e DATE: Report filtering
-f FILE: Basic Options
-f FILE: Session Options
-f FILE: Basic options
-F FORMAT_STRING: Output Customization
-F FORMAT_STRING: Report Options
-F FORMAT_STRING: Output customization
-G: Commodity Reporting
-G: Report Options
-G: Commodity reporting
-h: Basic Options
-h: Global Options
-H: Report Options
-h: Basic options
-I: Report Options
-i FILE: Basic Options
-i FILE: Basic options
-j: Output Customization
-J: Output Customization
-j: Report Options
-J: Report Options
-j: Output customization
-J: Output customization
-L: Report Filtering
-L: Report Options
-L: Report filtering
-l EXPR: Report Filtering
-l EXPR: Report Options
-l EXPR: Report filtering
-M: Grouping Options
-M: Report Options
-M: Output customization
-n: Output Customization
-n: Report Options
-n: Output customization
-O: Commodity Reporting
-O: Report Options
-O: Commodity reporting
-o FILE: Basic Options
-o FILE: Basic options
-P: Output Customization
-P: Grouping Options
-P: Report Options
-P: Output customization
-p PERIOD_EXPRESSION: Report Filtering
-p PERIOD_EXPRESSION: Report filtering
-Q: Commodity Reporting
-Q: Session Options
-Q: Commodity reporting
-R: Report Filtering
-r: Report Filtering
-R: Report Options
-R: Report filtering
-r: Report filtering
-s: Output Customization
-s: Grouping Options
-s: Report Options
-s: Output customization
-S VEXPR: Output Customization
-S VEXPR: Report Options
-S VEXPR: Output customization
-t EXPR: Report Filtering
-t EXPR: Report Options
-t EXPR: Report filtering
-T VEXPR: Report Filtering
-T VEXPR: Report Options
-T VEXPR: Report filtering
-U: Report Filtering
-U: Report Options
-U: Report filtering
-V: Commodity Reporting
-v: Global Options
-V: Report Options
-V: Commodity reporting
-v: Debug Options
-W: Output Customization
-w: Output Customization
-W: Grouping Options
-W: Report Options
-W: Output customization
-w: Output customization
-X COMMODITY: Report Options
-Y: Output Customization
-Y: Grouping Options
-Y: Report Options
-Y: Output customization
-y DATE_FORMAT: Output Customization
-y DATE_FORMAT: Report Options
-y DATE_FORMAT: Output customization
-Z INT: Commodity Reporting
-Z INT: Session Options
-Z INT: Commodity reporting

=
=: Transactions and Comments

~
~: Transactions and Comments

A
A: Command Directives
abs: Miscellaneous
account: Command Directives
accounts: Keeping it Consistent
accounts: accounts
alias: Command Directives
amount_expr: Miscellaneous
ansify_if: Miscellaneous
apply account: Command Directives
apply tag: Command Directives
args: Pre-Commands
assert: Command Directives

B
b: Command Directives
bal: Basic Reporting Commands
balance: Balance Report
balance: The balance command
balance: Basic Reporting Commands
bucket: Command Directives
bucket: Command Directives

C
C: Commodity equivalences
C: Command Directives
capture: Command Directives
ceiling: Miscellaneous
check: Command Directives
cleared: Cleared Report
comment: Transactions and Comments
comment: Command Directives
commodities: commodities
commodity: Command Directives
convert: The convert command
csv: The csv command
csv: Basic Reporting Commands

D
D: Command Directives
define: Command Directives
draft: xact

E
echo: echo
emacs: The lisp command
emacs: Basic Reporting Commands
end: Command Directives
entry: xact
equity: Archiving Previous Years
equity: The equity command
equity: Basic Reporting Commands
eval VEXPR: Pre-Commands
expr: Command Directives
expr VEXPR: Pre-Commands

F
fixed: Command Directives
floor: Miscellaneous
format: Miscellaneous
format FORMAT_STRING: Pre-Commands
format_date: Miscellaneous
format_datetime: Miscellaneous

G
generate: Pre-Commands
get_at: Miscellaneous

H
h: Command Directives
help: Getting help

I
I: Command Directives
i: Command Directives
include: Command Directives
int: Miscellaneous
is_seq: Miscellaneous

J
join: Miscellaneous
justify: Miscellaneous

L
lisp: The lisp command
lisp: Basic Reporting Commands

M
market: Miscellaneous

N
N: Command Directives
nail_down: Miscellaneous

O
O: Command Directives
o: Command Directives
org: Emacs org Mode

P
P: Transactions and Comments
P: Miscellaneous
parse VEXPR: Pre-Commands
payee: Command Directives
payees: Payee metadata tag
payees: payees
percent: Miscellaneous
period PERIOD_EXPRESSION: Pre-Commands
pricedb: prices and pricedb commands
pricedb: Basic Reporting Commands
pricemap: The pricemap command
prices: prices and pricedb commands
prices: Basic Reporting Commands
print: Command Directives
print: Command Directives
print: Archiving Previous Years
print: The print command
print: Basic Reporting Commands
print: Miscellaneous

Q
quantity: Miscellaneous
query: Pre-Commands
quoted: Miscellaneous

R
reg: Basic Reporting Commands
register: Register Report
register: Command Directives
register: Command Directives
register: Payee metadata tag
register: The register command
register: Generating a monthly register
register: Basic Reporting Commands
reload: reload
round: Miscellaneous
rounded: Miscellaneous
roundto: Miscellaneous

S
S: Miscellaneous
script: Pre-Commands
scrub: Miscellaneous
select: select
should_bold: Miscellaneous
source: source
stat: stats
stats: stats
str: Miscellaneous
strip: Miscellaneous

T
tag: Command Directives
tags: tags
template: Pre-Commands
test: Command Directives
top_amount: Miscellaneous
total_expr: Miscellaneous
to_amount: Miscellaneous
to_balance: Miscellaneous
to_boolean: Miscellaneous
to_date: Miscellaneous
to_datetime: Miscellaneous
to_int: Miscellaneous
to_mask: Miscellaneous
to_sequence: Miscellaneous
to_string: Miscellaneous
trim: Miscellaneous
truncatedstring: Miscellaneous

U
U: Miscellaneous
unround: Miscellaneous
unrounded: Miscellaneous

V
value_date: Miscellaneous

X
xact: Command Directives
xact: xact
xact: Basic Reporting Commands
xml: The xml command
xml: Basic Reporting Commands

Y
Y: Command Directives
year: Command Directives
year: Command Directives

+
Jump to:   - +   += +   +~ +   +
+A +   +B +   +C +   +D +   +E +   +F +   +G +   +H +   +I +   +J +   +L +   +M +   +N +   +O +   +P +   +Q +   +R +   +S +   +T +   +U +   +V +   +X +   +Y +   +
+ +
+
+

Footnotes

+ +

(1)

+

In some special +cases, it automatically balances this transaction for you.

+

(2)

+

This also means if you +misspell an account it will end up getting counted separately from +what you intended. An Emacs major mode +ledger-mode provides +tab completion for automatically filling in account names.

+

(3)

+

You +can track anything, even time or distance traveled. As long as +it cannot be created or destroyed inside your accounting system.

+
+
+ + + + + + + diff --git a/Contrib/NLManagement/NLDoc.LiveDemo.psm1 b/Contrib/LiveDemo/NLDoc.LiveDemo.psm1 similarity index 60% rename from Contrib/NLManagement/NLDoc.LiveDemo.psm1 rename to Contrib/LiveDemo/NLDoc.LiveDemo.psm1 index 986fa345..4b69862f 100644 --- a/Contrib/NLManagement/NLDoc.LiveDemo.psm1 +++ b/Contrib/LiveDemo/NLDoc.LiveDemo.psm1 @@ -1,290 +1,337 @@ -# If you run this script in ISE, you may want to configure Execution Policy by this command: -# set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path -Import-Module $Script:ScriptPath\NLSetup.psm1 -Force - -[bool]$Script:isWindowsPlatform = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows) -[bool]$Script:isOsxPlatform = if(!($Script:isWindowsPlatform)) { [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::OSX) } else { $false } -[string]$Script:dsp = [System.IO.Path]::DirectorySeparatorChar - -function GetDefaultDemoSettings { - [CmdletBinding()] - Param() - - return @{ - demoConfig = "NLDoc.LiveDemo.config.xml" - sandbox = "{MyDocuments}/NLedger/DemoSandbox" - demoURL = "http://localhost:8080/" - demoFile = "NLDoc.LiveDemo.ledger3.html" - editor = $(if($Script:isWindowsPlatform){"wordpad.exe"}else{"xdg-open"}) - browser = "" - } -} - -function GetLiveDemoConfigExtension { - [CmdletBinding()] - Param() - - $private:defaultSettings = GetDefaultDemoSettings - - return [PsCustomObject]@{ - Category=".Net Ledger Live Demo Settings" - Settings=@( - [PsCustomObject]@{Name="DemoURL";Description="Live Demo URL. Allows to specify an alternative port or machine name.";Default=$private:defaultSettings.demoURL} - [PsCustomObject]@{Name="DemoEditor";Description="The name of an editor that is used to modify Live Demo data files.";Default=$private:defaultSettings.editor} - [PsCustomObject]@{Name="DemoBrowser";Description="The name of a browser to show Live Demo page. Empty value means a default browser. Allowed short names 'edge', 'chrome', 'firefox', 'iexplore' or a fully-qualified executable name.";Default=$private:defaultSettings.browser} - )} -} - -# Register Live Demo Configuration extension in NLSetup -$Global:ConfigDataExtensions["LiveDemo"] = GetLiveDemoConfigExtension - -function GetDemoConfig { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$False)][string]$liveDemoConfig = "$Script:ScriptPath\NLDoc.LiveDemo.config.xml" - ) - - $private:settings = GetDefaultDemoSettings - $private:configData = GetConfigData - $private:settings["demoURL"] = ($private:configData.Settings | Where-Object{$_.Name -eq "DemoURL"}).EffectiveSettingValue - $private:settings["editor"] = ($private:configData.Settings | Where-Object{$_.Name -eq "DemoEditor"}).EffectiveSettingValue - $private:settings["browser"] = ($private:configData.Settings | Where-Object{$_.Name -eq "DemoBrowser"}).EffectiveSettingValue - - [string]$liveDemoConfig = "$Script:ScriptPath\$($private:settings.demoConfig)" - - Write-Verbose "Read Demo Config by path: $liveDemoConfig" - [xml]$private:demoConfigXml = Get-Content -Encoding UTF8 -LiteralPath $liveDemoConfig - $private:files = @{} - $private:demoConfigXml.SelectNodes("/ledger-demo/demo-files/file") | ForEach-Object { $private:files[$_.name] = $_.path } - $private:commands = @{} - $private:demoConfigXml.SelectNodes("/ledger-demo/demo-cases/case") | ForEach-Object { $private:commands[$_.'test-id'] = $_.command } - $private:testFiles = @{} - $private:demoConfigXml.SelectNodes("/ledger-demo/demo-cases/case") | ForEach-Object { $private:testFiles[$_.'test-id'] = $_.filename } - - return [PsCustomObject] @{ - Files = $private:files - Settings = $private:settings - Sandbox = $private:settings["sandbox"].Replace("{MyDocuments}",[Environment]::GetFolderPath("MyDocuments")) - DemoURL = $private:settings["demoURL"] - DemoFile = Resolve-Path (Join-Path $Script:ScriptPath $private:settings["demoFile"]) -ErrorAction Stop - Commands = $private:commands - TestFiles = $private:testFiles - Editor = $private:settings["editor"] - Browser = $private:settings["browser"] - } -} - -function openPage { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)]$demoConfig - ) - - $private:url = "$($demoConfig.DemoURL)content" - - if ($demoConfig.browser -eq "edge") { - Start-Process "microsoft-edge:$private:url" - } else { - if ($demoConfig.browser -eq "chrome") { - Start-Process "chrome.exe" $private:url - } else { - if ($demoConfig.browser -eq "firefox") { - Start-Process "firefox.exe" $private:url - } else { - if ($demoConfig.browser -eq "iexplore") { - Start-Process "iexplore.exe" $private:url - } else { - if ($demoConfig.browser) { - Start-Process $demoConfig.browser $private:url - } else - { - Start-Process $private:url - } - } - } - } - } -} - -function InitDemoSandbox { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)]$files, - [Parameter(Mandatory=$True)][string]$sandbox - ) - - if (!(Test-Path $sandbox -PathType Container)) { New-Item -ItemType Directory -Force -Path $sandbox } - foreach($key in $files.Keys) { - [string]$sourceFile = Resolve-Path (Join-Path $Script:ScriptPath $files[$key]) -ErrorAction Stop - [string]$targetFile = "$sandbox$Script:dsp$key" - if (!(Test-Path $sourceFile -PathType Leaf)) { throw "Source file does not exist: $sourceFile" } - if (!(Test-Path $targetFile -PathType Leaf)) { Copy-Item -LiteralPath $sourceFile -Destination $targetFile | Out-Null } - } - -} - -function RevertDemoSandboxFile { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)]$files, - [Parameter(Mandatory=$True)][string]$fileName, - [Parameter(Mandatory=$True)][string]$sandbox - ) - - if (!(Test-Path $sandbox -PathType Container)) { throw "No sandbox folder" } - [string]$sourceFile = Resolve-Path (Join-Path $Script:ScriptPath $files[$fileName]) -ErrorAction Stop - [string]$targetFile = "$sandbox$Script:dsp$key" - if (!(Test-Path $sourceFile -PathType Leaf)) { throw "Source file does not exist: $sourceFile" } - Copy-Item -LiteralPath $sourceFile -Destination $targetFile -Force | Out-Null -} - -function GetContent { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$demoFile - ) - - if (!(Test-Path -LiteralPath $demoFile -PathType Leaf)) { throw "File not found: $demoFile" } - return Get-Content -Encoding UTF8 -LiteralPath $demoFile | Out-String -} - -function actRun { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$testid, - [Parameter(Mandatory=$True)]$demoConfig - ) - - Write-Verbose "Requested app run for test $testid" - - $private:command = $demoConfig.Commands[$testid] - if ($private:command) { - $env:CMDTORUN = $private:command - Write-Verbose "Command to execute (CMDTORUN): $env:CMDTORUN" - if ($Script:isWindowsPlatform) { - $private:cmd = "/k """"$ScriptPath\NLDoc.LiveDemo.Launch.cmd"" $private:command""" - $env:CMDTOVIEW = $private:command.Replace("^","^^") - Write-Verbose "Command to view (CMDTOVIEW): $env:CMDTOVIEW" - Write-Verbose "Start process - working directory: $($demoConfig.Sandbox); file path: $env:comspec; ArgumentList: $private:cmd" - start-process -workingdirectory $demoConfig.Sandbox -filepath "$env:comspec" -ArgumentList $private:cmd - } else { - if($isOsxPlatform) { - [string]$Private:osxTempRunFile = "/tmp/nldoclivedemolaunch.sh" - if(Test-Path -LiteralPath $Private:osxTempRunFile -PathType Leaf) { Remove-Item -LiteralPath $Private:osxTempRunFile } - $null = Add-Content $Private:osxTempRunFile "cd $($demoConfig.Sandbox)" - $null = Add-Content $Private:osxTempRunFile "echo $env:CMDTORUN" - $null = Add-Content $Private:osxTempRunFile "$env:CMDTORUN" - $null = (& chmod +x $Private:osxTempRunFile) - start-process -workingdirectory $demoConfig.Sandbox -filepath "open" -ArgumentList "-a Terminal $Private:osxTempRunFile" - } else { - [string]$Private:xargs = "-e `"$ScriptPath/NLDoc.LiveDemo.Launch.sh;bash`"" - start-process -workingdirectory $demoConfig.Sandbox -filepath "xterm" -ArgumentList $Private:xargs - } - } - return "OK: $testid" - } else { - return "FAIL: command not found - $testid" - } -} - -function actEdit { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$testid, - [Parameter(Mandatory=$True)]$demoConfig - ) - - Write-Verbose "Requested edit data file for test $testid" - - $private:file = $demoConfig.TestFiles[$testid] - if ($private:file) { - if($isOsxPlatform) { - Start-process -FilePath "open" -ArgumentList "-t $($demoConfig.Sandbox)/$private:file" - } else { - start-process -WorkingDirectory $demoConfig.Sandbox -FilePath $demoConfig.Editor $private:file - } - return "OK: $testid" - } else { - return "FAIL: file not found - $testid" - } -} - -function actOpen { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$testid, - [Parameter(Mandatory=$True)]$demoConfig - ) - - Write-Verbose "Requested opening containing folder for test $testid" - - $private:file = $demoConfig.TestFiles[$testid] - if ($private:file) { - if ($Script:isWindowsPlatform) { - start-process -WorkingDirectory $demoConfig.Sandbox -FilePath "explorer" "/e, /select, `"$($demoConfig.Sandbox.Replace('/','\'))\$private:file`"" - } - else { - if($isOsxPlatform) { - start-process -FilePath "open" -ArgumentList $demoConfig.Sandbox - } else { - start-process -WorkingDirectory $demoConfig.Sandbox -FilePath "xdg-open" -ArgumentList $demoConfig.Sandbox - } - } - return "OK: $testid" - } else { - return "FAIL: file not found - $testid" - } -} - -function actRevert { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$testid, - [Parameter(Mandatory=$True)]$demoConfig - ) - - Write-Verbose "Requested reverting data file for test $testid" - - $private:file = $demoConfig.TestFiles[$testid] - if ($private:file) { - RevertDemoSandboxFile -fileName $private:file -sandbox $demoConfig.Sandbox -files $demoConfig.Files | Out-Null - return "OK: $testid" - } else { - return "FAIL: file not found - $testid" - } -} - -function WriteDemoConfig { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)]$demoFiles, - [Parameter(Mandatory=$True)]$demoCases, - [Parameter(Mandatory=$False)][string]$fileName - ) - - [xml]$private:xml = [xml]'' - - $private:xmlFiles = ($private:xml.'ledger-demo').GetElementsByTagName("demo-files") - foreach($private:file in $demoFiles.Keys) { - $private:xmlFile = $private:xml.CreateElement("file") - $private:xmlFile.SetAttribute("name", $private:file) | Out-Null - $private:xmlFile.SetAttribute("path", $demoFiles[$private:file]) | Out-Null - $private:xmlFiles.AppendChild($private:xmlFile) | Out-Null - } - - $private:xmlCases = ($private:xml.'ledger-demo').GetElementsByTagName("demo-cases") - foreach($private:case in $demoCases) { - $private:xmlCase = $private:xml.CreateElement("case") - $private:xmlCase.SetAttribute("test-id", $private:case.TestID) | Out-Null - $private:xmlCase.SetAttribute("command", $private:case.Command) | Out-Null - $private:xmlCase.SetAttribute("filename", $private:case.FileName) | Out-Null - $private:xmlCases.AppendChild($private:xmlCase) | Out-Null - } - - $private:xml.Save($fileName) | Out-Null -} - - -Export-ModuleMember -function * -alias * +<# +.SYNOPSIS +NLedger Interactive Demo routines + +.DESCRIPTION +Provides helper functions that allows running NLedger interactive demo + +.NOTES +Author: Dmitry Merzlyakov +Date: December 14, 2023 +#> + +[CmdletBinding()] +Param() + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path +Import-Module $Script:ScriptPath\PsHttpListener.psm1 +Import-Module $Script:ScriptPath\..\Common\SysCommon.psm1 +Import-Module $Script:ScriptPath\..\Common\SysPlatform.psm1 +Import-Module $Script:ScriptPath\..\Common\SysConsole.psm1 +Import-Module $Script:ScriptPath\..\Common\NLedgerConfig.psm1 +Import-Module $Script:ScriptPath\..\Common\NLedgerEnvironment.psm1 + +function Get-DefaultNLedgerLiveDemoSettings { + [CmdletBinding()] + Param() + + return @{ + demoConfig = "NLDoc.LiveDemo.config.xml" + sandbox = "{MyDocuments}/NLedger/DemoSandbox" + demoURL = "http://localhost:8080/" + demoFile = "NLDoc.LiveDemo.ledger3.html" + editor = $(if(Test-IsWindows){"wordpad.exe"}else{"xdg-open"}) + browser = "" + } +} + +function Get-NLedgerLiveDemoConfigExtension { + [CmdletBinding()] + Param() + + $private:defaultSettings = Get-DefaultNLedgerLiveDemoSettings + + return [PsCustomObject]@{ + Category=".Net Ledger Live Demo Settings" + Settings=@( + [PsCustomObject]@{Name="DemoURL";Description="Live Demo URL. Allows to specify an alternative port or machine name.";Default=$private:defaultSettings.demoURL} + [PsCustomObject]@{Name="DemoEditor";Description="The name of an editor that is used to modify Live Demo data files.";Default=$private:defaultSettings.editor} + [PsCustomObject]@{Name="DemoBrowser";Description="The name of a browser to show Live Demo page. Empty value means a default browser. Allowed short names 'edge', 'chrome', 'firefox', 'iexplore' or a fully-qualified executable name.";Default=$private:defaultSettings.browser} + )} +} + +# Register Live Demo Configuration extension in NLSetup +$Global:ConfigDataExtensions["LiveDemo"] = Get-NLedgerLiveDemoConfigExtension + +function Get-NLedgerLiveDemoConfig { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$False)][string]$liveDemoConfig = "$Script:ScriptPath\NLDoc.LiveDemo.config.xml" + ) + + $private:settings = Get-DefaultNLedgerLiveDemoSettings + $private:configData = Get-NLedgerConfigData + $private:settings["demoURL"] = ($private:configData.Settings | Where-Object{$_.Name -eq "DemoURL"}).EffectiveSettingValue + $private:settings["editor"] = ($private:configData.Settings | Where-Object{$_.Name -eq "DemoEditor"}).EffectiveSettingValue + $private:settings["browser"] = ($private:configData.Settings | Where-Object{$_.Name -eq "DemoBrowser"}).EffectiveSettingValue + + [string]$liveDemoConfig = "$Script:ScriptPath\$($private:settings.demoConfig)" + + Write-Verbose "Read Demo Config by path: $liveDemoConfig" + [xml]$private:demoConfigXml = Get-Content -Encoding UTF8 -LiteralPath $liveDemoConfig + $private:files = @{} + $private:demoConfigXml.SelectNodes("/ledger-demo/demo-files/file") | ForEach-Object { $private:files[$_.name] = $_.path } + $private:commands = @{} + $private:demoConfigXml.SelectNodes("/ledger-demo/demo-cases/case") | ForEach-Object { $private:commands[$_.'test-id'] = $_.command } + $private:testFiles = @{} + $private:demoConfigXml.SelectNodes("/ledger-demo/demo-cases/case") | ForEach-Object { $private:testFiles[$_.'test-id'] = $_.filename } + + return [PsCustomObject] @{ + Files = $private:files + Settings = $private:settings + Sandbox = $private:settings["sandbox"].Replace("{MyDocuments}",[Environment]::GetFolderPath("MyDocuments")) + DemoURL = $private:settings["demoURL"] + DemoFile = Resolve-Path (Join-Path $Script:ScriptPath $private:settings["demoFile"]) -ErrorAction Stop + Commands = $private:commands + TestFiles = $private:testFiles + Editor = $private:settings["editor"] + Browser = $private:settings["browser"] + } +} + +function Open-NLedgerLiveDemoPage { + [CmdletBinding()] + Param([Parameter(Mandatory)]$demoConfig) + + $private:url = "$($demoConfig.DemoURL)content" + + if ($demoConfig.browser -eq "edge") { + Start-Process "microsoft-edge:$private:url" + } else { + if ($demoConfig.browser -eq "chrome") { + Start-Process "chrome.exe" $private:url + } else { + if ($demoConfig.browser -eq "firefox") { + Start-Process "firefox.exe" $private:url + } else { + if ($demoConfig.browser -eq "iexplore") { + Start-Process "iexplore.exe" $private:url + } else { + if ($demoConfig.browser) { + Start-Process $demoConfig.browser $private:url + } else + { + Start-Process $private:url + } + } + } + } + } +} + +function Initialize-NLedgerLiveDemoSandbox { + [CmdletBinding()] + Param( + [Parameter(Mandatory)]$files, + [Parameter(Mandatory)][string]$sandbox + ) + + if (!(Test-Path $sandbox -PathType Container)) { New-Item -ItemType Directory -Force -Path $sandbox } + foreach($key in $files.Keys) { + [string]$sourceFile = Resolve-Path (Join-Path $Script:ScriptPath $files[$key]) -ErrorAction Stop + [string]$targetFile = [System.IO.Path]::GetFullPath("$sandbox/$key") + if (!(Test-Path $sourceFile -PathType Leaf)) { throw "Source file does not exist: $sourceFile" } + if (!(Test-Path $targetFile -PathType Leaf)) { $null = Copy-Item -LiteralPath $sourceFile -Destination $targetFile } + } + +} + +function Undo-NLedgerLiveDemoSandboxFile { + [CmdletBinding()] + Param( + [Parameter(Mandatory)]$files, + [Parameter(Mandatory)][string]$fileName, + [Parameter(Mandatory)][string]$sandbox + ) + + if (!(Test-Path $sandbox -PathType Container)) { throw "No sandbox folder" } + [string]$sourceFile = Resolve-Path (Join-Path $Script:ScriptPath $files[$fileName]) -ErrorAction Stop + [string]$targetFile = [System.IO.Path]::GetFullPath("$sandbox/$key") + if (!(Test-Path $sourceFile -PathType Leaf)) { throw "Source file does not exist: $sourceFile" } + $null = Copy-Item -LiteralPath $sourceFile -Destination $targetFile -Force +} + +function Invoke-NLedgerLiveDemoActionRun { + [CmdletBinding()] + Param( + [Parameter(Mandatory)][string]$testid, + [Parameter(Mandatory)]$demoConfig + ) + + Write-Verbose "Requested app run for test $testid" + + $private:command = $demoConfig.Commands[$testid] + if ($private:command) { + $env:CMDTORUN = $private:command + Write-Verbose "Command to execute (CMDTORUN): $env:CMDTORUN" + if (Test-IsWindows) { + $private:cmd = "/k """"$ScriptPath\NLDoc.LiveDemo.Launch.cmd"" $private:command""" + $env:CMDTOVIEW = $private:command.Replace("^","^^") + Write-Verbose "Command to view (CMDTOVIEW): $env:CMDTOVIEW" + Write-Verbose "Start process - working directory: $($demoConfig.Sandbox); file path: $env:comspec; ArgumentList: $private:cmd" + start-process -workingdirectory $demoConfig.Sandbox -filepath "$env:comspec" -ArgumentList $private:cmd + } else { + if(Test-IsOSX) { + [string]$Private:osxTempRunFile = "/tmp/nldoclivedemolaunch.sh" + if(Test-Path -LiteralPath $Private:osxTempRunFile -PathType Leaf) { Remove-Item -LiteralPath $Private:osxTempRunFile } + $null = Add-Content $Private:osxTempRunFile "cd $($demoConfig.Sandbox)" + $null = Add-Content $Private:osxTempRunFile "echo $env:CMDTORUN" + $null = Add-Content $Private:osxTempRunFile "$env:CMDTORUN" + $null = (& chmod +x $Private:osxTempRunFile) + start-process -workingdirectory $demoConfig.Sandbox -filepath "open" -ArgumentList "-a Terminal $Private:osxTempRunFile" + } else { + [string]$Private:xargs = "-e `"$ScriptPath/NLDoc.LiveDemo.Launch.sh;bash`"" + start-process -workingdirectory $demoConfig.Sandbox -filepath "xterm" -ArgumentList $Private:xargs + } + } + return "OK: $testid" + } else { + return "FAIL: command not found - $testid" + } +} + +function Invoke-NLedgerLiveDemoActionEdit { + [CmdletBinding()] + Param( + [Parameter(Mandatory)][string]$testid, + [Parameter(Mandatory)]$demoConfig + ) + + Write-Verbose "Requested edit data file for test $testid" + + $private:file = $demoConfig.TestFiles[$testid] + if ($private:file) { + if(Test-IsOSX) { + Start-process -FilePath "open" -ArgumentList "-t $($demoConfig.Sandbox)/$private:file" + } else { + start-process -WorkingDirectory $demoConfig.Sandbox -FilePath $demoConfig.Editor $private:file + } + return "OK: $testid" + } else { + return "FAIL: file not found - $testid" + } +} + +function Invoke-NLedgerLiveDemoActionOpen { + [CmdletBinding()] + Param( + [Parameter(Mandatory)][string]$testid, + [Parameter(Mandatory)]$demoConfig + ) + + Write-Verbose "Requested opening containing folder for test $testid" + + $private:file = $demoConfig.TestFiles[$testid] + if ($private:file) { + if (Test-IsWindows) { + start-process -WorkingDirectory $demoConfig.Sandbox -FilePath "explorer" "/e, /select, `"$($demoConfig.Sandbox.Replace('/','\'))\$private:file`"" + } + else { + if(Test-IsOSX) { + start-process -FilePath "open" -ArgumentList $demoConfig.Sandbox + } else { + start-process -WorkingDirectory $demoConfig.Sandbox -FilePath "xdg-open" -ArgumentList $demoConfig.Sandbox + } + } + return "OK: $testid" + } else { + return "FAIL: file not found - $testid" + } +} + +function Invoke-NLedgerLiveDemoActionRevert { + [CmdletBinding()] + Param( + [Parameter(Mandatory)][string]$testid, + [Parameter(Mandatory)]$demoConfig + ) + + Write-Verbose "Requested reverting data file for test $testid" + + $private:file = $demoConfig.TestFiles[$testid] + if ($private:file) { + $null = Undo-NLedgerLiveDemoSandboxFile -fileName $private:file -sandbox $demoConfig.Sandbox -files $demoConfig.Files + return "OK: $testid" + } else { + return "FAIL: file not found - $testid" + } +} + +function Write-NLedgerLiveDemoConfig { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)]$demoFiles, + [Parameter(Mandatory=$True)]$demoCases, + [Parameter(Mandatory=$False)][string]$fileName + ) + + [xml]$private:xml = [xml]'' + + $private:xmlFiles = ($private:xml.'ledger-demo').GetElementsByTagName("demo-files") + foreach($private:file in $demoFiles.Keys) { + $private:xmlFile = $private:xml.CreateElement("file") + $null = $private:xmlFile.SetAttribute("name", $private:file) + $null = $private:xmlFile.SetAttribute("path", $demoFiles[$private:file]) + $null = $private:xmlFiles.AppendChild($private:xmlFile) + } + + $private:xmlCases = ($private:xml.'ledger-demo').GetElementsByTagName("demo-cases") + foreach($private:case in $demoCases) { + $private:xmlCase = $private:xml.CreateElement("case") + $null = $private:xmlCase.SetAttribute("test-id", $private:case.TestID) + $null = $private:xmlCase.SetAttribute("command", $private:case.Command) + $null = $private:xmlCase.SetAttribute("filename", $private:case.FileName) + $null = $private:xmlCases.AppendChild($private:xmlCase) + } + + $null = $private:xml.Save($fileName) +} + +<# +.SYNOPSIS +Shows interactive Ledger documentation + +.DESCRIPTION +The command is intended to display interactive Ledger documentation. +The interactivity of the documentation means that you can use your local NLedger to run the examples. + +The documentation is shown in your web browser. Each example in the documentation is +accompanied by a pop-up menu where you can select actions. They allow you to run NLedger +for a given example, copy command line arguments, and view or edit a sample data file. + +The main goal is to give a general idea of how Ledger works in action. + +.NOTES +The command requires that NLedger be installed with a hard link (ledger). +#> +function Invoke-NLedgerLiveDemo { + [CmdletBinding()] + [Alias("live-demo")] + Param() + + Write-Output "NLedger Live Demo" + + Assert-CommandCompleted { + if (!(Get-NLedgerDeploymentInfo).Installed) { throw "NLedger is not installed."} + + $demoConfig = Get-NLedgerLiveDemoConfig + + $actions = @{ + "\/content" = { Get-Content -Encoding UTF8 -LiteralPath $demoConfig.DemoFile | Out-String } + "\/shutdown" = { Invoke-HttpListenerShutdown } + "\/act\.actRun\.(.+)" = { Invoke-NLedgerLiveDemoActionRun -testid $_[1] -demoConfig $demoConfig } + "\/act\.actEdit\.(.+)" = { Invoke-NLedgerLiveDemoActionEdit -testid $_[1] -demoConfig $demoConfig } + "\/act\.actOpen\.(.+)" = { Invoke-NLedgerLiveDemoActionOpen -testid $_[1] -demoConfig $demoConfig } + "\/act\.actRevert\.(.+)" = { Invoke-NLedgerLiveDemoActionRevert -testid $_[1] -demoConfig $demoConfig } + } + + Write-Output "The web browser with the demo content should open automatically." + Write-Output "You can also open the demo manually using the link: {c:Yellow}$($demoConfig.DemoURL){f:Normal}." | Out-AnsiString + Write-Output "When you close the demo page, this process shuts down." + Write-Output "You can also stop this process at any time by pressing {c:Yellow}CTRL-C{f:Normal}." | Out-AnsiString + + $null = Initialize-NLedgerLiveDemoSandbox -files $demoConfig.Files -sandbox $demoConfig.Sandbox + $null = Start-HttpListener -actions $actions -prefix $demoConfig.DemoURL -onListenerStart { $null = Open-NLedgerLiveDemoPage $demoConfig } + } +} + diff --git a/Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.cmd b/Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.cmd similarity index 99% rename from Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.cmd rename to Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.cmd index 8734385e..0e6b6a68 100644 --- a/Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.cmd +++ b/Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.cmd @@ -1,3 +1,3 @@ -@REM This script updates the content of Live Demo files (NLDoc.LiveDemo.config.xml, NLDoc.LiveDemo.ledger3.html, /test/nledger/sandbox/) -@REM in case you update ledger3.texi and/or ledger3.html +@REM This script updates the content of Live Demo files (NLDoc.LiveDemo.config.xml, NLDoc.LiveDemo.ledger3.html, /test/nledger/sandbox/) +@REM in case you update ledger3.texi and/or ledger3.html @PowerShell -NoLogo -ExecutionPolicy RemoteSigned -File %~dp0NLDoc.LiveDemo.Extractor.ps1 \ No newline at end of file diff --git a/Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.ps1 b/Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.ps1 similarity index 96% rename from Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.ps1 rename to Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.ps1 index dcd5d769..53bff9dd 100644 --- a/Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.ps1 +++ b/Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.ps1 @@ -1,198 +1,198 @@ -# Extracts Ledger examples from the original documentation (ledger3.texi) and builds Live Demo files -# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process - -[CmdletBinding()] -Param( - [Parameter(Mandatory=$False)][string]$ledgerTexiPath, - [Parameter(Mandatory=$False)][string]$ledgerHtmlPath, - [Parameter(Mandatory=$False)][string]$liveTemplatePath, - [Parameter(Mandatory=$False)][string]$liveHtmlPath, - [Parameter(Mandatory=$False)][string]$casesExportPath, - [Parameter(Mandatory=$False)][string]$testsFolder, - [Parameter(Mandatory=$False)][string]$testSandboxFolder, - [Parameter(Mandatory=$False)][string]$liveDemoConfig, - [Switch]$casesExport = $False -) - -[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path - -Import-Module $Script:ScriptPath\..\NLDoc.LiveDemo.psm1 -Force -$Script:demoSettings = GetDefaultDemoSettings - -if (!$ledgerTexiPath) { $ledgerTexiPath = "$Script:ScriptPath\ledger3.texi" } -if (!$ledgerHtmlPath) { $ledgerHtmlPath = "$Script:ScriptPath\..\..\ledger3.html" } -if (!$liveTemplatePath) { $liveTemplatePath = "$Script:ScriptPath\NLDoc.LiveDemo.Extractor.templates" } -if (!$liveHtmlPath) { $liveHtmlPath = "$Script:ScriptPath\..\$($Script:demoSettings.demoFile)" } -if (!$casesExportPath) { $casesExportPath = "$Script:ScriptPath\ledger3.texi.xml" } -if (!$testsFolder) { $testsFolder = "$Script:ScriptPath\..\..\test\input\" } -if (!$testSandboxFolder) { $testSandboxFolder = "$Script:ScriptPath\..\..\test\nledger\sandbox\" } -if (!$liveDemoConfig) { $liveDemoConfig = "$Script:ScriptPath\..\$($Script:demoSettings.demoConfig)" } - -trap -{ - write-error $_ - exit 1 -} - -[int]$Script:current_line = 0 -[int]$Script:current_pos = 0 - -[string]$Script:testin_token = 'command' -[string]$Script:testout_token = 'output' -[string]$Script:testdat_token = 'input' -[string]$Script:testfile_token = 'file' -[string]$Script:validate_token = 'validate' -[string]$Script:validate_cmd_token = 'validate-command' -[string]$Script:validate_dat_token = 'validate-data' -[string]$Script:testwithdat_token = 'with_input' -[string]$Script:testwithfile_token = 'with_file' - -$Script:DisabledTests = @( - "Val-7660", # --pager /bin/cat - inappropriate path to a pager - "Val-5420", # ledger payees @Nic --file sample.dat - inappropriate data file (empty output even with original Leger) - "Val-7840", # $ ledger --file drewr3.dat --forecast "T>{\$-500.00}" register ^assets ^liabilities - RTE - "B4DFB9F") # $ ledger -f expr.dat --format "%(account) %(roundto(amount, 1))\n" reg - RTE - -function find_examples { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$fileName - ) - - [string]$private:startexample = "^@smallexample\s+@c\s+($Script:testin_token|$Script:testout_token|$Script:testdat_token|$Script:testfile_token)(?::([\dA-Fa-f]+|validate))?(?:,(.*))?" - [string]$private:endexample = "^@end\s+smallexample\s*$" - - $Script:current_line = 0 - $Script:current_pos = 0 - $private:example = $null - $private:examples = @() - - foreach($line in Get-Content $fileName -Encoding UTF8) { - $Script:current_pos += ($line.length + ([Math]::Sign($Script:current_line) * 2)) - $Script:current_line += 1 - - # Detect the first line - if($line -match $private:startexample){ - if ($private:example -ne $null) { throw "Invalid operation: an example is not finished" } - - $private:example = [PsCustomObject]@{ - test_begin_pos = $Script:current_pos - test_begin_line = $Script:current_line - test_kind = $Matches[1] - test_id = $Matches[2] - test_options = @{} - example = "" - test_end_pos = $null - test_end_line = $null - } - - if ($Matches[3]) { - $Matches[3].Split(",") | ForEach-Object { - $private:kv = $_.Split(":") - $private:example.test_options[$private:kv[0].Trim()] = $private:kv[1].Trim() - } - } - } else { - # Detect the last line - if ($line -match $private:endexample) { - if ($private:example -ne $null) { # Only if getting an example is in progress - $private:example.test_end_pos = $Script:current_pos - $private:example.test_end_line = $Script:current_line - # Getting an example is finished; verification - if (!$private:example.test_id) { - Write-Warning "Example $($private:example.test_kind) in line $($private:example.test_begin_line) is missing id." | Out-Null - $private:example.test_id = get_test_id $private:example.example - if ($private:example.test_kind -eq $Script:testin_token) { - Write-Warning "Use $($private:example.test_id)" | Out-Null - } - } else { - if ($private:example.test_kind -eq $Script:testin_token -and $private:example.test_id -ne $Script:validate_token -and $private:example.test_id -ne (get_test_id $private:example.example)) { - Write-Warning "Expected test id $($private:example.test_id) for example $($private:example.test_kind) on line $($private:example.test_begin_line) to be $(get_test_id $private:example.example)" | Out-Null - } - } - if ($private:example.test_id -eq $Script:validate_token) { - $private:example.test_id = "Val-$($private:example.test_begin_line)" - if ($private:example.test_kind -eq $Script:testin_token) { - $private:example.test_kind = $Script:validate_cmd_token - } else { - if ($private:example.test_kind -eq $Script:testdat_token) { - $private:example.test_kind = $Script:validate_dat_token - } - } - } - # Example is OK - $private:examples += $private:example - $private:example = $null - } - } else { - # Detect whether getting an example is in progress - if ($private:example -ne $null) { - $private:lineValue = $line -replace '@([@{}])', '$1' - $private:example.example += "$private:lineValue`n" - } - } - } - } - - return $private:examples -} - -function get_test_id { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$example - ) - $private:enc = [system.Text.Encoding]::UTF8 - $private:data = $private:enc.GetBytes($example.TrimEnd()) - $private:sha1 = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider - $private:hash = $private:sha1.ComputeHash($private:data) - $private:stringHash = [BitConverter]::ToString($private:hash).Replace("-","").ToUpper() - return $private:stringHash.Substring(0,7) -} - -function get_Joined_Example { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)]$exampleKinds, - [Parameter(Mandatory=$True)][string]$exampleKind - ) - - return [string](($exampleKinds[$exampleKind] | %{$_.example}) -join "`n") -} - -function composeCases { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)]$examples - ) - - $private:cases = @() - $private:examplesDict = $examples | Group-Object -Property "test_id" | ForEach-Object -Begin {$Out=@{}} -Process {$Out[$_.Name]=$_.Group} -End {$Out} - - foreach($private:test_id in $private:examplesDict.Keys) { - - $private:exampleGroup = $private:examplesDict[$private:test_id] - $private:exampleKinds = $private:exampleGroup | Group-Object -Property "test_kind" | ForEach-Object -Begin {$Out=@{}} -Process {$Out[$_.Name]=$_.Group} -End {$Out} - - #??[bool]$validation = $private:exampleKinds.Keys -contains $Script:validate_dat_token -or $private:exampleKinds.Keys -contains $Script:validate_cmd_token - - # Parse command - [bool]$private:validate_command = $false - [string]$private:command = $private:exampleKinds[$Script:testin_token].example -replace '\\\n','' - if (!$private:command) { - if ($private:exampleKinds.Keys -contains $Script:validate_dat_token) { - $private:command = '$ ledger bal' - } else { - if ($private:exampleKinds.Keys -contains $Script:validate_cmd_token) { - $private:validate_command = $True - $private:command = $private:exampleKinds[$Script:validate_cmd_token].example - } else { - throw "None" - } - } - } - $private:command = $private:command.Trim() - if ($private:command.StartsWith("$")) { $private:command = $private:command.Substring(1).TrimStart() } +# Extracts Ledger examples from the original documentation (ledger3.texi) and builds Live Demo files +# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process + +[CmdletBinding()] +Param( + [Parameter(Mandatory=$False)][string]$ledgerTexiPath, + [Parameter(Mandatory=$False)][string]$ledgerHtmlPath, + [Parameter(Mandatory=$False)][string]$liveTemplatePath, + [Parameter(Mandatory=$False)][string]$liveHtmlPath, + [Parameter(Mandatory=$False)][string]$casesExportPath, + [Parameter(Mandatory=$False)][string]$testsFolder, + [Parameter(Mandatory=$False)][string]$testSandboxFolder, + [Parameter(Mandatory=$False)][string]$liveDemoConfig, + [Switch]$casesExport = $False +) + +[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path + +Import-Module $Script:ScriptPath\..\NLDoc.LiveDemo.psm1 -Force +$Script:demoSettings = Get-DefaultNLedgerLiveDemoSettings + +if (!$ledgerTexiPath) { $ledgerTexiPath = "$Script:ScriptPath\ledger3.texi" } +if (!$ledgerHtmlPath) { $ledgerHtmlPath = "$Script:ScriptPath\..\..\ledger3.html" } +if (!$liveTemplatePath) { $liveTemplatePath = "$Script:ScriptPath\NLDoc.LiveDemo.Extractor.templates" } +if (!$liveHtmlPath) { $liveHtmlPath = "$Script:ScriptPath\..\$($Script:demoSettings.demoFile)" } +if (!$casesExportPath) { $casesExportPath = "$Script:ScriptPath\ledger3.texi.xml" } +if (!$testsFolder) { $testsFolder = "$Script:ScriptPath\..\..\test\input\" } +if (!$testSandboxFolder) { $testSandboxFolder = "$Script:ScriptPath\..\..\test\nledger\sandbox\" } +if (!$liveDemoConfig) { $liveDemoConfig = "$Script:ScriptPath\..\$($Script:demoSettings.demoConfig)" } + +trap +{ + write-error $_ + exit 1 +} + +[int]$Script:current_line = 0 +[int]$Script:current_pos = 0 + +[string]$Script:testin_token = 'command' +[string]$Script:testout_token = 'output' +[string]$Script:testdat_token = 'input' +[string]$Script:testfile_token = 'file' +[string]$Script:validate_token = 'validate' +[string]$Script:validate_cmd_token = 'validate-command' +[string]$Script:validate_dat_token = 'validate-data' +[string]$Script:testwithdat_token = 'with_input' +[string]$Script:testwithfile_token = 'with_file' + +$Script:DisabledTests = @( + "Val-7660", # --pager /bin/cat - inappropriate path to a pager + "Val-5420", # ledger payees @Nic --file sample.dat - inappropriate data file (empty output even with original Leger) + "Val-7840", # $ ledger --file drewr3.dat --forecast "T>{\$-500.00}" register ^assets ^liabilities - RTE + "B4DFB9F") # $ ledger -f expr.dat --format "%(account) %(roundto(amount, 1))\n" reg - RTE + +function find_examples { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][string]$fileName + ) + + [string]$private:startexample = "^@smallexample\s+@c\s+($Script:testin_token|$Script:testout_token|$Script:testdat_token|$Script:testfile_token)(?::([\dA-Fa-f]+|validate))?(?:,(.*))?" + [string]$private:endexample = "^@end\s+smallexample\s*$" + + $Script:current_line = 0 + $Script:current_pos = 0 + $private:example = $null + $private:examples = @() + + foreach($line in Get-Content $fileName -Encoding UTF8) { + $Script:current_pos += ($line.length + ([Math]::Sign($Script:current_line) * 2)) + $Script:current_line += 1 + + # Detect the first line + if($line -match $private:startexample){ + if ($private:example -ne $null) { throw "Invalid operation: an example is not finished" } + + $private:example = [PsCustomObject]@{ + test_begin_pos = $Script:current_pos + test_begin_line = $Script:current_line + test_kind = $Matches[1] + test_id = $Matches[2] + test_options = @{} + example = "" + test_end_pos = $null + test_end_line = $null + } + + if ($Matches[3]) { + $Matches[3].Split(",") | ForEach-Object { + $private:kv = $_.Split(":") + $private:example.test_options[$private:kv[0].Trim()] = $private:kv[1].Trim() + } + } + } else { + # Detect the last line + if ($line -match $private:endexample) { + if ($private:example -ne $null) { # Only if getting an example is in progress + $private:example.test_end_pos = $Script:current_pos + $private:example.test_end_line = $Script:current_line + # Getting an example is finished; verification + if (!$private:example.test_id) { + Write-Warning "Example $($private:example.test_kind) in line $($private:example.test_begin_line) is missing id." | Out-Null + $private:example.test_id = get_test_id $private:example.example + if ($private:example.test_kind -eq $Script:testin_token) { + Write-Warning "Use $($private:example.test_id)" | Out-Null + } + } else { + if ($private:example.test_kind -eq $Script:testin_token -and $private:example.test_id -ne $Script:validate_token -and $private:example.test_id -ne (get_test_id $private:example.example)) { + Write-Warning "Expected test id $($private:example.test_id) for example $($private:example.test_kind) on line $($private:example.test_begin_line) to be $(get_test_id $private:example.example)" | Out-Null + } + } + if ($private:example.test_id -eq $Script:validate_token) { + $private:example.test_id = "Val-$($private:example.test_begin_line)" + if ($private:example.test_kind -eq $Script:testin_token) { + $private:example.test_kind = $Script:validate_cmd_token + } else { + if ($private:example.test_kind -eq $Script:testdat_token) { + $private:example.test_kind = $Script:validate_dat_token + } + } + } + # Example is OK + $private:examples += $private:example + $private:example = $null + } + } else { + # Detect whether getting an example is in progress + if ($private:example -ne $null) { + $private:lineValue = $line -replace '@([@{}])', '$1' + $private:example.example += "$private:lineValue`n" + } + } + } + } + + return $private:examples +} + +function get_test_id { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)][string]$example + ) + $private:enc = [system.Text.Encoding]::UTF8 + $private:data = $private:enc.GetBytes($example.TrimEnd()) + $private:sha1 = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider + $private:hash = $private:sha1.ComputeHash($private:data) + $private:stringHash = [BitConverter]::ToString($private:hash).Replace("-","").ToUpper() + return $private:stringHash.Substring(0,7) +} + +function get_Joined_Example { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)]$exampleKinds, + [Parameter(Mandatory=$True)][string]$exampleKind + ) + + return [string](($exampleKinds[$exampleKind] | %{$_.example}) -join "`n") +} + +function composeCases { + [CmdletBinding()] + Param( + [Parameter(Mandatory=$True)]$examples + ) + + $private:cases = @() + $private:examplesDict = $examples | Group-Object -Property "test_id" | ForEach-Object -Begin {$Out=@{}} -Process {$Out[$_.Name]=$_.Group} -End {$Out} + + foreach($private:test_id in $private:examplesDict.Keys) { + + $private:exampleGroup = $private:examplesDict[$private:test_id] + $private:exampleKinds = $private:exampleGroup | Group-Object -Property "test_kind" | ForEach-Object -Begin {$Out=@{}} -Process {$Out[$_.Name]=$_.Group} -End {$Out} + + #??[bool]$validation = $private:exampleKinds.Keys -contains $Script:validate_dat_token -or $private:exampleKinds.Keys -contains $Script:validate_cmd_token + + # Parse command + [bool]$private:validate_command = $false + [string]$private:command = $private:exampleKinds[$Script:testin_token].example -replace '\\\n','' + if (!$private:command) { + if ($private:exampleKinds.Keys -contains $Script:validate_dat_token) { + $private:command = '$ ledger bal' + } else { + if ($private:exampleKinds.Keys -contains $Script:validate_cmd_token) { + $private:validate_command = $True + $private:command = $private:exampleKinds[$Script:validate_cmd_token].example + } else { + throw "None" + } + } + } + $private:command = $private:command.Trim() + if ($private:command.StartsWith("$")) { $private:command = $private:command.Substring(1).TrimStart() } if ($private:command -match "\s\-f\s+([A-Za-z0-9.-]+)") { $private:fileName = $Matches[1] } else { if ($private:command -match "\s\-file\s+([A-Za-z0-9.-]+)") { $private:fileName = $Matches[1] } @@ -201,398 +201,398 @@ function composeCases { $private:command = "$private:command --file $private:fileName" } } - - # [DM] My fixes for commands - $private:command = $private:command.Replace("'d>[2011/04/01]'", '"d>[2011/04/01]"') - - # [DM] My assertions - if (!$private:command.StartsWith("ledger")) { throw "No ledger command" } - if ([string]::IsNullOrWhiteSpace($private:fileName)) { throw "No file name" } - - # Getting input/output - [string]$private:eoutput = get_Joined_Example -exampleKinds $private:exampleKinds -exampleKind $Script:testout_token - [string]$private:einput = get_Joined_Example -exampleKinds $private:exampleKinds -exampleKind $Script:testdat_token - if ([string]::IsNullOrWhiteSpace($private:einput)) { - $private:testinExample = $private:exampleKinds[$Script:testin_token] - if ($private:testinExample) { - $private:with_input = $private:testinExample.test_options[$Script:testwithdat_token] - if ($private:with_input) { - $private:iExampleKinds = $private:examplesDict[$private:with_input] | Group-Object -Property "test_kind" | ForEach-Object -Begin {$Out=@{}} -Process {$Out[$_.Name]=$_.Group} -End {$Out} - $private:einput = get_Joined_Example -exampleKinds $private:iExampleKinds -exampleKind $Script:testdat_token - } - } - if ([string]::IsNullOrWhiteSpace($private:einput)) { - $private:einput = get_Joined_Example -exampleKinds $private:exampleKinds -exampleKind $Script:validate_dat_token - } - } - - $private:case = [PsCustomObject]@{ - test_id = $private:test_id - command = $private:command - filename = $private:fileName - input = $private:einput.Trim() - output = $private:eoutput.Trim() - src = $private:exampleGroup - is_active = -not ($Script:DisabledTests -contains $private:test_id) - } - $private:cases += $private:case - } - - return $private:cases -} - -function exportCases { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$fileName, - [Parameter(Mandatory=$True)]$cases - ) - - [xml]$private:xml = [xml]'' - - foreach($private:case in $cases) { - $private:xmlCase = $private:xml.CreateElement("example") - - $private:xmlCase.SetAttribute("test-id", $private:case.test_id) | Out-Null - $private:xmlCase.SetAttribute("command", $private:case.command) | Out-Null - $private:xmlCase.SetAttribute("filename", $private:case.filename) | Out-Null - - if ($private:case.input) { - $private:xmlInput = $private:xml.CreateElement("input") - $private:xmlInput.InnerText = (EncodeESC $private:case.input) - $private:xmlCase.AppendChild($private:xmlInput) | Out-Null - } - - if ($private:case.output) { - $private:xmlOutput = $private:xml.CreateElement("output") - $private:xmlOutput.InnerText = (EncodeESC $private:case.output) - $private:xmlCase.AppendChild($private:xmlOutput) | Out-Null - } - - $private:xmlSrcCollection = $private:xml.CreateElement("src-collection") - $private:xmlCase.AppendChild($private:xmlSrcCollection) | Out-Null - foreach($private:src in $private:case.src) { - $private:xmlSrc = $private:xml.CreateElement("src") - $private:xmlSrc.SetAttribute("test_id", $private:src.test_id) | Out-Null - $private:xmlSrc.SetAttribute("test_kind", $private:src.test_kind) | Out-Null - $private:xmlSrc.SetAttribute("begin_pos", $private:src.test_begin_pos) | Out-Null - $private:xmlSrc.SetAttribute("begin_line", $private:src.test_begin_line) | Out-Null - $private:xmlSrc.SetAttribute("end_pos", $private:src.test_end_pos) | Out-Null - $private:xmlSrc.SetAttribute("end_line", $private:src.test_end_line) | Out-Null - - $private:xmlSrcOptions = $private:xml.CreateElement("options") - foreach($private:optName in $private:src.test_options.Keys) { - $private:xmlSrcOption = $private:xml.CreateElement("option") - $private:xmlSrcOption.SetAttribute("name", $private:optName) | Out-Null - $private:xmlSrcOption.SetAttribute("value", $private:src.test_options[$private:optName]) | Out-Null - $private:xmlSrcOptions.AppendChild($private:xmlSrcOption) | Out-Null - } - $private:xmlSrc.AppendChild($private:xmlSrcOptions) | Out-Null - - $private:xmlSrcText = $private:xml.CreateElement("text") - $private:xmlSrcText.InnerText = (EncodeESC $private:src.example) - $private:xmlSrc.AppendChild($private:xmlSrcText) - - $private:xmlSrcCollection.AppendChild($private:xmlSrc)| Out-Null - } - - - $private:xml.DocumentElement.AppendChild($private:xmlCase) | Out-Null - } - - $private:xml.Save($fileName) | Out-Null -} - -[string]$Script:Esc = [System.Text.Encoding]::UTF8.GetString(27) -function EncodeESC { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string][AllowEmptyString()]$inputText - ) - - if (!$inputText) { return $inputText } - - return $inputText.Replace($Script:Esc, "") # Since ESC code in not rendered in HTML, it is OK to remove it from export -} - -function buildFindCaseIndex { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)]$cases - ) - - $private:index = new-object System.Collections.Hashtable # @{} is not appropriate because of case insensitivity - - foreach($private:case in $cases) { - foreach($private:srcItem in $private:case.src) { - if ($private:srcItem.example) { - $private:key = $private:srcItem.example.Replace("`r`n", "`n").Trim() - if ($private:key) { - if (!$private:index.ContainsKey($private:key)) { - $private:index.Add($private:key, @( [PsCustomObject] @{ Case=$private:case; TestKind=$private:srcItem.test_kind } )) - } else { - $private:entry = $private:index[$private:key] - $private:entry += [PsCustomObject] @{ Case=$private:case; TestKind=$private:srcItem.test_kind } - } - } - } - } - } - - return $private:index -} - -function findCase { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)]$caseIndex, - [Parameter(Mandatory=$True)][string]$example, - [Parameter(Mandatory=$True)][string]$test_kind - ) - - $example = [System.Net.WebUtility]::HtmlDecode($example).Replace("`r`n", "`n").Replace("�$�","@samp{$}").Trim() - $private:entry = $caseIndex[$example] - if ($private:entry) { - foreach($private:entryItem in $private:entry) { - if ($private:entryItem.TestKind -eq $test_kind) { - return $private:entryItem.Case - } - } - } - - return $null -} - -function readTemplates { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$fileName - ) - - $private:content = Get-Content -Encoding UTF8 $fileName - - $private:templates = @{} - $private:templateName = $null - $private:template = "" - - foreach($private:row in $private:content) { - if ($private:row -match "^#TPL:\s*(\w+)\s*$") { - if ($private:templateName) { - $private:templates.Add($private:templateName,$private:template) - } - $private:templateName = $Matches[1] - $private:template = "" - } else { - $private:template += "$private:row`n" - } - } - if ($private:templateName) { - $private:templates.Add($private:templateName,$private:template) - } - return $private:templates -} - -function readHTML { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$fileName - ) - - return (Get-Content $fileName -Encoding UTF8 | Out-String) -} - -function saveHTML { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$html, - [Parameter(Mandatory=$True)][string]$fileName - ) - - Out-File -LiteralPath $fileName -Encoding utf8 -InputObject $html | Out-Null -} - -function findExamplesInHTML { - [CmdletBinding()] - Param( - [Parameter(Mandatory=$True)][string]$html, - [Parameter(Mandatory=$True)]$cases - ) - $private:regexPattern = '(?<=(
))(.|\r|\n)+?(?=(<\/pre>))'
-  $private:allMatches = (select-string -Pattern $private:regexPattern -InputObject $html -AllMatches | %{$_.Matches})
-
-  $private:foundExamples = @()
-  $private:foundCases = @()
-
-  $private:caseIndex = buildFindCaseIndex $cases
-
-  foreach($private:matchItem in $private:allMatches) {
-      $private:value = $private:matchItem.Value
-
-      $private:test_kind = $Script:testin_token
-      $private:case = findCase -caseIndex $private:caseIndex -example $private:value -test_kind $private:test_kind
-      if (!$private:case) { 
-           $private:test_kind = $Script:validate_cmd_token 
-           $private:case = findCase -caseIndex $private:caseIndex -example $private:value -test_kind $private:test_kind
-           if (!$private:case) { 
-                $private:test_kind = $Script:validate_dat_token 
-                $private:case = findCase -caseIndex $private:caseIndex -example $private:value -test_kind $private:test_kind
-                if (!$private:case) {
-                    $private:test_kind = $Script:testdat_token 
-                    $private:case = findCase -caseIndex $private:caseIndex -example $private:value -test_kind $private:test_kind
-                }
-           }
-      }
-
-      if ($private:case) {
-          $private:foundExamples += @{ Case=$private:case; TestKind=$private:test_kind; HtmlPre=$private:matchItem.Groups[1] }
-          $private:foundCases += $private:case
-      }
-  }
-
-  # Warn about not found cases
-  $private:notFoundCount = 0
-  foreach($private:notFoundCase in ($cases | ?{$private:foundCases -notcontains $_})) {
-    Write-Warning "Case $($private:notFoundCase.test_id) not found"
-    $private:notFoundCount++
-  }
-
-  Write-Verbose "All cases: $($cases.Count)"
-  Write-Verbose "Found: $($private:foundExamples.Count)"
-  Write-Verbose "Not Found: $private:notFoundCount"
-
-  return $private:foundExamples
-}
-
-function modifyHTML {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)][string]$html,
-    [Parameter(Mandatory=$True)]$foundExamples,
-    [Parameter(Mandatory=$True)][string]$templateName
-  )
-
-  $private:templates = readTemplates $templateName
-  $foundExamples = $foundExamples | ?{$_.Case.is_active}
-
-  #Replace found elements
-
-  $private:htmlPre = $private:templates["htmlPre"].Trim()
-  for($private:index=$foundExamples.Count-1;$private:index -ge 0; $private:index--) {
-    $private:found = $foundExamples[$private:index]
-    $private:pre = $private:htmlPre.Replace('$test_id', $private:found.Case.test_id).Replace('$test_kind', $private:found.TestKind)
-    $html = $html.Remove($private:found.HtmlPre.Index,$private:found.HtmlPre.Length).Insert($private:found.HtmlPre.Index,$private:pre)
-  }
-
-  # add extra styles
-  $private:styles = $private:templates["styles"].Trim()
-  $html = $html -replace "<\/style>","$private:styles`n"
-
-  # add java scripts
-
-  $private:javascript = $private:templates["javascript"].Trim()
-  $html = $html -replace "<\/head>","`n"
-
-  # add html
-
-  $private:foreachExample = $private:templates["foreachExample"].Trim()
-  [string]$private:foreachExamples = ""
-  foreach($private:foundExample in $foundExamples) { 
-    $private:foundExampleItem = $private:foreachExample.Replace('$test_id', $private:foundExample.Case.test_id).Replace('$test_kind', $private:foundExample.TestKind).Replace('$command', [System.Net.WebUtility]::HtmlEncode($private:foundExample.Case.command).Trim())
-    $private:foreachExamples += "$private:foundExampleItem`n"
-  }
-
-  $private:htmlBody = $private:templates["htmlBody"].Replace('$foreachExample', $private:foreachExamples)
-  if ($html -match '') { $html = $html -replace '',"$($Matches[0])$private:htmlBody" } else { throw "expected htmlBody" }
-
-  $private:htmlEndBody = $private:templates["htmlEndBody"].Trim()
-  $html = $html -replace '<\/body>',"$private:htmlEndBody`n"
-
-  return $html
-}
-
-function collectDataFiles {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)]$foundExamples,
-    [Parameter(Mandatory=$True)][string]$testFolder,
-    [Parameter(Mandatory=$True)][string]$localFolder
-  )
-
-  $private:files = @{}
-
-  foreach($private:case in ($foundExamples | %{$_.Case})) {
-    [string]$private:fileName = $private:case.filename
-    [string]$private:test_id = $private:case.test_id
-
-    [string]$private:filePath = "$testFolder\$private:fileName"
-    if (!(Test-Path -LiteralPath $private:filePath -PathType Leaf)) {
-        $private:filePath = "$localFolder\$private:fileName"
-        if (!(Test-Path -LiteralPath $private:filePath -PathType Leaf)) {
-              if ([string]::IsNullOrWhiteSpace($private:case.input)) {
-                    Write-Warning "Attempt to write an empty input [$private:filePath $private:test_id]"
-                    $private:case.is_active = $False
-                    continue
-              }
-              Out-File -LiteralPath $private:filePath -Encoding utf8 -InputObject $private:case.input | Out-Null
-        } else {
-            $private:existingContent = (Get-Content -LiteralPath $private:filePath -Encoding utf8 | Out-String).Replace("`r`n", "`n").Trim()
-            $private:caseContent = $private:case.input.Trim()
-            if ($private:existingContent -ne $private:caseContent) {
-                for($private:index=0; $private:index -lt $private:existingContent.Length -and $private:index -lt $private:caseContent.Length; $private:index++) {
-                    if ($private:existingContent[$private:index] -ne $private:caseContent[$private:index]) {
-                        Write-Warning "'$([int]$private:existingContent[$private:index])' vs '$([int]$private:caseContent[$private:index])' - index $private:index [$private:filePath $private:test_id]"
-                        break
-                    }
-                }
-                if ($private:existingContent.Length -ne $private:caseContent.Length) { Write-Warning "Different file sizes [$private:filePath $private:test_id]" }
-                # It is necessary to set another file name for given case
-                $private:fileName = "$($private:case.test_id).dat"
-                $private:filePath = "$localFolder\$private:fileName"
-                $private:case.command = $private:case.command.Replace($private:case.filename, $private:fileName)
-                $private:case.filename = $private:fileName
-                Out-File -LiteralPath $private:filePath -Encoding utf8 -InputObject $private:case.input | Out-Null
-            }
-        }
-    }
-
-    $private:files[$private:case.filename] = $private:filePath
-  }
-
-  return $private:files
-}
-
-function saveLiveDemoConfiguration {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)]$files,
-    [Parameter(Mandatory=$True)]$foundExamples,
-    [Parameter(Mandatory=$True)][string]$liveDemoConfig
-  )
-
-  $private:contribRootPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath\..\..")
-
-  $private:demoFiles= @{}
-  foreach($private:file in $files.Keys) {
-    $private:absFilePath = [System.IO.Path]::GetFullPath($files[$private:file])
-    $private:relativePath = $private:absFilePath.Remove(0, $private:contribRootPath.Length).Insert(0, "..")
-    $private:demoFiles.Add($private:file, $private:relativePath)
-  }
-
-  $private:demoCases = $foundExamples | ?{$_.Case.is_active} | %{ [PsCustomObject] @{
-    TestID = $_.Case.test_id
-    Command = $_.Case.command
-    FileName = $_.Case.filename
-  } }
-
-  WriteDemoConfig -demoFiles $private:demoFiles -demoCases $private:demoCases -fileName $liveDemoConfig | Out-Null
-}
-
-$examples = find_examples -fileName $ledgerTexiPath
-$cases = composeCases $examples
-if ($casesExport) { exportCases -fileName $casesExportPath -cases $cases | Out-Null }
-$htmlSource = readHTML $ledgerHtmlPath
-$foundExamples = findExamplesInHTML -html $htmlSource -cases $cases
-$files = collectDataFiles -foundExamples $foundExamples -testFolder $testsFolder -localFolder $testSandboxFolder
-$htmlSource = modifyHTML -html $htmlSource -foundExamples $foundExamples -templateName $liveTemplatePath
-saveHTML -html $htmlSource -fileName $liveHtmlPath | Out-Null
+
+    # [DM] My fixes for commands
+    $private:command = $private:command.Replace("'d>[2011/04/01]'", '"d>[2011/04/01]"')
+
+    # [DM] My assertions
+    if (!$private:command.StartsWith("ledger")) { throw "No ledger command" }
+    if ([string]::IsNullOrWhiteSpace($private:fileName)) { throw "No file name" }
+
+    # Getting input/output
+    [string]$private:eoutput = get_Joined_Example -exampleKinds $private:exampleKinds -exampleKind $Script:testout_token
+    [string]$private:einput = get_Joined_Example -exampleKinds $private:exampleKinds -exampleKind $Script:testdat_token
+    if ([string]::IsNullOrWhiteSpace($private:einput)) {
+        $private:testinExample = $private:exampleKinds[$Script:testin_token]
+        if ($private:testinExample) {
+            $private:with_input = $private:testinExample.test_options[$Script:testwithdat_token]
+            if ($private:with_input) {
+                $private:iExampleKinds = $private:examplesDict[$private:with_input] | Group-Object -Property "test_kind" | ForEach-Object -Begin {$Out=@{}} -Process {$Out[$_.Name]=$_.Group} -End {$Out}
+                $private:einput = get_Joined_Example -exampleKinds $private:iExampleKinds -exampleKind $Script:testdat_token
+            }
+        }
+        if ([string]::IsNullOrWhiteSpace($private:einput)) {
+            $private:einput = get_Joined_Example -exampleKinds $private:exampleKinds -exampleKind $Script:validate_dat_token
+        }
+    }
+
+    $private:case = [PsCustomObject]@{
+        test_id = $private:test_id
+        command = $private:command
+        filename = $private:fileName
+        input = $private:einput.Trim()
+        output = $private:eoutput.Trim()
+        src = $private:exampleGroup
+        is_active = -not ($Script:DisabledTests -contains $private:test_id)
+    }
+    $private:cases += $private:case
+  }
+
+  return $private:cases
+}
+
+function exportCases {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)][string]$fileName,
+    [Parameter(Mandatory=$True)]$cases
+  )
+
+  [xml]$private:xml = [xml]''
+
+  foreach($private:case in $cases) {
+    $private:xmlCase = $private:xml.CreateElement("example")
+    
+    $private:xmlCase.SetAttribute("test-id", $private:case.test_id) | Out-Null
+    $private:xmlCase.SetAttribute("command", $private:case.command) | Out-Null
+    $private:xmlCase.SetAttribute("filename", $private:case.filename) | Out-Null
+
+    if ($private:case.input) {
+        $private:xmlInput = $private:xml.CreateElement("input")
+        $private:xmlInput.InnerText = (EncodeESC $private:case.input)
+        $private:xmlCase.AppendChild($private:xmlInput) | Out-Null
+    }
+
+    if ($private:case.output) {
+        $private:xmlOutput = $private:xml.CreateElement("output")
+        $private:xmlOutput.InnerText = (EncodeESC $private:case.output)
+        $private:xmlCase.AppendChild($private:xmlOutput) | Out-Null
+    }
+    
+    $private:xmlSrcCollection = $private:xml.CreateElement("src-collection")
+    $private:xmlCase.AppendChild($private:xmlSrcCollection) | Out-Null               
+    foreach($private:src in $private:case.src) {
+        $private:xmlSrc = $private:xml.CreateElement("src")
+        $private:xmlSrc.SetAttribute("test_id", $private:src.test_id) | Out-Null
+        $private:xmlSrc.SetAttribute("test_kind", $private:src.test_kind) | Out-Null
+        $private:xmlSrc.SetAttribute("begin_pos", $private:src.test_begin_pos) | Out-Null
+        $private:xmlSrc.SetAttribute("begin_line", $private:src.test_begin_line) | Out-Null
+        $private:xmlSrc.SetAttribute("end_pos", $private:src.test_end_pos) | Out-Null
+        $private:xmlSrc.SetAttribute("end_line", $private:src.test_end_line) | Out-Null
+
+        $private:xmlSrcOptions = $private:xml.CreateElement("options")
+        foreach($private:optName in $private:src.test_options.Keys) {
+            $private:xmlSrcOption = $private:xml.CreateElement("option")
+            $private:xmlSrcOption.SetAttribute("name", $private:optName) | Out-Null
+            $private:xmlSrcOption.SetAttribute("value", $private:src.test_options[$private:optName]) | Out-Null
+            $private:xmlSrcOptions.AppendChild($private:xmlSrcOption) | Out-Null
+        }
+        $private:xmlSrc.AppendChild($private:xmlSrcOptions) | Out-Null
+
+        $private:xmlSrcText = $private:xml.CreateElement("text")
+        $private:xmlSrcText.InnerText = (EncodeESC $private:src.example)
+        $private:xmlSrc.AppendChild($private:xmlSrcText)
+
+        $private:xmlSrcCollection.AppendChild($private:xmlSrc)| Out-Null
+    }
+
+
+    $private:xml.DocumentElement.AppendChild($private:xmlCase) | Out-Null
+  }
+
+  $private:xml.Save($fileName) | Out-Null
+}
+
+[string]$Script:Esc = [System.Text.Encoding]::UTF8.GetString(27)
+function EncodeESC {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)][string][AllowEmptyString()]$inputText
+  )
+
+  if (!$inputText) { return $inputText }
+
+  return $inputText.Replace($Script:Esc, "")  # Since ESC code in not rendered in HTML, it is OK to remove it from export
+}
+
+function buildFindCaseIndex {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)]$cases
+  )
+
+  $private:index = new-object System.Collections.Hashtable # @{} is not appropriate because of case insensitivity
+
+  foreach($private:case in $cases) {
+    foreach($private:srcItem in $private:case.src) {
+      if ($private:srcItem.example) {
+          $private:key = $private:srcItem.example.Replace("`r`n", "`n").Trim()
+          if ($private:key) {
+              if (!$private:index.ContainsKey($private:key)) {
+                 $private:index.Add($private:key, @( [PsCustomObject] @{ Case=$private:case; TestKind=$private:srcItem.test_kind } ))
+              } else {
+                 $private:entry = $private:index[$private:key]
+                 $private:entry += [PsCustomObject] @{ Case=$private:case; TestKind=$private:srcItem.test_kind }
+              }
+          }
+      }
+    }
+  }
+
+  return $private:index
+}
+
+function findCase {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)]$caseIndex,
+    [Parameter(Mandatory=$True)][string]$example,
+    [Parameter(Mandatory=$True)][string]$test_kind
+  )
+
+  $example = [System.Net.WebUtility]::HtmlDecode($example).Replace("`r`n", "`n").Replace("�$�","@samp{$}").Trim()
+  $private:entry = $caseIndex[$example]
+  if ($private:entry) {
+        foreach($private:entryItem in $private:entry) {
+            if ($private:entryItem.TestKind -eq $test_kind) {
+                return $private:entryItem.Case
+            }
+        }
+  }
+
+  return $null
+}
+
+function readTemplates {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)][string]$fileName
+  )
+
+  $private:content = Get-Content -Encoding UTF8 $fileName
+
+  $private:templates = @{}
+  $private:templateName = $null
+  $private:template = ""
+
+  foreach($private:row in $private:content) {
+    if ($private:row -match "^#TPL:\s*(\w+)\s*$") {
+        if ($private:templateName) {
+            $private:templates.Add($private:templateName,$private:template)
+        }
+        $private:templateName = $Matches[1]
+        $private:template = ""
+    } else {
+        $private:template += "$private:row`n"
+    }
+  }
+  if ($private:templateName) {
+      $private:templates.Add($private:templateName,$private:template)
+  }
+  return $private:templates
+}
+
+function readHTML {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)][string]$fileName
+  )
+
+  return (Get-Content $fileName -Encoding UTF8 | Out-String)
+}
+
+function saveHTML {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)][string]$html,
+    [Parameter(Mandatory=$True)][string]$fileName
+  )
+
+  Out-File -LiteralPath $fileName -Encoding utf8 -InputObject $html | Out-Null
+}
+
+function findExamplesInHTML {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)][string]$html,
+    [Parameter(Mandatory=$True)]$cases
+  )
+  $private:regexPattern = '(?<=(
))(.|\r|\n)+?(?=(<\/pre>))'
+  $private:allMatches = (select-string -Pattern $private:regexPattern -InputObject $html -AllMatches | %{$_.Matches})
+
+  $private:foundExamples = @()
+  $private:foundCases = @()
+
+  $private:caseIndex = buildFindCaseIndex $cases
+
+  foreach($private:matchItem in $private:allMatches) {
+      $private:value = $private:matchItem.Value
+
+      $private:test_kind = $Script:testin_token
+      $private:case = findCase -caseIndex $private:caseIndex -example $private:value -test_kind $private:test_kind
+      if (!$private:case) { 
+           $private:test_kind = $Script:validate_cmd_token 
+           $private:case = findCase -caseIndex $private:caseIndex -example $private:value -test_kind $private:test_kind
+           if (!$private:case) { 
+                $private:test_kind = $Script:validate_dat_token 
+                $private:case = findCase -caseIndex $private:caseIndex -example $private:value -test_kind $private:test_kind
+                if (!$private:case) {
+                    $private:test_kind = $Script:testdat_token 
+                    $private:case = findCase -caseIndex $private:caseIndex -example $private:value -test_kind $private:test_kind
+                }
+           }
+      }
+
+      if ($private:case) {
+          $private:foundExamples += @{ Case=$private:case; TestKind=$private:test_kind; HtmlPre=$private:matchItem.Groups[1] }
+          $private:foundCases += $private:case
+      }
+  }
+
+  # Warn about not found cases
+  $private:notFoundCount = 0
+  foreach($private:notFoundCase in ($cases | ?{$private:foundCases -notcontains $_})) {
+    Write-Warning "Case $($private:notFoundCase.test_id) not found"
+    $private:notFoundCount++
+  }
+
+  Write-Verbose "All cases: $($cases.Count)"
+  Write-Verbose "Found: $($private:foundExamples.Count)"
+  Write-Verbose "Not Found: $private:notFoundCount"
+
+  return $private:foundExamples
+}
+
+function modifyHTML {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)][string]$html,
+    [Parameter(Mandatory=$True)]$foundExamples,
+    [Parameter(Mandatory=$True)][string]$templateName
+  )
+
+  $private:templates = readTemplates $templateName
+  $foundExamples = $foundExamples | ?{$_.Case.is_active}
+
+  #Replace found elements
+
+  $private:htmlPre = $private:templates["htmlPre"].Trim()
+  for($private:index=$foundExamples.Count-1;$private:index -ge 0; $private:index--) {
+    $private:found = $foundExamples[$private:index]
+    $private:pre = $private:htmlPre.Replace('$test_id', $private:found.Case.test_id).Replace('$test_kind', $private:found.TestKind)
+    $html = $html.Remove($private:found.HtmlPre.Index,$private:found.HtmlPre.Length).Insert($private:found.HtmlPre.Index,$private:pre)
+  }
+
+  # add extra styles
+  $private:styles = $private:templates["styles"].Trim()
+  $html = $html -replace "<\/style>","$private:styles`n"
+
+  # add java scripts
+
+  $private:javascript = $private:templates["javascript"].Trim()
+  $html = $html -replace "<\/head>","`n"
+
+  # add html
+
+  $private:foreachExample = $private:templates["foreachExample"].Trim()
+  [string]$private:foreachExamples = ""
+  foreach($private:foundExample in $foundExamples) { 
+    $private:foundExampleItem = $private:foreachExample.Replace('$test_id', $private:foundExample.Case.test_id).Replace('$test_kind', $private:foundExample.TestKind).Replace('$command', [System.Net.WebUtility]::HtmlEncode($private:foundExample.Case.command).Trim())
+    $private:foreachExamples += "$private:foundExampleItem`n"
+  }
+
+  $private:htmlBody = $private:templates["htmlBody"].Replace('$foreachExample', $private:foreachExamples)
+  if ($html -match '') { $html = $html -replace '',"$($Matches[0])$private:htmlBody" } else { throw "expected htmlBody" }
+
+  $private:htmlEndBody = $private:templates["htmlEndBody"].Trim()
+  $html = $html -replace '<\/body>',"$private:htmlEndBody`n"
+
+  return $html
+}
+
+function collectDataFiles {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)]$foundExamples,
+    [Parameter(Mandatory=$True)][string]$testFolder,
+    [Parameter(Mandatory=$True)][string]$localFolder
+  )
+
+  $private:files = @{}
+
+  foreach($private:case in ($foundExamples | %{$_.Case})) {
+    [string]$private:fileName = $private:case.filename
+    [string]$private:test_id = $private:case.test_id
+
+    [string]$private:filePath = "$testFolder\$private:fileName"
+    if (!(Test-Path -LiteralPath $private:filePath -PathType Leaf)) {
+        $private:filePath = "$localFolder\$private:fileName"
+        if (!(Test-Path -LiteralPath $private:filePath -PathType Leaf)) {
+              if ([string]::IsNullOrWhiteSpace($private:case.input)) {
+                    Write-Warning "Attempt to write an empty input [$private:filePath $private:test_id]"
+                    $private:case.is_active = $False
+                    continue
+              }
+              Out-File -LiteralPath $private:filePath -Encoding utf8 -InputObject $private:case.input | Out-Null
+        } else {
+            $private:existingContent = (Get-Content -LiteralPath $private:filePath -Encoding utf8 | Out-String).Replace("`r`n", "`n").Trim()
+            $private:caseContent = $private:case.input.Trim()
+            if ($private:existingContent -ne $private:caseContent) {
+                for($private:index=0; $private:index -lt $private:existingContent.Length -and $private:index -lt $private:caseContent.Length; $private:index++) {
+                    if ($private:existingContent[$private:index] -ne $private:caseContent[$private:index]) {
+                        Write-Warning "'$([int]$private:existingContent[$private:index])' vs '$([int]$private:caseContent[$private:index])' - index $private:index [$private:filePath $private:test_id]"
+                        break
+                    }
+                }
+                if ($private:existingContent.Length -ne $private:caseContent.Length) { Write-Warning "Different file sizes [$private:filePath $private:test_id]" }
+                # It is necessary to set another file name for given case
+                $private:fileName = "$($private:case.test_id).dat"
+                $private:filePath = "$localFolder\$private:fileName"
+                $private:case.command = $private:case.command.Replace($private:case.filename, $private:fileName)
+                $private:case.filename = $private:fileName
+                Out-File -LiteralPath $private:filePath -Encoding utf8 -InputObject $private:case.input | Out-Null
+            }
+        }
+    }
+
+    $private:files[$private:case.filename] = $private:filePath
+  }
+
+  return $private:files
+}
+
+function saveLiveDemoConfiguration {
+  [CmdletBinding()]
+  Param(
+    [Parameter(Mandatory=$True)]$files,
+    [Parameter(Mandatory=$True)]$foundExamples,
+    [Parameter(Mandatory=$True)][string]$liveDemoConfig
+  )
+
+  $private:contribRootPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath\..\..")
+
+  $private:demoFiles= @{}
+  foreach($private:file in $files.Keys) {
+    $private:absFilePath = [System.IO.Path]::GetFullPath($files[$private:file])
+    $private:relativePath = $private:absFilePath.Remove(0, $private:contribRootPath.Length).Insert(0, "..")
+    $private:demoFiles.Add($private:file, $private:relativePath)
+  }
+
+  $private:demoCases = $foundExamples | ?{$_.Case.is_active} | %{ [PsCustomObject] @{
+    TestID = $_.Case.test_id
+    Command = $_.Case.command
+    FileName = $_.Case.filename
+  } }
+
+  Write-NLedgerLiveDemoConfig -demoFiles $private:demoFiles -demoCases $private:demoCases -fileName $liveDemoConfig | Out-Null
+}
+
+$examples = find_examples -fileName $ledgerTexiPath
+$cases = composeCases $examples
+if ($casesExport) { exportCases -fileName $casesExportPath -cases $cases | Out-Null }
+$htmlSource = readHTML $ledgerHtmlPath
+$foundExamples = findExamplesInHTML -html $htmlSource -cases $cases
+$files = collectDataFiles -foundExamples $foundExamples -testFolder $testsFolder -localFolder $testSandboxFolder
+$htmlSource = modifyHTML -html $htmlSource -foundExamples $foundExamples -templateName $liveTemplatePath
+saveHTML -html $htmlSource -fileName $liveHtmlPath | Out-Null
 saveLiveDemoConfiguration -files $files -foundExamples $foundExamples -liveDemoConfig $liveDemoConfig | Out-Null
\ No newline at end of file
diff --git a/Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.templates b/Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.templates
similarity index 96%
rename from Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.templates
rename to Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.templates
index 5dfab740..0279714e 100644
--- a/Contrib/NLManagement/NonDeliverable/NLDoc.LiveDemo.Extractor.templates
+++ b/Contrib/LiveDemo/NonDeliverable/NLDoc.LiveDemo.Extractor.templates
@@ -1,308 +1,308 @@
-#TPL:styles
-
-/* Left and content pane */
-
-.leftPane {
-    left: 0px; 
-    top: 0px; 
-    width: 320px; 
-    height: 100%; 
-    overflow: auto; 
-    position: fixed; 
-    background-color: lightblue;
-}
-
-.leftPane h3 {
-    font-family: "Arial";
-    font-size: small;
-    color: #618685;
-    margin: 5px;
-}
-
-.leftPane div {
-    padding-left: 5px;
-    padding-right: 2px;
-    padding-top: 1px;
-    padding-bottom: 1px;
-    font-family: "Consolas";
-    font-size: smaller;
-    cursor: pointer;
-    border-top: 1px solid #67b2e4;
-}
-
-.leftPane div:hover {
-    background-color: #3498DB;
-}
-
-.contentPane {
-    margin-left:320px;
-}
-
-.introPane {
-    background-color: lightblue;
-    margin: -8px;
-    margin-top: -19px;
-    font-family: "Arial";
-    font-size: small;
-    padding-bottom: 1px;
-    border-bottom: 1px solid gray;
-}
-
-.introPane h3 {
-    padding-top: 10px;
-    padding-left: 5px;
-}
-
-.introPane p {
-    padding-left: 5px;
-}
-
-.introAct {
-    color: Blue;
-    font-size: small;
-    color: darkblue;
-}
-
-/* Action button */
-
-.dropbtn {
-    background-color: #3498DB;
-    color: white;
-    padding: 10px;
-    font-size: 16px;
-    border: none;
-    cursor: pointer;
-    position: absolute;
-    margin-left: -82px;
-    margin-top: -7px;
-}
-
-.dropbtn:hover /*, .dropbtn:focus */ {
-    background-color: #2980B9;
-}
-
-.executable {
-    /* background-color:lightblue; */
-    padding:7px;
-    padding-left: 7px;
-    min-height: 25px;
-}
-
-/* test_kind background colorization */
-
-.command, .validate-command {
-    background-color:lightblue;
-}
-
-.input, .validate-data {
-    background-color:#e3e6ad;
-}
-
-/* End of test_kind background colorization */
-
-div.smallexample {
-    margin-left: 77px;
-}
-
-.btnFlash {
-    background-color:#2980B9;
-}
-
-.liFlash {
-    background-color:#67b2e4;
-}
-
-/* Dropdown */
-
-.dropdown {
-    position: relative;
-    display: inline-block;
-}
-
-.dropdown-content {
-    display: none;
-    position: absolute;
-    background-color: #67b2e4;
-    border: 1px solid lightblue;
-    min-width: 160px;
-    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
-    z-index: 1;
-}
-
-.dropdown-content a {
-    color: black;
-    padding: 10px 16px;
-    text-decoration: none;
-    display: block;
-    font-family: "Arial";
-}
-
-.dropdown-content a:hover {
-    background-color: #2980B9;
-    cursor: pointer;
-}
-
-.show {display:block;} 
-
-/* Copy action */
-
-.visually-hidden{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal}
-
-#TPL:javascript
-
-var clipboardCopySupported = document.queryCommandSupported && document.queryCommandSupported("copy");
-function clipboardCopy(text) {
-    if (!clipboardCopySupported) {
-        return false;
-    }
-    var txt = document.createElement("textarea");
-    txt.textContent = text;
-    txt.classList.add("visually-hidden");
-    document.body.appendChild(txt);
-    txt.select();
-    try {
-        return document.execCommand("copy");
-    } catch (ex) {
-        return false;
-    } finally {
-        document.body.removeChild(txt);
-    }
-}
-
-// Communicates with demo console process
-function callConsole(cmd) {
-  var xhttp = new XMLHttpRequest();
-  xhttp.onreadystatechange = function() {
-    if (this.readyState == 4 && this.status == 200) {
-      //TODO this.responseText;
-    }
-  };
-  xhttp.open("GET", cmd, true);
-  xhttp.send();
-}
-
-function runAction(a) {
-    callConsole("act."+a.id+"."+a.dataset["testid"]);
-}
-
-function runCopy(a) {
-    var li = document.getElementById("li_"+a.dataset["testid"]+"_"+a.dataset["testkind"]);
-    clipboardCopy(li.innerText);
-}
-
-function openActions(btn) {
-    var testid=btn.dataset["testid"];
-    var testkind=btn.dataset["testkind"];
-
-    var ddActions = document.getElementById("ddActions");
-    var li = document.getElementById("li_"+testid+"_"+testkind);
-
-    if (ddActions.classList.contains("show")) {
-      ddActions.classList.remove("show");
-      li.classList.remove("liFlash");
-    } else {
-      ddActions.style.position = "absolute";
-      ddActions.style.left = btn.offsetLeft + "px";
-      ddActions.style.top = /* 1 + */ (btn.offsetTop + btn.clientHeight) + "px";
-      
-      ddActions.classList.add("show");
-      ddActions.dataset["testid"] = testid;
-      ddActions.dataset["testkind"] = testkind;
-
-      document.getElementById("actRun").dataset["testid"] = testid;
-      document.getElementById("actCopy").dataset["testid"] = testid;
-      document.getElementById("actCopy").dataset["testkind"] = testkind;
-      document.getElementById("actEdit").dataset["testid"] = testid;
-      document.getElementById("actOpen").dataset["testid"] = testid;
-      document.getElementById("actRevert").dataset["testid"] = testid;
-
-      li.classList.add("liFlash");
-
-      var pane = document.getElementsByClassName("leftPane")[0];
-      var liRect = li.getBoundingClientRect()
-      if (liRect.top < 0) {
-         pane.scrollTop += liRect.top;
-      } else {
-         var paneRect = pane.getBoundingClientRect();
-         if (liRect.top > paneRect.height) {
-            pane.scrollTop += (liRect.top + liRect.height - paneRect.height);
-         }
-      }
-    }
-}
-
-function scrTo(li) {
-    var testid=li.dataset["testid"];
-    var testkind=li.dataset["testkind"];
-    var btn=document.getElementById("btn_"+testid+"_"+testkind);
-    if (btn) {
-        var elementRect = btn.getBoundingClientRect();
-        var absoluteElementTop = elementRect.top + window.pageYOffset;
-        var middle = absoluteElementTop - (window.innerHeight / 2); 
-        window.scrollTo(0, middle);
-
-        //Blink
-        btn.classList.add("btnFlash");
-        setTimeout(function() { btn.classList.remove("btnFlash"); }, 300);
-
-        return;
-    }
-}
-
-// Close the dropdown if the user clicks outside of it
-window.onclick = function(event) {
-  if (event.target.className!="dropbtn") {
-    var ddActions = document.getElementById("ddActions");
-    ddActions.classList.remove('show');
-
-    var testid=ddActions.dataset["testid"];
-    var testkind=ddActions.dataset["testkind"];
-
-    var li=document.getElementById("li_"+testid+"_"+testkind);
-    if (li) { li.classList.remove("liFlash"); }
-  }
-}
-
-// Stop the demo process when the page is closing
-window.onunload = function(event) { callConsole('shutdown'); }
-
-#TPL:htmlBody
-
-
-
-
-

Quick Navigation

-$foreachExample -
-
- -
-

Welcome to Ledger Live Examples!

-

This page makes examples in the original Ledger documentation alive. You can run any example and observe the result in a command line console. You can type the command again with another parameters and see how Ledger reacts. -You can review corresponded data files; you can make any changes in them and you can restore the original state at any time. Everything is alive and everything is safe! -

-

Every example is preceded by Action button. It gives you the options: Run the command; Copy the command text to clipboard; -Edit data file in a text editor; Open the folder containing data files and select the file; Revert the data file to the original state. -All data files are located in NLedger\Sandbox that is in your Documents folder, so you can safely make any changes in them. -

- -
- -#TPL:foreachExample - -
$command
- -#TPL:htmlEndBody - -
- -#TPL:htmlPre - -

-
+#TPL:styles
+
+/* Left and content pane */
+
+.leftPane {
+    left: 0px; 
+    top: 0px; 
+    width: 320px; 
+    height: 100%; 
+    overflow: auto; 
+    position: fixed; 
+    background-color: lightblue;
+}
+
+.leftPane h3 {
+    font-family: "Arial";
+    font-size: small;
+    color: #618685;
+    margin: 5px;
+}
+
+.leftPane div {
+    padding-left: 5px;
+    padding-right: 2px;
+    padding-top: 1px;
+    padding-bottom: 1px;
+    font-family: "Consolas";
+    font-size: smaller;
+    cursor: pointer;
+    border-top: 1px solid #67b2e4;
+}
+
+.leftPane div:hover {
+    background-color: #3498DB;
+}
+
+.contentPane {
+    margin-left:320px;
+}
+
+.introPane {
+    background-color: lightblue;
+    margin: -8px;
+    margin-top: -19px;
+    font-family: "Arial";
+    font-size: small;
+    padding-bottom: 1px;
+    border-bottom: 1px solid gray;
+}
+
+.introPane h3 {
+    padding-top: 10px;
+    padding-left: 5px;
+}
+
+.introPane p {
+    padding-left: 5px;
+}
+
+.introAct {
+    color: Blue;
+    font-size: small;
+    color: darkblue;
+}
+
+/* Action button */
+
+.dropbtn {
+    background-color: #3498DB;
+    color: white;
+    padding: 10px;
+    font-size: 16px;
+    border: none;
+    cursor: pointer;
+    position: absolute;
+    margin-left: -82px;
+    margin-top: -7px;
+}
+
+.dropbtn:hover /*, .dropbtn:focus */ {
+    background-color: #2980B9;
+}
+
+.executable {
+    /* background-color:lightblue; */
+    padding:7px;
+    padding-left: 7px;
+    min-height: 25px;
+}
+
+/* test_kind background colorization */
+
+.command, .validate-command {
+    background-color:lightblue;
+}
+
+.input, .validate-data {
+    background-color:#e3e6ad;
+}
+
+/* End of test_kind background colorization */
+
+div.smallexample {
+    margin-left: 77px;
+}
+
+.btnFlash {
+    background-color:#2980B9;
+}
+
+.liFlash {
+    background-color:#67b2e4;
+}
+
+/* Dropdown */
+
+.dropdown {
+    position: relative;
+    display: inline-block;
+}
+
+.dropdown-content {
+    display: none;
+    position: absolute;
+    background-color: #67b2e4;
+    border: 1px solid lightblue;
+    min-width: 160px;
+    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
+    z-index: 1;
+}
+
+.dropdown-content a {
+    color: black;
+    padding: 10px 16px;
+    text-decoration: none;
+    display: block;
+    font-family: "Arial";
+}
+
+.dropdown-content a:hover {
+    background-color: #2980B9;
+    cursor: pointer;
+}
+
+.show {display:block;} 
+
+/* Copy action */
+
+.visually-hidden{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal}
+
+#TPL:javascript
+
+var clipboardCopySupported = document.queryCommandSupported && document.queryCommandSupported("copy");
+function clipboardCopy(text) {
+    if (!clipboardCopySupported) {
+        return false;
+    }
+    var txt = document.createElement("textarea");
+    txt.textContent = text;
+    txt.classList.add("visually-hidden");
+    document.body.appendChild(txt);
+    txt.select();
+    try {
+        return document.execCommand("copy");
+    } catch (ex) {
+        return false;
+    } finally {
+        document.body.removeChild(txt);
+    }
+}
+
+// Communicates with demo console process
+function callConsole(cmd) {
+  var xhttp = new XMLHttpRequest();
+  xhttp.onreadystatechange = function() {
+    if (this.readyState == 4 && this.status == 200) {
+      //TODO this.responseText;
+    }
+  };
+  xhttp.open("GET", cmd, true);
+  xhttp.send();
+}
+
+function runAction(a) {
+    callConsole("act."+a.id+"."+a.dataset["testid"]);
+}
+
+function runCopy(a) {
+    var li = document.getElementById("li_"+a.dataset["testid"]+"_"+a.dataset["testkind"]);
+    clipboardCopy(li.innerText);
+}
+
+function openActions(btn) {
+    var testid=btn.dataset["testid"];
+    var testkind=btn.dataset["testkind"];
+
+    var ddActions = document.getElementById("ddActions");
+    var li = document.getElementById("li_"+testid+"_"+testkind);
+
+    if (ddActions.classList.contains("show")) {
+      ddActions.classList.remove("show");
+      li.classList.remove("liFlash");
+    } else {
+      ddActions.style.position = "absolute";
+      ddActions.style.left = btn.offsetLeft + "px";
+      ddActions.style.top = /* 1 + */ (btn.offsetTop + btn.clientHeight) + "px";
+      
+      ddActions.classList.add("show");
+      ddActions.dataset["testid"] = testid;
+      ddActions.dataset["testkind"] = testkind;
+
+      document.getElementById("actRun").dataset["testid"] = testid;
+      document.getElementById("actCopy").dataset["testid"] = testid;
+      document.getElementById("actCopy").dataset["testkind"] = testkind;
+      document.getElementById("actEdit").dataset["testid"] = testid;
+      document.getElementById("actOpen").dataset["testid"] = testid;
+      document.getElementById("actRevert").dataset["testid"] = testid;
+
+      li.classList.add("liFlash");
+
+      var pane = document.getElementsByClassName("leftPane")[0];
+      var liRect = li.getBoundingClientRect()
+      if (liRect.top < 0) {
+         pane.scrollTop += liRect.top;
+      } else {
+         var paneRect = pane.getBoundingClientRect();
+         if (liRect.top > paneRect.height) {
+            pane.scrollTop += (liRect.top + liRect.height - paneRect.height);
+         }
+      }
+    }
+}
+
+function scrTo(li) {
+    var testid=li.dataset["testid"];
+    var testkind=li.dataset["testkind"];
+    var btn=document.getElementById("btn_"+testid+"_"+testkind);
+    if (btn) {
+        var elementRect = btn.getBoundingClientRect();
+        var absoluteElementTop = elementRect.top + window.pageYOffset;
+        var middle = absoluteElementTop - (window.innerHeight / 2); 
+        window.scrollTo(0, middle);
+
+        //Blink
+        btn.classList.add("btnFlash");
+        setTimeout(function() { btn.classList.remove("btnFlash"); }, 300);
+
+        return;
+    }
+}
+
+// Close the dropdown if the user clicks outside of it
+window.onclick = function(event) {
+  if (event.target.className!="dropbtn") {
+    var ddActions = document.getElementById("ddActions");
+    ddActions.classList.remove('show');
+
+    var testid=ddActions.dataset["testid"];
+    var testkind=ddActions.dataset["testkind"];
+
+    var li=document.getElementById("li_"+testid+"_"+testkind);
+    if (li) { li.classList.remove("liFlash"); }
+  }
+}
+
+// Stop the demo process when the page is closing
+window.onunload = function(event) { callConsole('shutdown'); }
+
+#TPL:htmlBody
+
+
+
+
+

Quick Navigation

+$foreachExample +
+
+ +
+

Welcome to Ledger Live Examples!

+

This page makes examples in the original Ledger documentation alive. You can run any example and observe the result in a command line console. You can type the command again with another parameters and see how Ledger reacts. +You can review corresponded data files; you can make any changes in them and you can restore the original state at any time. Everything is alive and everything is safe! +

+

Every example is preceded by Action button. It gives you the options: Run the command; Copy the command text to clipboard; +Edit data file in a text editor; Open the folder containing data files and select the file; Revert the data file to the original state. +All data files are located in NLedger\Sandbox that is in your Documents folder, so you can safely make any changes in them. +

+ +
+ +#TPL:foreachExample + +
$command
+ +#TPL:htmlEndBody + +
+ +#TPL:htmlPre + +

+
diff --git a/Contrib/NLManagement/NonDeliverable/ledger3.texi b/Contrib/LiveDemo/NonDeliverable/ledger3.texi
similarity index 100%
rename from Contrib/NLManagement/NonDeliverable/ledger3.texi
rename to Contrib/LiveDemo/NonDeliverable/ledger3.texi
diff --git a/Contrib/LiveDemo/PsHttpListener.psm1 b/Contrib/LiveDemo/PsHttpListener.psm1
new file mode 100644
index 00000000..d507920a
--- /dev/null
+++ b/Contrib/LiveDemo/PsHttpListener.psm1
@@ -0,0 +1,89 @@
+$Script:shutdownRequest = $false
+
+function Start-HttpListener {
+    [CmdletBinding()]
+    Param(
+        [Parameter(Mandatory)][hashtable]$actions,
+        [Parameter(Mandatory)][string]$prefix,
+        [Parameter(Mandatory)][scriptblock]$onListenerStart
+    )
+    try
+    {
+        Write-Verbose "Starting listener..."
+        $Script:shutdownRequest = $false
+        $listener = New-Object System.Net.HttpListener
+        $null = $listener.Prefixes.Add($prefix)
+        $null = $listener.Start()
+        Write-Verbose "Listener is started [$prefix]"
+        if($onListenerStart) { $null = $onListenerStart.Invoke() }
+        while(!$shutdownRequest) {            
+            Write-Verbose "Listening"
+            $task = $private:listener.GetContextAsync();
+            while(!$task.Wait(200)) { }
+            Write-Verbose "Processing a request"
+            [System.Net.HttpListenerContext]$context = $task.Result
+            $null = Invoke-RequestProcessing $actions $context
+        }
+    }
+    finally
+    {
+        Write-Verbose "Stopping listener..."
+        $null = $listener.Stop()
+        Write-Verbose "Listener is stopped"
+    }
+}
+
+function Invoke-RequestProcessing {
+    [CmdletBinding()]
+    Param(
+        [Parameter(Mandatory)][Hashtable]$actions,
+        [Parameter(Mandatory)][System.Net.HttpListenerContext]$context
+    )
+
+    [string]$url = $context.Request.Url.LocalPath
+    Write-Verbose "Request URL: $url"
+
+    foreach($pattern in $actions.Keys) {
+        if ($url -match $pattern) {
+            Write-Verbose "Pattern '$pattern' matches given URL"
+            try {
+                $response = $actions[$pattern].InvokeWithContext($null, [psvariable]::new("_", $Matches))[0]
+                Write-Verbose "Invoke response: $response"
+                $null = Write-HttpResponse $context $response
+                Write-Verbose "Request is properly handled"
+            }
+            catch {
+                Write-Error "Http Request Processing Error: $($_.ToString())"
+                $null = Write-HttpResponse $context "Server Error" 500
+            }
+            return
+        }
+    }
+
+    Write-Verbose "No matched actions found; resource not found"
+    $null = Write-HttpResponse $context "Resource Not Found" 404
+}
+
+function Write-HttpResponse {
+    [CmdletBinding()]
+    Param(
+        [Parameter(Mandatory)][System.Net.HttpListenerContext]$context,
+        [Parameter()][string]$response = "OK",
+        [Parameter()][int]$statusCode = 200
+    )
+
+    $buffer = [System.Text.Encoding]::UTF8.GetBytes($response)
+    $context.Response.StatusCode = $statusCode
+    $context.Response.ContentLength64 = $buffer.Length
+    $Context.Response.ContentType = "text/html"
+    $null = $context.Response.OutputStream.Write($buffer,0,$buffer.Length)
+    $null = $context.Response.OutputStream.Close()            
+}
+
+function Invoke-HttpListenerShutdown() {
+    [CmdletBinding()]
+    Param()
+    Write-Verbose "Requested shutdown"
+    $Script:shutdownRequest = $True
+    return "OK"
+}
diff --git a/Contrib/NLManagement/NLCommon.psm1 b/Contrib/NLManagement/NLCommon.psm1
deleted file mode 100644
index 4193cbf3..00000000
--- a/Contrib/NLManagement/NLCommon.psm1
+++ /dev/null
@@ -1,357 +0,0 @@
-# NLedger Management Module that shares a common routine functions with others
-
-[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-Import-Module $Script:ScriptPath\..\NLManagement\NLWhere.psm1 -Force
-
-# ANSI Terminal colorization
-
-[bool]$Global:ANSI_Colorization = !([System.Environment]::OSVersion.Platform -eq "Win32NT" -and [System.Environment]::OSVersion.Version.Major -lt 10)
-
-[string]$ESC = [char]27
-[string]$Global:NormalColor = "$($ESC)[0m"
-[string]$Global:ForegroundBold = "$($ESC)[1m"
-[string]$Global:ForegroundUnderline = "$($ESC)[4m"
-[string]$Global:ForegroundBlink = "$($ESC)[5m"
-
-[string]$Global:BackgroundColorBlack = "$($ESC)[40m"
-[string]$Global:BackgroundColorRed = "$($ESC)[41m"
-[string]$Global:BackgroundColorGreen = "$($ESC)[42m"
-[string]$Global:BackgroundColorYellow = "$($ESC)[43m"
-[string]$Global:BackgroundColorBlue = "$($ESC)[44m"
-[string]$Global:BackgroundColorMagenta = "$($ESC)[45m"
-[string]$Global:BackgroundColorCyan = "$($ESC)[46m"
-[string]$Global:BackgroundColorWhite = "$($ESC)[47m"
-
-[string]$Global:BackgroundColorBoldBlack = "$($ESC)[40;1m"
-[string]$Global:BackgroundColorBoldRed = "$($ESC)[41;1m"
-[string]$Global:BackgroundColorBoldGreen = "$($ESC)[42;1m"
-[string]$Global:BackgroundColorBoldYellow = "$($ESC)[43;1m"
-[string]$Global:BackgroundColorBoldBlue = "$($ESC)[44;1m"
-[string]$Global:BackgroundColorBoldMagenta = "$($ESC)[45;1m"
-[string]$Global:BackgroundColorBoldCyan = "$($ESC)[46;1m"
-[string]$Global:BackgroundColorBoldWhite = "$($ESC)[47;1m"
-
-[string]$Global:ForegroundColorBlack = "$($ESC)[30m"
-[string]$Global:ForegroundColorRed = "$($ESC)[31m"
-[string]$Global:ForegroundColorGreen = "$($ESC)[32m"
-[string]$Global:ForegroundColorYellow = "$($ESC)[33m"
-[string]$Global:ForegroundColorBlue = "$($ESC)[34m"
-[string]$Global:ForegroundColorMagenta = "$($ESC)[35m"
-[string]$Global:ForegroundColorCyan = "$($ESC)[36m"
-[string]$Global:ForegroundColorWhite = "$($ESC)[37m"
-
-[string]$Global:ForegroundColorBoldBlack = "$($ESC)[30;1m"
-[string]$Global:ForegroundColorBoldRed = "$($ESC)[31;1m"
-[string]$Global:ForegroundColorBoldGreen = "$($ESC)[32;1m"
-[string]$Global:ForegroundColorBoldYellow = "$($ESC)[33;1m"
-[string]$Global:ForegroundColorBoldBlue = "$($ESC)[34;1m"
-[string]$Global:ForegroundColorBoldMagenta = "$($ESC)[35;1m"
-[string]$Global:ForegroundColorBoldCyan = "$($ESC)[36;1m"
-[string]$Global:ForegroundColorBoldWhite = "$($ESC)[37;1m"
-
-$Script:AnsiBackgroundColorMapping = @{
-  Black       = $Global:BackgroundColorBlack
-  DarkBlue    = $Global:BackgroundColorBlue
-  DarkGreen   = $Global:BackgroundColorGreen
-  DarkCyan    = $Global:BackgroundColorCyan
-  DarkRed     = $Global:BackgroundColorRed
-  DarkMagenta = $Global:BackgroundColorMagenta
-  DarkYellow  = $Global:BackgroundColorYellow
-  Gray        = $Global:BackgroundColorWhite
-  DarkGray = $Global:BackgroundColorBoldBlack
-  Blue     = $Global:BackgroundColorBoldBlue
-  Green    = $Global:BackgroundColorBoldGreen
-  Cyan     = $Global:BackgroundColorBoldCyan
-  Red      = $Global:BackgroundColorBoldRed
-  Magenta  = $Global:BackgroundColorBoldMagenta
-  Yellow   = $Global:BackgroundColorBoldYellow
-  White    = $Global:BackgroundColorBoldWhite
-}
-
-$Script:AnsiForegroundColorMapping = @{
-  Black       = $Global:ForegroundColorBlack
-  DarkBlue    = $Global:ForegroundColorBlue
-  DarkGreen   = $Global:ForegroundColorGreen
-  DarkCyan    = $Global:ForegroundColorCyan
-  DarkRed     = $Global:ForegroundColorRed
-  DarkMagenta = $Global:ForegroundColorMagenta
-  DarkYellow  = $Global:ForegroundColorYellow
-  Gray        = $Global:ForegroundColorWhite
-  DarkGray = $Global:ForegroundColorBoldBlack
-  Blue     = $Global:ForegroundColorBoldBlue
-  Green    = $Global:ForegroundColorBoldGreen
-  Cyan     = $Global:ForegroundColorBoldCyan
-  Red      = $Global:ForegroundColorBoldRed
-  Magenta  = $Global:ForegroundColorBoldMagenta
-  Yellow   = $Global:ForegroundColorBoldYellow
-  White    = $Global:ForegroundColorBoldWhite
-}
-
-$Script:AnsiFormatColorMapping = @{
-  Normal    = $Global:NormalColor
-  Bold      = $Global:ForegroundBold
-  Underline = $Global:ForegroundUnderline
-  Blink     = $Global:ForegroundBlink
-}
-
-$Script:AnsiColorMapping = @{
-  b = $Script:AnsiBackgroundColorMapping
-  c = $Script:AnsiForegroundColorMapping
-  f = $Script:AnsiFormatColorMapping
-}
-
-function Convert-ColorTokensToAnsi {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)][AllowEmptyString()][string]$inputString
-  )
-
-  $private:foundMatches = @((Select-String -InputObject $inputString '{(?c|b|f):(?\w+)}' -AllMatches).Matches)
-  [array]::Reverse($private:foundMatches)
-  foreach($private:match in $private:foundMatches) {
-    if ($private:match.Groups) {
-      [string]$private:type = $private:match.Groups[1].Value
-      [string]$private:color = $private:match.Groups[2].Value
-      [int]$private:pos = $private:match.Groups[0].Index
-      [int]$private:length = $private:match.Groups[0].Length
-  
-      if ($Global:ANSI_Colorization) {
-        $Private:mapping = $Script:AnsiColorMapping[$private:type]
-        $Private:ansiCode = $Private:mapping[$private:color]
-        if (!($Private:ansiCode)) { throw "Invalid color in token: $($Private:color)" }  
-      } else { $Private:ansiCode = "" }
-  
-      $inputString = $inputString.Remove($private:pos, $private:length)
-      $inputString = $inputString.Insert($private:pos, $Private:ansiCode)  
-    }
-  }
-
-  return $inputString
-}
-
-function Out-AnsiString {
-  Process { Convert-ColorTokensToAnsi $_ }
-}
-
-# Helper function that returns a structure indicating a failure
-function Get-Fault {
-    [CmdletBinding()]
-    Param(
-        [Parameter(Mandatory=$True)][string]$message
-    )
-
-    return @{ Status=$False; Message=$message }
-}
-
-# Helper function that returns a structure indicating a success
-function Get-Success {
-    [CmdletBinding()]
-    Param(
-        [Parameter(Mandatory=$True)][string]$message
-    )
-
-    return @{ Status=$True; Message=$message }
-}
-
-# Helper method that print a structure indicater either success or failure
-function PrintStatusResponse {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)]$response
-  )
-  if ($response.Status) { Write-Console "{c:green}[OK]{c:white} $($response.Message)" | Out-Null } else { Write-Console "{c:red}[ERROR]{c:white} $($response.Message)" | Out-Null }
-}
-
-
-# Helper method that wraps up "write-console"; it can manage nulls in color values.
-function Write-ConsoleColors {
-  [CmdletBinding()]
-  Param(
-     [Parameter(Mandatory=$True)][AllowEmptyString()][string]$inputString,
-     [Parameter(Mandatory=$False)]$foregroundColor,
-     [Parameter(Mandatory=$False)]$backgroundColor,
-     [Switch]$NoNewLine = $False
-  )
-  $private:colors = @{}
-  if ($foregroundColor) { $private:colors.ForegroundColor = $foregroundColor }
-  if ($backgroundColor) { $private:colors.BackgroundColor = $backgroundColor }
-
-  Write-Host $inputString -NoNewline:$NoNewLine @private:colors
-}
-
-<#
-.SYNOPSIS
-    Powershell enhanced colorization of console output.
-.DESCRIPTION
-    Enhanced version of 'write-host' command that allows adding
-    colorization tokens into the input string.
-    Token format is: '{c:console_color_name}' or '{b:console_color_name}'
-    The former changes foreground color of further string; the latter changes the background.
-    Console color name matches the names specified in System.ConsoleColor enum. Case insensitive.
-.PARAMETER inputString
-    Input string that can contain colorizatiion tokens.
-.PARAMETER NoNewLine
-    Switcher that indicates whether the output should end up with a new line symbol.
-.EXAMPLE
-    C:\PS> Write-Console "This text {c:yellow}can{c:white} be colorized"
-.NOTES
-    Author: Dmitry Merzlyakov
-    Date:   June 04, 2018    
-    -
-    If you do not want to enable PS scripts globally on your machine,
-    execute the following command in PS console:
-    set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
-#>    
-function Write-Console {
-  [CmdletBinding()]
-  Param(
-     [Parameter(Mandatory=$True)][AllowEmptyString()][string]$inputString,
-     [Switch]$NoNewLine = $False
-  )
-
-  $private:BackgroundColor = $null
-  $private:ForegroundColor = $null
-  [int]$private:beginPos = 0
-  
-  $private:foundMatches = (Select-String -InputObject $inputString '{(?c|b):(?\w+)}' -AllMatches)
-  foreach($private:match in $private:foundMatches.Matches) {
-
-    [string]$private:type = $private:match.Groups[1].Value
-    [string]$private:color = $private:match.Groups[2].Value
-    [int]$private:pos = $private:match.Groups[0].Index
-    [int]$private:length = $private:match.Groups[0].Length
-    [string]$private:completeValue = $private:match.Groups[0].Value
-    Write-Verbose "Found color token '$private:completeValue': type:'$private:type' color:'$private:color' pos:'$private:pos' length:'$private:length'"
-
-    [string]$private:previousPart = $inputString.Substring($private:beginPos,$private:pos-$private:beginPos)
-    Write-ConsoleColors -NoNewline -inputString $private:previousPart -backgroundColor $private:BackgroundColor -foregroundColor $private:ForegroundColor
-
-    if ($private:type -eq "c") { $private:ForegroundColor = [ConsoleColor]::Parse([ConsoleColor], $private:color, $True) }
-    if ($private:type -eq "b") { $private:BackgroundColor = [ConsoleColor]::Parse([ConsoleColor], $private:color, $True) }
-    $private:beginPos = $private:pos + $private:length
-  }
-
-  [string]$private:previousPart = $inputString.Substring($private:beginPos)
-  Write-ConsoleColors -NoNewline:$NoNewLine -inputString $private:previousPart -backgroundColor $private:BackgroundColor -foregroundColor $private:ForegroundColor
-}
-
-function Get-ColoredStringLength {
-  [CmdletBinding()]
-  Param(
-     [Parameter(Mandatory=$True)][AllowEmptyString()][string]$inputString
-  )
-  $inputString = $inputString -replace '{(?c|b):(?\w+)}',""
-  return $inputString.Length
-}
-
-
-function Add-TextTableColumn {
-  [CmdletBinding()]
-  Param(
-     [Parameter(Mandatory=$True)][string]$property,
-     [Parameter(Mandatory=$False)][string]$header = "",
-     [Parameter(Mandatory=$False)][int]$width = 0
-  )
-  return [PsCustomObject]@{ Property=$property; Header=$header; Width=$width }
-}
-
-function Write-TextTable {
-  [CmdletBinding()]
-  Param(
-     [Parameter(Mandatory=$True)]$inputData,
-     [Parameter(Mandatory=$True)]$columns,
-     [Parameter(Mandatory=$False)]$headerBackground = $null,
-     [Parameter(Mandatory=$False)]$separatorColor = $null
-  )
-
-  foreach($private:column in $columns | ?{$_.Width -eq 0}) {
-    # Get max value length
-    $private:lengths = ($inputData | select -ExpandProperty $private:column.Property | %{ (Get-ColoredStringLength $_) })
-    $private:lengths += (Get-ColoredStringLength $private:column.Header)
-    $private:column.Width = ( $private:lengths | measure-object -Maximum).Maximum
-  }
-
-  $private:headerBackgroundPrefix = if ($headerBackground) { "{b:$headerBackground}"} else { "" }  
-  $private:separatorColorPrefix = if ($separatorColor) { "{c:$separatorColor}"} else { "" }  
-
-  # Print header
-  [int]$private:lastIndex = $columns.count - 1
-  [string]$private:output = ""
-  for($private:index=0; $private:index -le $private:lastIndex; $private:index++) {
-    [bool]$private:isLast = $private:index -eq $private:lastIndex
-    $private:column = $columns[$private:index]
-    $private:width = $private:column.Width + ($private:column.Header.length - (Get-ColoredStringLength $private:column.Header))
-    #Write-Console -NoNewLine:$(!$private:isLast) "$private:headerBackgroundPrefix $($private:column.Header.PadRight($private:width)) $(if($private:isLast) {''} else {"$private:separatorColorPrefix|"} )"
-    $private:output += "$private:headerBackgroundPrefix $($private:column.Header.PadRight($private:width)) $(if($private:isLast) {''} else {"$private:separatorColorPrefix|"} )"
-  }
-  Write-Console $private:output
-
-  # Print data rows
-  foreach($private:data in $inputData) {
-      [int]$private:lastIndex = $columns.count - 1
-      [string]$private:output = ""
-      for($private:index=0; $private:index -le $private:lastIndex; $private:index++) {        
-        [bool]$private:isLast = $private:index -eq $private:lastIndex
-        $private:column = $columns[$private:index]
-        [string]$private:colValue = ($private:data |  select -ExpandProperty $private:column.Property)
-        $private:width = $private:column.Width + ($private:colValue.length - (Get-ColoredStringLength $private:colValue))
-        #Write-Console -NoNewLine:$(!$private:isLast) " $($private:colValue.PadRight($private:width)) $(if($private:isLast) {''} else {"$private:separatorColorPrefix|"} )"
-        $private:output += " $($private:colValue.PadRight($private:width)) $(if($private:isLast) {''} else {"$private:separatorColorPrefix|"} )"
-      }
-      Write-Console $private:output
-  }
-
-}
-
-
-function Write-Columns {
-  [CmdletBinding()]
-  Param(
-     [Parameter(Mandatory=$True)]$inputData,
-     [Parameter(Mandatory=$False)][int]$leftMargin = 4,
-     [Parameter(Mandatory=$False)][int]$rightBoundary = 80,
-     [Parameter(Mandatory=$False)][int]$interval = 2,
-     [Parameter(Mandatory=$False)][int]$firstRowLeftMargin = 0
-  )
-
-  if (!$inputData) { return }
-
-  $private:width = $rightBoundary - $leftMargin
-  if ($private:width -le 0) { throw "Too small width; check rightBoundary and/or leftMargin" }
-
-  $private:maxLength = $interval + ($inputData | %{ (Get-ColoredStringLength $_) } | measure-object -Maximum).Maximum
-  if ($private:width -lt $private:maxLength) { throw "Too small width; data rows should be shorter" }
-
-  [int]$private:colNum = [math]::truncate($private:width / $private:maxLength)
-  [int]$private:rowNum = [math]::truncate((($inputData | measure-object).Count - 1) / $private:colNum) + 1
-
-  for($private:row=0;$private:row -lt $private:rowNum; $private:row++) {
-    [string]$private:output = "".PadLeft($leftMargin)
-    if ($private:row -eq 0) { $private:output = "".PadLeft($firstRowLeftMargin) }
-    for($private:col=0;$private:col -lt $private:colNum; $private:col++) {
-        [string]$private:cell = $inputData[$private:row + ($private:col * $private:rowNum)]
-        $private:output += $private:cell.PadRight($private:maxLength)
-    }
-    Write-Console $private:output
-  }
-}
-
-
-<#
-.SYNOPSIS
-    NLedger Management - determining NLedger binaries location.
-.DESCRIPTION
-    Detects the deployment profile (production, development/debug, development/release) 
-    and returns path to the most relevant NLedger binaries.
-    If it detects multiple folders with binaries, it prefers the folder with the latest files.
-#>
-function NLedgerLocation {
-  [CmdletBinding()]
-  Param()
-
-  $private:path = Get-NLedgerPath -preferCore:$false
-  if (!$private:path) { throw "Cannot find NLedger executable file" }
-  return [System.IO.Path]::GetDirectoryName($private:path)
-}
-
-Export-ModuleMember -function * -alias *
\ No newline at end of file
diff --git a/Contrib/NLManagement/NLDoc.LiveDemo.WebConsole.cmd b/Contrib/NLManagement/NLDoc.LiveDemo.WebConsole.cmd
deleted file mode 100644
index eee4f677..00000000
--- a/Contrib/NLManagement/NLDoc.LiveDemo.WebConsole.cmd
+++ /dev/null
@@ -1,2 +0,0 @@
-@PowerShell -NoLogo -ExecutionPolicy RemoteSigned -File "%~dp0NLDoc.LiveDemo.WebConsole.ps1"
-@exit
\ No newline at end of file
diff --git a/Contrib/NLManagement/NLDoc.LiveDemo.WebConsole.ps1 b/Contrib/NLManagement/NLDoc.LiveDemo.WebConsole.ps1
deleted file mode 100644
index b00df185..00000000
--- a/Contrib/NLManagement/NLDoc.LiveDemo.WebConsole.ps1
+++ /dev/null
@@ -1,39 +0,0 @@
-[CmdletBinding()]
-Param()
-
-# If you run this script in ISE, you may want to configure Execution Policy by this command:
-# set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
-
-$ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-Import-Module $ScriptPath\NLCommon.psm1 -Force
-Import-Module $ScriptPath\PsHttpListener.psm1 -Force
-Import-Module $ScriptPath\NLDoc.LiveDemo.psm1 -Force
-
-trap 
-{ 
-  write-output $_ 
-  exit 1 
-}
-
-$Script:actions = @(
-    @{ pattern="\/content"; action=[scriptblock]{ getContent $demoConfig.DemoFile } },
-    @{ pattern="\/shutdown"; action=[scriptblock]{ getShutdown } },
-    @{ pattern="\/act\.actRun\.(.+)"; action=[scriptblock]{ actRun -testid $Global:ActionParams[1] -demoConfig $demoConfig } }
-    @{ pattern="\/act\.actEdit\.(.+)"; action=[scriptblock]{ actEdit -testid $Global:ActionParams[1] -demoConfig $demoConfig } }
-    @{ pattern="\/act\.actOpen\.(.+)"; action=[scriptblock]{ actOpen -testid $Global:ActionParams[1] -demoConfig $demoConfig } }
-    @{ pattern="\/act\.actRevert\.(.+)"; action=[scriptblock]{ actRevert -testid $Global:ActionParams[1] -demoConfig $demoConfig } }
-)
-
-Write-Console "{c:white}Welcome to NLedger Live Demo"
-Write-Console "{c:gray}This console executes live examples that you can run in a browser."
-
-$demoConfig = getDemoConfig
-
-Write-Console "{c:gray}The browser with demo content is opening automatically."
-Write-Console "{c:gray}You can also open demo manually by link: {c:yellow}$($demoConfig.DemoURL)content{c:gray}."
-Write-Console "{c:gray}When you close the demo page, this process shuts down."
-Write-Console "{c:gray}You can stop this console at any moment by pressing {c:yellow}CTRL-C{c:gray}."
-
-initDemoSandbox -files $demoConfig.Files -sandbox $demoConfig.Sandbox | Out-Null
-RunListener -actions $Script:actions -prefix $demoConfig.DemoURL -onListenerStart { openPage $demoConfig | Out-Null }
-
diff --git a/Contrib/NLManagement/NLSetup.Console.ps1 b/Contrib/NLManagement/NLSetup.Console.ps1
deleted file mode 100644
index b8858bc1..00000000
--- a/Contrib/NLManagement/NLSetup.Console.ps1
+++ /dev/null
@@ -1,354 +0,0 @@
-# NLedger Setup Powershell Console
-# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
-
-[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-Import-Module $ScriptPath\NLCommon.psm1 -Force 
-Import-Module $ScriptPath\NLSetup.psm1 -Force
-Import-Module $ScriptPath\NLDoc.LiveDemo.psm1 -Force
-
-# Specify an error handled to return exit code "1" in case of any exceptions
-# See http://chrisoldwood.blogspot.com/2011/05/powershell-throwing-exceptions-exit.html for details
-trap 
-{ 
-  write-error $_ 
-  exit 1 
-} 
-
-function prompt {"NLedger Setup>"}
-
-function help {
-  [CmdletBinding()]
-  Param()
-
-  write-console ""
-  write-console "{c:white}NLedger Setup Console"
-  write-console "{c:white}*********************"
-  Write-Console "{c:gray}This console allows to customize NLedger by managing application settings."
-  Write-Console "{c:gray}Available commands:"
-  Write-Console "{c:yellow}show{c:darkyellow} [setting_name -all -app -common -user -env]{c:gray} - shows all NLedger settings."
-  Write-Console "{c:yellow}show-details{c:darkyellow} [setting_name -allValues -showPermitted]{c:gray} - shows detail information about all NLedger settings."
-  Write-Console "{c:yellow}set-setting settingName settingValue {c:darkyellow}[-app -common -user]{c:gray} - sets a setting."
-  Write-Console "{c:yellow}remove-setting settingName {c:darkyellow}[-app -common -user]{c:gray} - removes a setting."
-  Write-Console "{c:yellow}set-platform {c:darkyellow}[-core]{c:gray} - selects an app binary platform (.Net Framework or .Net Core)."
-  Write-Console "{c:yellow}help{c:gray} - shows this text."
-  Write-Console "{c:yellow}exit{c:gray} - closes this console."
-  Write-Console ""
-  Write-Console "{c:gray}Note: you can get further information by executing {c:yellow}get-help [command] -Detailed{c:gray}."
-  Write-Console "{c:gray}For example, {c:darkgray}get-help show{c:gray} explains every command option and provides examples."
-  Write-Console ""
-  Write-Console "{c:gray}Note: if you want to modify settings in app config file (e.g. NLedger-cli.exe.config),"
-  Write-Console "{c:gray}you must have administrative priviledges. Run this console as an administrator."
-  Write-Console ""
-}
-
-# Local helper function
-function printFileInfo {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)][string]$fileDesc,
-    [Parameter(Mandatory=$True)][bool]$fileExists,
-    [Parameter(Mandatory=$True)][string]$fileName
-  )
-  if ($fileExists) {
-    Write-Console "{c:gray}$fileDesc {c:darkgreen}[Exists   ]{c:gray} $fileName"
-  } else {
-    Write-Console "{c:gray}$fileDesc {c:darkyellow}[Not Exist]{c:gray} $fileName"
-  }
-}
-
-# Local helper function
-function getColoredSettingValue {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)][AllowEmptyString()][string]$strValue,
-    [Parameter(Mandatory=$True)][bool]$isAvailable,
-    [Parameter(Mandatory=$True)][bool]$hasValue,
-    [Parameter(Mandatory=$True)][string]$normalColor,
-    [Parameter(Mandatory=$True)][string]$altColor
-  )
-  if (!$isAvailable) { return "{c:$altColor}[N/A]" }
-  if (!$hasValue) { return "{c:$altColor}[not set]" }
-  return "{c:$normalColor}$($strValue)"
-}
-
-
-<#
-.SYNOPSIS
-    It shows current values of NLedger settings.
-.DESCRIPTION
-    This function incorporates and shows all NLedger settings in a table format.
-    Columns contain setting names and values for every source (default value,
-    application, common, user settings and the value coming from environment variable).
-    The last column contains an effective value that NLedger eventually takes.
-    The list of column can be changes by means of switchers.
-    Rows contain all NLedger settings. It is possible to limit this list by specifying a filter parameter.
-.PARAMETER settingNameFilter
-    Optional filter for the collection of NLedger parameters in Regex format.
-.PARAMETER default
-    Default: True. Indicates whether to show the column with default values.
-.PARAMETER app
-    Default: False. Indicates whether to show the column with application configuration settings ([binary folder]\NLedger-cli.exe.config).
-.PARAMETER common
-    Default: False. Indicates whether to show the column with common (all user) configuration settings ([ProgramData]\NLedger\common.config).
-.PARAMETER user
-    Default: True. Indicates whether to show the column with current user configuration settings ([AppData\Local]\NLedger\user.config).
-.PARAMETER env
-    Default: False. Indicates whether to show the column with configuration settings specified in environment variables.
-.PARAMETER all
-    Default: False. Indicates whether to show all the columns with configuration settings.
-.EXAMPLE
-    Show current user settings
-    C:\PS> show
-.EXAMPLE
-    Show all possible sources for current user settings
-    C:\PS> show -all
-.EXAMPLE
-    Show IsAtty setting only
-    C:\PS> show isatty
-.NOTES
-    Author: Dmitry Merzlyakov
-    Date:   June 25, 2018    
-#>
-function show {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$False)][string]$settingNameFilter,
-    [Switch]$default = $True,
-    [Switch]$app = $False,
-    [Switch]$common = $False,
-    [Switch]$user = $True,
-    [Switch]$env = $False,
-    [Switch]$all = $False
-  )
-
-  $Private:configData = GetConfigData
-
-  $private:columns = @()
-  $private:columns += Add-TextTableColumn -property "Name"  -header "Name"
-  if ($default -or $all) { $private:columns += Add-TextTableColumn -property "DefaultValue" -header "Default" }
-  if ($app -or $all) { $private:columns += Add-TextTableColumn -property "AppSettingValue" -header "App" }
-  if ($common -or $all) { $private:columns += Add-TextTableColumn -property "CommonSettingValue" -header "Common" }
-  if ($user -or $all) { $private:columns += Add-TextTableColumn -property "UserSettingValue" -header "User" }
-  if ($env -or $all) { $private:columns += Add-TextTableColumn -property "EnvironmentSettingValue"-header "Env" }
-  $private:columns += Add-TextTableColumn -property "EffectiveSettingValue" -header "Effective"
-
-  $private:settings = $Private:configData.Settings | ?{ if ($settingNameFilter) {$_.Name -match $settingNameFilter} else {$true} } | %{ [PsCustomObject]@{
-        Name="{c:white}$($_.Name)"
-        DefaultValue=[string](getColoredSettingValue $_.DefaultValue $true $_.HasDefaultValue "yellow" "darkyellow")
-        AppSettingValue=[string](getColoredSettingValue $_.AppSettingValue $_.IsAvailableForApp $_.HasAppSettingValue "yellow" "darkyellow")
-        CommonSettingValue=[string](getColoredSettingValue $_.CommonSettingValue $_.IsAvailableForCommon $_.HasCommonSettingValue "yellow" "darkyellow")
-        UserSettingValue=[string](getColoredSettingValue $_.UserSettingValue $_.IsAvailableForUser $_.HasUserSettingValue "yellow" "darkyellow")
-        EnvironmentSettingValue=[string](getColoredSettingValue $_.EnvironmentSettingValue $_.IsAvailableForEnv $_.HasEnvironmentSettingValue "yellow" "darkyellow")
-        EffectiveSettingValue=[string](getColoredSettingValue $_.EffectiveSettingValue $true $_.HasEffectiveSettingValue "green" "darkyellow")
-  } }
-
-  Write-Console ""
-  Write-Console "{c:gray}NLedger application setting table. Columns are:"
-  if ($default -or $all) { Write-Console " {c:white}Default{c:gray} - Default setting value specified in code" }
-  if ($app -or $all) { Write-Console " {c:white}App{c:gray} - Application setting value (specified in app.config)" }
-  if ($common -or $all) { Write-Console " {c:white}Common{c:gray} - Common setting value (shared with all users)" }
-  if ($user -or $all) { Write-Console " {c:white}User{c:gray} - Current user setting value" }
-  if ($env -or $all) { Write-Console " {c:white}Env{c:gray} - Environment variable setting value (variables that are started with 'nledger' in names" }
-  Write-Console " {c:white}Effective{c:gray} - effective setting value that NLedger receives"
-  Write-Console ""
-
-  if ($private:settings) {
-    Write-TextTable -inputData $private:settings -columns $private:columns -headerBackground "blue" -separatorColor "white"
-  } else {
-    Write-Console "{c:yellow}No settings are selected to show. Check the validness of the setting name filter: '{c:white}$settingNameFilter{c:yellow}'"
-  } 
-  Write-Console ""
-}
-
-<#
-.SYNOPSIS
-    It shows detail information about current values of NLedger settings.
-.DESCRIPTION
-    This function gives detail information about every setting including its name,
-    description, value type, permitted values (in case they are limited) and etc.
-    In addition, it gives technical information about location of configuration files.
-.PARAMETER settingNameFilter
-    Optional filter for the collection of NLedger parameters in Regex format.
-.PARAMETER allValues
-    Default: False. Indicates whether to show the values from all sources or only whose that have a value.
-.PARAMETER showPermitted
-    Default: True. Indicates whether to show the permitted values for a setting (in case they are limited).
-.EXAMPLE
-    Show detail information about current user settings
-    C:\PS> show-details
-.EXAMPLE
-    Show detail information excluding permitted values to shorten the output
-    C:\PS> show-details -showPermitted:$false
-.EXAMPLE
-    Show IsAtty setting only
-    C:\PS> show-details isatty
-.NOTES
-    Author: Dmitry Merzlyakov
-    Date:   June 25, 2018    
-#>
-function show-details {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$False)][string]$settingNameFilter,
-    [Switch]$allValues = $False,
-    [Switch]$showPermitted = $True
-  )
-
-  $Private:configData = GetConfigData
-
-  Write-Console ""
-  Write-Console "{c:yellow}Configuration files:"
-  Write-Console ""
-  printFileInfo -fileDesc "App settings   " -fileExists $Private:configData.AppSettingsFileExists -fileName $Private:configData.AppSettingsFile
-  printFileInfo -fileDesc "Common settings" -fileExists $Private:configData.CommonSettingsFileExists -fileName $Private:configData.CommonSettingsFile
-  printFileInfo -fileDesc "User settings  " -fileExists $Private:configData.UserSettingsFileExists -fileName $Private:configData.UserSettingsFile
-  Write-Console ""
-
-  Write-Console "{c:yellow}Configuration settings:"
-  Write-Console ""
-  $private:settings = $Private:configData.Settings | ?{ if ($settingNameFilter) {$_.Name -match $settingNameFilter} else {$true} } | %{ 
-    Write-Console "{c:gray}Name:            {c:white}$($_.Name)"
-    if ($_.Description) { Write-Console "{c:gray}Description:     {c:white}$($_.Description)" }
-    if ($_.Category)    { Write-Console "{c:gray}Category:        {c:white}$($_.Category)" }
-    Write-Console "{c:gray}Value Type:      {c:white}$($_.SettingType)"
-    if ($showPermitted -and $($_.PossibleValues)) {
-        Write-Console -NoNewLine "{c:gray}Permitted:       "
-        Write-Columns ($_.PossibleValues | Sort-Object) -leftMargin 17 -rightBoundary 88
-    }
-    if ($allValues -or $_.HasDefaultValue) { Write-Console "{c:gray}Default Value:   $(getColoredSettingValue $_.DefaultValue $true $_.HasDefaultValue "yellow" "darkyellow")" }
-    if ($allValues -or $_.HasAppSettingValue) { Write-Console "{c:gray}App setting:     $(getColoredSettingValue $_.AppSettingValue $_.IsAvailableForApp $_.HasAppSettingValue "yellow" "darkyellow")" }
-    if ($allValues -or $_.HasCommonSettingValue) { Write-Console "{c:gray}Common setting:  $(getColoredSettingValue $_.CommonSettingValue $_.IsAvailableForCommon $_.HasCommonSettingValue "yellow" "darkyellow")" }
-    if ($allValues -or $_.HasUserSettingValue) { Write-Console "{c:gray}User setting:    $(getColoredSettingValue $_.UserSettingValue $_.IsAvailableForUser $_.HasUserSettingValue "yellow" "darkyellow")" }
-    if ($allValues -or $_.HasEnvironmentSettingValue) { Write-Console "{c:gray}Environment Var: $(getColoredSettingValue $_.EnvironmentSettingValue $_.IsAvailableForEnv $_.HasEnvironmentSettingValue "yellow" "darkyellow")" }
-    Write-Console "{c:gray}Effective Value: $(getColoredSettingValue $_.EffectiveSettingValue $true $_.HasEffectiveSettingValue "green" "darkyellow")"
-    Write-Console ""
-  }
-
-}
-
-<#
-.SYNOPSIS
-    Set a setting value.
-.DESCRIPTION
-    This function sets a value to NLedger configuration in a specified scope.
-    The default scope is 'user' (current user settings) but it is also possible 
-    to set 'common' settings (for all users) and app settings (that is basically not
-    recommended in order to keep binary foolder unmodified).
-    The values are verified whether they are permitted and acceptable for given scope.
-.PARAMETER settingName
-    The name of setting (case-insensitive).
-.PARAMETER settingValue
-    The value (case-insensitive if the list permitted values is specified).
-.PARAMETER app
-    Default: False. Indicates that the current scope is Application. You must have adminidstrative priviledges.
-.PARAMETER common
-    Default: False. Indicates that the current scope is Common (all users).
-.PARAMETER user
-    Default: True. Indicates that the current scope is User (current users).
-.EXAMPLE
-    Set IsAtty to False for the current user
-    C:\PS> set-setting isatty false
-.EXAMPLE
-    Set IsAtty to False for all users
-    C:\PS> set-setting isatty false -common
-.NOTES
-    Author: Dmitry Merzlyakov
-    Date:   June 25, 2018    
-#>
-function set-setting {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)][string]$settingName,
-    [Parameter(Mandatory=$True)][AllowEmptyString()][string]$settingValue,
-    [Switch]$app = $False,
-    [Switch]$common = $False,
-    [Switch]$user = $True
-  )
-
-  if ($app) { $private:response = SetConfigValue -scope "app" -settingName $settingName -settingValue $settingValue }
-  else {
-    if ($common) { $private:response = SetConfigValue -scope "common" -settingName $settingName -settingValue $settingValue }
-    else {
-        if ($user) { $private:response = SetConfigValue -scope "user" -settingName $settingName -settingValue $settingValue }
-        else { throw "Configuration scope is not specified. You may specify either 'app' or 'common' or 'user' flag." }
-    }
-  }
-
-  PrintStatusResponse $private:response | Out-Null
-}
-
-<#
-.SYNOPSIS
-    Removes a setting value.
-.DESCRIPTION
-    This function cleans up a value from NLedger configuration in a specified scope.
-    The default scope is 'user' (current user settings) but it is also possible 
-    to remove a value from 'common' settings (all users) or from app settings.
-.PARAMETER settingName
-    The name of setting (case-insensitive).
-.PARAMETER app
-    Default: False. Indicates that the current scope is Application. You must have adminidstrative priviledges.
-.PARAMETER common
-    Default: False. Indicates that the current scope is Common (all users).
-.PARAMETER user
-    Default: True. Indicates that the current scope is User (current users).
-.EXAMPLE
-    Remove IsAtty from current user settings
-    C:\PS>  remove-setting isatty
-.EXAMPLE
-    Remove IsAtty from all user settings
-    C:\PS> remove-setting isatty -common
-.NOTES
-    Author: Dmitry Merzlyakov
-    Date:   June 25, 2018    
-#>
-function remove-setting {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)][string]$settingName,
-    [Switch]$app = $False,
-    [Switch]$common = $False,
-    [Switch]$user = $True
-  )
-
-  if ($app) { $private:response = RemoveConfigValue -scope "app" -settingName $settingName }
-  else {
-    if ($common) { $private:response = RemoveConfigValue -scope "common" -settingName $settingName }
-    else {
-        if ($user) { $private:response = RemoveConfigValue -scope "user" -settingName $settingName }
-        else { throw "Configuration scope is not specified. You may specify either 'app' or 'common' or 'user' flag." }
-    }
-  }
-
-  PrintStatusResponse $private:response | Out-Null
-}
-
-<#
-.SYNOPSIS
-    Selects an application binary platform.
-.DESCRIPTION
-    If the current deployment contains binary files for both platforms (.Net Framework and .Net Core),
-    this function allows to select which application configuration file will be modified (for -app scope).
-    Prefers .Net Framework by default. This function has no effect if there is core-only deployment.
-.PARAMETER core
-    .Net Core application configuration file will be modified if this switch is selected.
-.EXAMPLE
-    Modify .Net Core app configuration file
-    C:\PS>  set-platform -core
-.EXAMPLE
-    Modify .Net Framework app configuration file (if available)
-    C:\PS> set-platform
-.NOTES
-    Author: Dmitry Merzlyakov
-    Date:   September 9, 2020    
-#>
-function set-platform {
-    [CmdletBinding()]
-    Param([Switch][bool]$core = $false)
-
-    $private:response = SetPlatform -preferCore:$core
-    PrintStatusResponse $private:response | Out-Null
-}
-  
-help 
-
diff --git a/Contrib/NLManagement/NLWhere.psm1 b/Contrib/NLManagement/NLWhere.psm1
deleted file mode 100644
index 6f3c4248..00000000
--- a/Contrib/NLManagement/NLWhere.psm1
+++ /dev/null
@@ -1,127 +0,0 @@
-# NLedger-Where module locates NLedger executable binaries in the current deployment profile
-
-[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-
-function getFullPath { # Private wrapper for mocking
-  [CmdletBinding()]
-  Param([Parameter(Mandatory=$True)][string]$path)
-  return [System.IO.Path]::GetFullPath($path)
-}
-
-function getLastWriteTime { # Private wrapper for mocking
-  [CmdletBinding()]
-  Param([Parameter(Mandatory=$True)][string]$path)
-  return [System.IO.File]::GetLastWriteTimeUtc($path)
-}
-
-function checkPath {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True)][string]$path,
-    [Switch][bool]$isDebug = $false,
-    [Switch][bool]$isRelease = $false,
-    [Switch][bool]$isPackage = $false,
-    [Switch][bool]$isCore = $false,
-    [Switch][bool]$isAlias = $false,
-    [Switch][bool]$isNotWindows = $false
-  )
-
-  [string]$private:buildPath = "$Script:ScriptPath$([System.IO.Path]::DirectorySeparatorChar)$path"
-  Write-Verbose "Building path: $private:buildPath"
-  [string]$private:exePath = getFullPath($private:buildPath)
-  Write-Verbose "Checking path: $private:exePath"
-
-  if (Test-Path -LiteralPath $Private:exePath -PathType Leaf) {
-     Write-Verbose "Found by path: $Private:exePath"
-     [PsCustomObject]@{
-        Path = $Private:exePath
-        Date = getLastWriteTime($Private:exePath)
-        IsDebug = $isDebug
-        IsRelease = $isRelease
-        IsPackage = $isPackage
-        IsCore = $isCore
-        IsAlias = $isAlias
-        IsWindows = $(!($isNotWindows))
-     }
-  }
-}
-
-<#
-.SYNOPSIS
-    Collects information about NLedger executable binaries in the current location.
-.DESCRIPTION
-    Returns a collection of all available NLedger binaries in current deployment structure.
-    The output objects contain the absolute path to a found binary file, its date and
-    several flags that help to classify the file:
-    -IsAlias indicates that find binary is a hard link (ledger.exe);
-    -IsCore indicates that found binary is a .Net Core application (.Net Framework otherwise);
-    -IsPackage means that the file is a part of a deployment package (MSI or ZIP archive);
-    -IsRelease means that the file is on development environment compiled with Release target;
-    -IsDebug means Debug target respectively.
-.EXAMPLE
-    C:\PS> Get-NLedgerInstances
-#>
-function Get-NLedgerInstances {
-  [CmdletBinding()]
-  Param()
-
-  checkPath -path "..\..\Source\NLedger.CLI\bin\Debug\net472\NLedger-cli.exe" -isDebug
-  checkPath -path "..\..\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" -isDebug -isCore
-  checkPath -path "../../Source/NLedger.CLI/bin/Debug/netcoreapp3.1/NLedger-cli" -isDebug -isCore -isNotWindows
-  checkPath -path "../../Source/NLedger.CLI/bin/Debug/netcoreapp3.1/osx-x64/NLedger-cli" -isDebug -isCore -isNotWindows
-
-  checkPath -path "..\..\Source\NLedger.CLI\bin\Release\net472\NLedger-cli.exe" -isRelease
-  checkPath -path "..\..\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" -isRelease -isCore
-  checkPath -path "../../Source/NLedger.CLI/bin/Release/netcoreapp3.1/NLedger-cli" -isRelease -isCore -isNotWindows
-  checkPath -path "../../Source/NLedger.CLI/bin/Release/netcoreapp3.1/osx-x64/NLedger-cli" -isRelease -isCore -isNotWindows
-
-  checkPath -path "..\NLedger-cli.exe" -isPackage
-  checkPath -path "..\bin\net45\NLedger-cli.exe" -isPackage
-  checkPath -path "..\bin\netcoreapp3.1\NLedger-cli.exe" -isPackage -isCore
-
-  checkPath -path "..\ledger.exe" -isAlias -isPackage
-}
-
-<#
-.SYNOPSIS
-    Selects a preferable NLedger executable binary from an input collection.
-.DESCRIPTION
-    Selects the latest NLedger executable file from an input collection provided by Get-NLedgerInstances.
-    Alias is ignored, so it returns paths to physical files only.
-    The switch "preferCore" allows to prefer .Net Core binaries to .Net Framework ones (default preference).
-.EXAMPLE
-    C:\PS> Get-NLedgerInstances | Select-NLedgerInstance -preferCore
-#>
-function Select-NLedgerInstance {
-  [CmdletBinding()]
-  Param(
-    [Parameter(Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)][PsCustomObject[]]$instances,
-    [Switch][bool]$preferCore = $false
-  )
-  Begin { $Private:coll = @() }
-  Process { $Private:coll += $instances }
-  End { 
-    $private:collected = $Private:coll | Sort-Object -Property Date -Descending | Where-Object {!$_.IsAlias}
-    if ($preferCore -and $($private:collected | Where-Object {$_.IsCore})) { $private:collected = $private:collected | Where-Object {$_.IsCore}}
-    if (!($preferCore) -and $($private:collected | Where-Object {!($_.IsCore)})) { $private:collected = $private:collected | Where-Object {!($_.IsCore)}}
-    $private:collected | Select-Object -First 1 }
-}
-
-<#
-.SYNOPSIS
-    Returns an absolute path to the latest preferable NLedger executable file (string value only).
-.DESCRIPTION
-    The switch "preferCore" allows to select .Net Core binaries 
-    (.Net Framework is prefferable by default).
-.EXAMPLE
-    C:\PS> Get-NLedgerPath -preferCore
-#>
-function Get-NLedgerPath {
-  [CmdletBinding()]
-  Param(
-    [Switch][bool]$preferCore = $false
-  )
-  (Get-NLedgerInstances | Select-NLedgerInstance -preferCore:$preferCore).Path
-}
-
-Export-ModuleMember -function Get-NLedgerInstances, Select-NLedgerInstance, Get-NLedgerPath
\ No newline at end of file
diff --git a/Contrib/NLManagement/NonDeliverable/NLCommon.Tests.ps1 b/Contrib/NLManagement/NonDeliverable/NLCommon.Tests.ps1
deleted file mode 100644
index 8c2c6062..00000000
--- a/Contrib/NLManagement/NonDeliverable/NLCommon.Tests.ps1
+++ /dev/null
@@ -1,149 +0,0 @@
-# Tests for NLedger Common module (NLCommon.psm1)
-# Based on Pester unit testing framework (https://github.com/pester/Pester)
-# Pestel 4 (or higher) needs to be installed by the command: Install-Module -Name Pester -Force -SkipPublisherCheck
-# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
-
-[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-Import-Module $Script:ScriptPath\..\NLCommon.psm1 -Force
-
-$Script:NLCommonScriptPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath\..")
-
-describe 'Write-ConsoleColors' {
-
-    it 'it accepts empty string' {
-        mock -ModuleName "NLCommon" -CommandName 'Write-Host' -ParameterFilter { !$Object -and !$NoNewline -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-ConsoleColors "" | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it sends string to write-host' {
-        mock -ModuleName "NLCommon" -CommandName 'Write-Host' -ParameterFilter { $Object -eq "test string" -and !$NoNewline  -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-ConsoleColors "test string" | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it passes NoNewLine switch' {
-        mock -ModuleName "NLCommon" -CommandName 'Write-Host' -ParameterFilter { $Object -eq "test string" -and $NoNewline  -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-ConsoleColors "test string" -NoNewLine | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it adds foreground color switcher if specified' {
-        mock -ModuleName "NLCommon" -CommandName 'Write-Host' -ParameterFilter { $Object -eq "test string" -and !$NoNewline  -and "red" -eq $ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-ConsoleColors "test string" -foregroundColor red | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it adds backgroundColor color switcher if specified' {
-        mock -ModuleName "NLCommon" -CommandName 'Write-Host' -ParameterFilter { $Object -eq "test string" -and !$NoNewline  -and !$ForegroundColor -and "red" -eq $BackgroundColor } -Verifiable
-        Write-ConsoleColors "test string" -backgroundColor red | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it adds both color switchers if specified' {
-        mock -ModuleName "NLCommon" -CommandName 'Write-Host' -ParameterFilter { $Object -eq "test string" -and !$NoNewline  -and "blue" -eq $ForegroundColor -and "red" -eq $BackgroundColor } -Verifiable
-        Write-ConsoleColors "test string" -backgroundColor red -foregroundColor blue | Out-Null
-        Assert-VerifiableMock
-    }
-}
-
-describe 'Write-Console' {
-
-    it 'it accepts empty string' {
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { !$inputString -and !$NoNewline -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-Console "" | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it passes strings with no tokens' {
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { $inputString -eq "test string" -and !$NoNewline -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-Console "test string" | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it passes NoNewLine switch' {
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { $inputString -eq "test string" -and $NoNewline -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-Console "test string" -NoNewLine | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it manages a color token at the beginning of a string' {
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { !$inputString -and $NoNewline -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { $inputString -eq "test string" -and !$NoNewline -and "red" -eq $ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-Console "{c:red}test string" | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it manages a color token in the middle of a string' {
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { $inputString -eq "test" -and $NoNewline -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { $inputString -eq " string" -and !$NoNewline -and "red" -eq $ForegroundColor -and !$BackgroundColor } -Verifiable
-        Write-Console "test{c:red} string" | Out-Null
-        Assert-VerifiableMock
-    }
-
-    it 'it manages foreground and background tokens' {
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { $inputString -eq "test" -and $NoNewline -and !$ForegroundColor -and !$BackgroundColor } -Verifiable
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { $inputString -eq " str" -and $NoNewline -and "red" -eq $ForegroundColor -and !$BackgroundColor } -Verifiable
-        mock -CommandName 'Write-ConsoleColors' -ModuleName NLCommon -ParameterFilter { $inputString -eq "ing" -and !$NoNewline -and "red" -eq $ForegroundColor -and "blue" -eq $BackgroundColor } -Verifiable
-        Write-Console "test{c:red} str{b:blue}ing" | Out-Null
-        Assert-VerifiableMock
-    }
-}
-
-describe 'NLedgerLocation' {
-
-    it 'it returns the path to production deployment if exists' { 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        $result = NLedgerLocation        
-        $result | should be ([System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\.."))
-        Assert-VerifiableMock
-    }
-
-    it 'it returns the path to debug deployment if it only exists' {
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        $result = NLedgerLocation        
-        $result | should be ([System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release"))
-        Assert-VerifiableMock
-    }
-
-    it 'it returns the path to release deployment if it only exists' {
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        $result = NLedgerLocation        
-        $result | should be ([System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug"))
-        Assert-VerifiableMock
-    }
-
-    it 'it raises exception if neither production nor debug nor release exists' {
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        { $result = NLedgerLocation } | should throw "Cannot find NLedger-cli.exe"
-        Assert-VerifiableMock
-    }
-
-    it 'it returns the path to release deployment if it is earlier than debug' {
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Get-Item' { return ([PsCustomObject]@{ LastWriteTime=(Get-Date -Year 2018 -Month 1 -Day 1 )}) } -ParameterFilter { $Path -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug\NLedger-cli.exe") } 
-        mock -ModuleName "NLCommon" -CommandName 'Get-Item' { return ([PsCustomObject]@{ LastWriteTime=(Get-Date -Year 2018 -Month 2 -Day 1 )}) } -ParameterFilter { $Path -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release\NLedger-cli.exe") } 
-        $result = NLedgerLocation        
-        $result | should be ([System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release"))
-        Assert-VerifiableMock
-    }
-
-    it 'it returns the path to debug deployment if it is earlier than release' {
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $false } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release\NLedger-cli.exe") -and $PathType -eq "Leaf" } 
-        mock -ModuleName "NLCommon" -CommandName 'Get-Item' { return ([PsCustomObject]@{ LastWriteTime=(Get-Date -Year 2018 -Month 2 -Day 1 )}) } -ParameterFilter { $Path -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug\NLedger-cli.exe") } 
-        mock -ModuleName "NLCommon" -CommandName 'Get-Item' { return ([PsCustomObject]@{ LastWriteTime=(Get-Date -Year 2018 -Month 1 -Day 1 )}) } -ParameterFilter { $Path -eq [System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Release\NLedger-cli.exe") } 
-        $result = NLedgerLocation        
-        $result | should be ([System.IO.Path]::GetFullPath("$Script:NLCommonScriptPath\..\..\Source\NLedger.CLI\bin\Debug"))
-        Assert-VerifiableMock
-    }
-}
\ No newline at end of file
diff --git a/Contrib/NLManagement/NonDeliverable/NLManagement.RunTests.cmd b/Contrib/NLManagement/NonDeliverable/NLManagement.RunTests.cmd
deleted file mode 100644
index 23e10684..00000000
--- a/Contrib/NLManagement/NonDeliverable/NLManagement.RunTests.cmd
+++ /dev/null
@@ -1 +0,0 @@
-@Powershell -NoLogo -ExecutionPolicy RemoteSigned -Command "Import-Module Pester; Invoke-Pester -EnableExit -OutputFile '%~dp0TestResults.xml' %~dp0."
\ No newline at end of file
diff --git a/Contrib/NLManagement/NonDeliverable/NLSetup.Tests.ps1 b/Contrib/NLManagement/NonDeliverable/NLSetup.Tests.ps1
deleted file mode 100644
index dbc87635..00000000
--- a/Contrib/NLManagement/NonDeliverable/NLSetup.Tests.ps1
+++ /dev/null
@@ -1,49 +0,0 @@
-# Tests for NLedger Setup module (NLSetup.ps1)
-# Based on Pester unit testing framework (https://github.com/pester/Pester)
-# Pestel 4 or higher needs to be installed by the command: Install-Module -Name Pester -Force -SkipPublisherCheck
-# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
-
-[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-Import-Module $Script:ScriptPath\..\NLSetup.psm1 -Force
-
-describe 'UpdateConfigXml' {
-
-    it 'should check xml structure' {
-        { UpdateConfigXml -xml $null } | Should Throw
-        { UpdateConfigXml -xml ([xml]'') } | Should Throw
-        { UpdateConfigXml -xml ([xml]'') } | Should Not Throw
-    }
-
-    it 'should add appSettings' {
-        (UpdateConfigXml -xml ([xml]'')).OuterXml | Should Be ''
-        (UpdateConfigXml -xml ([xml]'')).OuterXml | Should Be ''
-    }
-
-    it 'should add element' {
-        $addOrUpdate = @{ "key1"="value1" }
-        (UpdateConfigXml -xml ([xml]'') -addOrUpdate $addOrUpdate).OuterXml | Should Be ''
-        $addOrUpdate = @{ "key1"="value1" }
-        (UpdateConfigXml -xml ([xml]'') -addOrUpdate $addOrUpdate).OuterXml | Should Be ''
-        $addOrUpdate = @{ "key2"="value2" }
-        (UpdateConfigXml -xml ([xml]'') -addOrUpdate $addOrUpdate).OuterXml | Should Be ''
-    }
-
-    it 'should update element' {
-        $addOrUpdate = @{ "key1"="value2" }
-        (UpdateConfigXml -xml ([xml]'') -addOrUpdate $addOrUpdate).OuterXml | Should Be ''
-        $addOrUpdate = @{ "key2"="value3" }
-        (UpdateConfigXml -xml ([xml]'') -addOrUpdate $addOrUpdate).OuterXml | Should Be ''
-    }
-
-    it 'should remove element' {
-        $remove = @( "key1" )
-        (UpdateConfigXml -xml ([xml]'') -remove $remove).OuterXml | Should Be ''
-        $remove = @( "key1" )
-        (UpdateConfigXml -xml ([xml]'') -remove $remove).OuterXml | Should Be ''
-        $remove = @( "key2" )
-        (UpdateConfigXml -xml ([xml]'') -remove $remove).OuterXml | Should Be ''
-    }
-}
-
-
-
diff --git a/Contrib/NLManagement/NonDeliverable/NLWhere.Tests.ps1 b/Contrib/NLManagement/NonDeliverable/NLWhere.Tests.ps1
deleted file mode 100644
index 2eb3067a..00000000
--- a/Contrib/NLManagement/NonDeliverable/NLWhere.Tests.ps1
+++ /dev/null
@@ -1,228 +0,0 @@
-# Tests for NLedger Where module (NLWhere.psm1)
-# Based on Pester unit testing framework (https://github.com/pester/Pester)
-# Pestel 4 or higher needs to be installed by the command: Install-Module -Name Pester -Force -SkipPublisherCheck
-# If you need to enable execution of PS files - execute: set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
-
-[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-Import-Module $Script:ScriptPath\..\NLWhere.psm1 -Force
-
-describe 'Get-NLedgerInstances' {
-
-    Context "Collecting NLedger Instances" {
-
-        [string]$ParentPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath\..")
-        [string]$RootPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath\..\..")
-        [string]$env:RootPath = $RootPath # It is needed for return value mock block; it does not have access to the current context
-
-        mock -ModuleName NLWhere getFullPath { throw "Unexpected test path" } 
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\..\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\..\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\..\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\..\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Contrib\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Contrib\bin\netcoreapp3.1\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\bin\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Contrib\ledger.exe" } -ParameterFilter { $path -eq "$ParentPath\..\ledger.exe" }
-
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Contrib\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Contrib\bin\netcoreapp3.1\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Contrib\ledger.exe" -and $PathType -eq "Leaf" }
-
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:01", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:02", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:03", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:04", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:05", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Contrib\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:06", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Contrib\bin\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:07", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Contrib\ledger.exe" }
-
-        $result = Get-NLedgerInstances
-
-        it 'found all available NLedger instances' { $result.Count | Should -Be 7 }
-
-        it 'Validate NLedger instance 1 - Path' { ($result | Select-Object -Index 0).Path | Should -Be "$RootPath\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" }
-        it 'Validate NLedger instance 1 - Date' { ($result | Select-Object -Index 0).Date | Should -Be $([DateTime]::ParseExact("2020/10/10 09:00:01", "yyyy/MM/dd hh:mm:ss", $null)) }
-        it 'Validate NLedger instance 1 - IsDebug' { ($result | Select-Object -Index 0).IsDebug | Should -Be $true }
-        it 'Validate NLedger instance 1 - IsRelease' { ($result | Select-Object -Index 0).IsRelease | Should -Be $false }
-        it 'Validate NLedger instance 1 - IsPackage' { ($result | Select-Object -Index 0).IsPackage | Should -Be $false }
-        it 'Validate NLedger instance 1 - IsCore' { ($result | Select-Object -Index 0).IsCore | Should -Be $false }
-        it 'Validate NLedger instance 1 - IsAlias' { ($result | Select-Object -Index 0).IsAlias | Should -Be $false }
-
-        it 'Validate NLedger instance 2 - Path' { ($result | Select-Object -Index 1).Path | Should -Be "$RootPath\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" }
-        it 'Validate NLedger instance 2 - Date' { ($result | Select-Object -Index 1).Date | Should -Be $([DateTime]::ParseExact("2020/10/10 09:00:02", "yyyy/MM/dd hh:mm:ss", $null)) }
-        it 'Validate NLedger instance 2 - IsDebug' { ($result | Select-Object -Index 1).IsDebug | Should -Be $true }
-        it 'Validate NLedger instance 2 - IsRelease' { ($result | Select-Object -Index 1).IsRelease | Should -Be $false }
-        it 'Validate NLedger instance 2 - IsPackage' { ($result | Select-Object -Index 1).IsPackage | Should -Be $false }
-        it 'Validate NLedger instance 2 - IsCore' { ($result | Select-Object -Index 1).IsCore | Should -Be $true }
-        it 'Validate NLedger instance 2 - IsAlias' { ($result | Select-Object -Index 1).IsAlias | Should -Be $false }
-
-        it 'Validate NLedger instance 3 - Path' { ($result | Select-Object -Index 2).Path | Should -Be "$RootPath\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" }
-        it 'Validate NLedger instance 3 - Date' { ($result | Select-Object -Index 2).Date | Should -Be $([DateTime]::ParseExact("2020/10/10 09:00:03", "yyyy/MM/dd hh:mm:ss", $null)) }
-        it 'Validate NLedger instance 3 - IsDebug' { ($result | Select-Object -Index 2).IsDebug | Should -Be $false }
-        it 'Validate NLedger instance 3 - IsRelease' { ($result | Select-Object -Index 2).IsRelease | Should -Be $true }
-        it 'Validate NLedger instance 3 - IsPackage' { ($result | Select-Object -Index 2).IsPackage | Should -Be $false }
-        it 'Validate NLedger instance 3 - IsCore' { ($result | Select-Object -Index 2).IsCore | Should -Be $false }
-        it 'Validate NLedger instance 3 - IsAlias' { ($result | Select-Object -Index 2).IsAlias | Should -Be $false }
-
-        it 'Validate NLedger instance 4 - Path' { ($result | Select-Object -Index 3).Path | Should -Be "$RootPath\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" }
-        it 'Validate NLedger instance 4 - Date' { ($result | Select-Object -Index 3).Date | Should -Be $([DateTime]::ParseExact("2020/10/10 09:00:04", "yyyy/MM/dd hh:mm:ss", $null)) }
-        it 'Validate NLedger instance 4 - IsDebug' { ($result | Select-Object -Index 3).IsDebug | Should -Be $false }
-        it 'Validate NLedger instance 4 - IsRelease' { ($result | Select-Object -Index 3).IsRelease | Should -Be $true }
-        it 'Validate NLedger instance 4 - IsPackage' { ($result | Select-Object -Index 3).IsPackage | Should -Be $false }
-        it 'Validate NLedger instance 4 - IsCore' { ($result | Select-Object -Index 3).IsCore | Should -Be $true }
-        it 'Validate NLedger instance 4 - IsAlias' { ($result | Select-Object -Index 3).IsAlias | Should -Be $false }
-
-        it 'Validate NLedger instance 5 - Path' { ($result | Select-Object -Index 4).Path | Should -Be "$RootPath\Contrib\NLedger-cli.exe" }
-        it 'Validate NLedger instance 5 - Date' { ($result | Select-Object -Index 4).Date | Should -Be $([DateTime]::ParseExact("2020/10/10 09:00:05", "yyyy/MM/dd hh:mm:ss", $null)) }
-        it 'Validate NLedger instance 5 - IsDebug' { ($result | Select-Object -Index 4).IsDebug | Should -Be $false }
-        it 'Validate NLedger instance 5 - IsRelease' { ($result | Select-Object -Index 4).IsRelease | Should -Be $false }
-        it 'Validate NLedger instance 5 - IsPackage' { ($result | Select-Object -Index 4).IsPackage | Should -Be $true }
-        it 'Validate NLedger instance 5 - IsCore' { ($result | Select-Object -Index 4).IsCore | Should -Be $false }
-        it 'Validate NLedger instance 5 - IsAlias' { ($result | Select-Object -Index 4).IsAlias | Should -Be $false }
-
-        it 'Validate NLedger instance 6 - Path' { ($result | Select-Object -Index 5).Path | Should -Be "$RootPath\Contrib\bin\netcoreapp3.1\NLedger-cli.exe" }
-        it 'Validate NLedger instance 6 - Date' { ($result | Select-Object -Index 5).Date | Should -Be $([DateTime]::ParseExact("2020/10/10 09:00:06", "yyyy/MM/dd hh:mm:ss", $null)) }
-        it 'Validate NLedger instance 6 - IsDebug' { ($result | Select-Object -Index 5).IsDebug | Should -Be $false }
-        it 'Validate NLedger instance 6 - IsRelease' { ($result | Select-Object -Index 5).IsRelease | Should -Be $false }
-        it 'Validate NLedger instance 6 - IsPackage' { ($result | Select-Object -Index 5).IsPackage | Should -Be $true }
-        it 'Validate NLedger instance 6 - IsCore' { ($result | Select-Object -Index 5).IsCore | Should -Be $true }
-        it 'Validate NLedger instance 6 - IsAlias' { ($result | Select-Object -Index 5).IsAlias | Should -Be $false }
-
-        it 'Validate NLedger instance 7 - Path' { ($result | Select-Object -Index 6).Path | Should -Be "$RootPath\Contrib\ledger.exe" }
-        it 'Validate NLedger instance 7 - Date' { ($result | Select-Object -Index 6).Date | Should -Be $([DateTime]::ParseExact("2020/10/10 09:00:07", "yyyy/MM/dd hh:mm:ss", $null)) }
-        it 'Validate NLedger instance 7 - IsDebug' { ($result | Select-Object -Index 6).IsDebug | Should -Be $false }
-        it 'Validate NLedger instance 7 - IsRelease' { ($result | Select-Object -Index 6).IsRelease | Should -Be $false }
-        it 'Validate NLedger instance 7 - IsPackage' { ($result | Select-Object -Index 6).IsPackage | Should -Be $true }
-        it 'Validate NLedger instance 7 - IsCore' { ($result | Select-Object -Index 6).IsCore | Should -Be $false }
-        it 'Validate NLedger instance 7 - IsAlias' { ($result | Select-Object -Index 6).IsAlias | Should -Be $true }
-   }
-}
-
-describe 'Select-NLedgerInstance' {
-
-    Context "Collecting NLedger Instances" {
-
-        it 'Returns null if no input instances' { @() | Select-NLedgerInstance | Should -BeNullOrEmpty }
-        it 'Returns null if no instances selected' {
-            $instances = @(
-                [PsCustomObject]@{
-                    Path = "some-path"
-                    Date = [DateTime]::Now
-                    IsDebug = $false
-                    IsRelease = $false
-                    IsPackage = $false
-                    IsCore = $false
-                    IsAlias = $true  # Note: Select-NLedgerInstance ignores an alias
-                })
-            $instances | Select-NLedgerInstance | Should -BeNullOrEmpty }
-        it 'Returns the latest instance' {
-            $instances = @(
-                [PsCustomObject]@{
-                    Path = "some-path1"
-                    Date = [DateTime]::Now
-                    IsDebug = $false
-                    IsRelease = $false
-                    IsPackage = $false
-                    IsCore = $false
-                    IsAlias = $false
-                },
-                [PsCustomObject]@{
-                    Path = "some-path2"
-                    Date = [DateTime]::Now.AddDays(1)
-                    IsDebug = $false
-                    IsRelease = $false
-                    IsPackage = $false
-                    IsCore = $false
-                    IsAlias = $false
-                })
-            ($instances | Select-NLedgerInstance).Path | Should -Be "some-path2" }
-        it 'Prefers .Net Framework by default' {
-            $instances = @(
-                [PsCustomObject]@{
-                    Path = "some-path1"
-                    Date = [DateTime]::Now
-                    IsDebug = $false
-                    IsRelease = $false
-                    IsPackage = $false
-                    IsCore = $true
-                    IsAlias = $false
-                },
-                [PsCustomObject]@{
-                    Path = "some-path2"
-                    Date = [DateTime]::Now
-                    IsDebug = $false
-                    IsRelease = $false
-                    IsPackage = $false
-                    IsCore = $false
-                    IsAlias = $false
-                })
-            ($instances | Select-NLedgerInstance).Path | Should -Be "some-path2" }
-        it 'Prefers .Net Core if switch is added' {
-            $instances = @(
-                [PsCustomObject]@{
-                    Path = "some-path1"
-                    Date = [DateTime]::Now
-                    IsDebug = $false
-                    IsRelease = $false
-                    IsPackage = $false
-                    IsCore = $true
-                    IsAlias = $false
-                },
-                [PsCustomObject]@{
-                    Path = "some-path2"
-                    Date = [DateTime]::Now
-                    IsDebug = $false
-                    IsRelease = $false
-                    IsPackage = $false
-                    IsCore = $false
-                    IsAlias = $false
-                })
-            ($instances | Select-NLedgerInstance -preferCore).Path | Should -Be "some-path1" }
-    }
-}
-
-describe 'Get-NLedgerPath' {
-
-    Context "Getting NLedger path" {
-
-        [string]$ParentPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath\..")
-        [string]$RootPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath\..\..\..")
-        [string]$env:RootPath = $RootPath # It is needed for return value mock block; it does not have access to the current context
-
-        mock -ModuleName NLWhere getFullPath { throw "Unexpected test path" } 
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\..\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\..\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\..\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\..\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Contrib\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Contrib\bin\netcoreapp3.1\NLedger-cli.exe" } -ParameterFilter { $path -eq "$ParentPath\..\bin\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getFullPath { return "$env:RootPath\Contrib\ledger.exe" } -ParameterFilter { $path -eq "$ParentPath\..\ledger.exe" }
-
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Contrib\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Contrib\bin\netcoreapp3.1\NLedger-cli.exe" -and $PathType -eq "Leaf" }
-        mock -ModuleName NLWhere -CommandName 'Test-Path' { return $true } -ParameterFilter { $LiteralPath -eq "$RootPath\Contrib\ledger.exe" -and $PathType -eq "Leaf" }
-
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:01", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Source\NLedger.CLI\bin\Debug\net45\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:02", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Source\NLedger.CLI\bin\Debug\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:03", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Source\NLedger.CLI\bin\Release\net45\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:04", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Source\NLedger.CLI\bin\Release\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:05", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Contrib\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:06", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Contrib\bin\netcoreapp3.1\NLedger-cli.exe" }
-        mock -ModuleName NLWhere getLastWriteTime { return [DateTime]::ParseExact("2020/10/10 09:00:07", "yyyy/MM/dd hh:mm:ss", $null) } -ParameterFilter { $path -eq "$RootPath\Contrib\ledger.exe" }
-
-        it 'Returns path to the latest .Net Framework NLedger ignoring alias - by default' {
-            Get-NLedgerPath | Should -Be "$RootPath\Contrib\NLedger-cli.exe"
-        }
-
-        it 'Returns path to the latest .Net Core NLedger ignoring alias - if switch is enabled' {
-            Get-NLedgerPath -preferCore | Should -Be "$RootPath\Contrib\bin\netcoreapp3.1\NLedger-cli.exe"
-        }
-    }
-}
\ No newline at end of file
diff --git a/Contrib/NLManagement/PsHttpListener.psm1 b/Contrib/NLManagement/PsHttpListener.psm1
deleted file mode 100644
index b9f02ca0..00000000
--- a/Contrib/NLManagement/PsHttpListener.psm1
+++ /dev/null
@@ -1,93 +0,0 @@
-# If you run this script in ISE, you may want to configure Execution Policy by this command:
-# set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
-
-###Add-Type -AssemblyName System.Web
-
-$Global:ActionParams = $null
-$Script:shutdownRequest = $false
-
-function RunListener {
-    [CmdletBinding()]
-    Param(
-        [Parameter(Mandatory=$true)]$actions,
-        [Parameter(Mandatory=$true)][string]$prefix,
-        [Parameter(Mandatory=$false)][scriptblock]$onListenerStart
-    )
-    try
-    {
-        Write-Verbose "Starting listener..."
-        $Script:shutdownRequest = $false
-        $private:listener = New-Object System.Net.HttpListener
-        $private:listener.Prefixes.Add($prefix) | Out-Null
-        $private:listener.Start() | Out-Null
-        Write-Verbose "Listener is started [$prefix]"
-        if($onListenerStart) { $onListenerStart.Invoke() | Out-Null }
-        [bool]$private:cancellation = $false
-        while(!$Script:shutdownRequest) {            
-            Write-Verbose "Listening"
-            $private:task = $private:listener.GetContextAsync();
-            while(!$private:task.Wait(200)) { }
-            Write-Verbose "Processing a request"
-            [System.Net.HttpListenerContext]$private:context = $private:task.Result
-            ProcessRequest $actions $private:context | Out-Null
-        }
-    }
-    finally
-    {
-        Write-Verbose "Stopping listener..."
-        $private:listener.Stop()
-        Write-Verbose "Listener is stopped"
-    }
-}
-
-function ProcessRequest {
-    [CmdletBinding()]
-    Param(
-        [Parameter(Mandatory=$true)]$actions,
-        [Parameter(Mandatory=$True)] [System.Net.HttpListenerContext]$context
-    )
-
-    [string]$private:url = $context.Request.Url.LocalPath
-    Write-Verbose "Request URL: $private:url"
-
-    foreach($private:act in $actions) {
-        if ($private:url -match $private:act.pattern) {
-            Write-Verbose "Pattern '$($private:act.pattern)' matches given URL"
-            $Global:ActionParams = $Matches
-            $private:response = $private:act.action.Invoke()
-            Write-Verbose "Invoke response: $private:response"
-            WriteResponse $context $private:response | Out-Null
-            Write-Verbose "Request is properly handled"
-            return
-        }
-    }
-
-    Write-Verbose "No matched actions found; resource not found"
-    WriteResponse $context "Resource Not Found" 404 | Out-Null
-}
-
-function WriteResponse {
-    [CmdletBinding()]
-    Param(
-        [Parameter(Mandatory=$True)] [System.Net.HttpListenerContext]$context,
-        [Parameter(Mandatory=$false)][string]$response = "OK",
-        [Parameter(Mandatory=$false)][int]$statusCode = 200
-    )
-
-    $private:buffer = [System.Text.Encoding]::UTF8.GetBytes($response)
-    $context.Response.StatusCode = $statusCode
-    $context.Response.ContentLength64 = $private:buffer.Length
-    $Context.Response.ContentType = "text/html" ##[System.Web.MimeMapping]::GetMimeMapping(".html")
-    $context.Response.OutputStream.Write($private:buffer,0,$private:buffer.Length)
-    $context.Response.OutputStream.Close()            
-}
-
-function getShutdown() {
-    [CmdletBinding()]
-    Param()
-    Write-Verbose "Requested shutdown"
-    $Script:shutdownRequest = $True
-    return "OK"
-}
-
-Export-ModuleMember -function * -alias *
\ No newline at end of file
diff --git a/Contrib/NLTestToolkit/NLTest.Launcher.ps1 b/Contrib/NLTestToolkit/NLTest.Launcher.ps1
deleted file mode 100644
index edb47048..00000000
--- a/Contrib/NLTestToolkit/NLTest.Launcher.ps1
+++ /dev/null
@@ -1,95 +0,0 @@
-# This script opens PS console to execute NLedger test interactively.
-[CmdletBinding()]
-Param()
-
-[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-Import-Module $Script:ScriptPath\..\NLManagement\NLWhere.psm1 -Force
-
-[string]$nlTestPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath/NLTest.ps1")
-if (!(Test-Path -LiteralPath $nlTestPath -PathType Leaf)) {throw "Cannot find '$nlTestPath'"}
-
-function run {
-[CmdletBinding()]
-Param(
-    [Parameter(Mandatory=$False)][AllowEmptyString()][string]$filterRegex = ""
-)
-    if ([string]::IsNullOrWhiteSpace($filterRegex)) {
-        $null = (& $nlTestPath -showReport)
-    } else {
-        $null = (& $nlTestPath -showReport -filterRegex $filterRegex)
-    }
-}
-
-function xrun {
-[CmdletBinding()]
-Param(
-    [Parameter(Mandatory=$False)][AllowEmptyString()][string]$filterRegex = ""
-)
-    if ([string]::IsNullOrWhiteSpace($filterRegex)) {
-        $null = (& $nlTestPath)
-    } else {
-        $null = (& $nlTestPath -filterRegex $filterRegex)
-    }
-}
-
-function all {
-[CmdletBinding()]
-Param(
-    [Parameter(Mandatory=$False)][AllowEmptyString()][string]$filterRegex = ""
-)
-    if ([string]::IsNullOrWhiteSpace($filterRegex)) {
-        $null = (& $nlTestPath -disableIgnoreList)
-    } else {
-        $null = (& $nlTestPath -disableIgnoreList -filterRegex $filterRegex)
-    }
-}
-
-function platform {
-[CmdletBinding()]
-Param(
-    [Switch][bool]$core = $false
-)
-    $private:platform = $(if ($core) {".Net Core"} else {".Net Framework"})
-    $private:path = Get-NLedgerPath -preferCore:$core
-    if (!$private:path) { throw "Cannot find NLedger executable file [$private:platform]" }
-    $env:nledgerExePath = $private:path
-
-    write-host "NLedger executable file [$private:platform]: $private:path`r`n"
-}
-
-
-function help {
-[CmdletBinding()]
-Param()
-     write-host "Interactive testing console helps you execute NLedger test files that are available on the disk.`r`n"
-     write-host -NoNewline "It supports several short commands that perform typical activities:`r`n PS>"
-     write-host -NoNewline -ForegroundColor Yellow "run"
-     write-host -NoNewline "              execute all test files and show a report in the browser;`r`n PS>"
-     write-host -NoNewline -ForegroundColor Yellow "run CRITERIA"
-     write-host -NoNewline "     execute tests that match the criteria and show a report;`r`n PS>"
-     write-host -NoNewline -ForegroundColor Yellow "xrun"
-     write-host -NoNewline "             execute all test files and show a summary in the console;`r`n PS>"
-     write-host -NoNewline -ForegroundColor Yellow "xrun CRITERIA"
-     write-host -NoNewline "    execute matched test files and show a summary in the console;`r`n PS>"
-     write-host -NoNewline -ForegroundColor Yellow "all"
-     write-host -NoNewline "              execute all test including disabled by the ignore list; the summary is in the console;`r`n PS>"
-     write-host -NoNewline -ForegroundColor Yellow "all CRITERIA"
-     write-host -NoNewline "     execute matched test files including disabled; the summary is in the console;`r`n PS>"
-     write-host -NoNewline -ForegroundColor Yellow "platform [-core]"
-     write-host -NoNewline " select .Net platform to execute tests; .Net Framework by default or .Net Core with '-core' switch;`r`n PS>"
-     write-host -NoNewline -ForegroundColor Yellow "help"
-     write-host -NoNewline "             show help page again.`r`n"
-     write-host -NoNewline "`r`nTesting script can be called directly:`r`n PS>"
-     write-host -ForegroundColor Yellow ".\nltest.ps1 OPTIONAL ARGUMENTS"
-     write-host -NoNewline "Use 'get-help' to get detail information about testing script arguments:`r`n PS>"
-     write-host -ForegroundColor Yellow "get-help .\nltest.ps1"
-     write-host -NoNewline "`r`nType '"
-     write-host -NoNewline -ForegroundColor Yellow "exit"
-     write-host "' or close the console window when you finish.`r`n"
-}
-
-
-write-host -ForegroundColor White "NLedger Testing Toolkit - Interactive console"
-write-host ""
-help
-platform
diff --git a/Contrib/NLTestToolkit/NLTest.cmd b/Contrib/NLTestToolkit/NLTest.cmd
deleted file mode 100644
index 4b61959d..00000000
--- a/Contrib/NLTestToolkit/NLTest.cmd
+++ /dev/null
@@ -1,2 +0,0 @@
-@PowerShell -NoExit -ExecutionPolicy RemoteSigned -File "%~dp0NLTest.Launcher.ps1"
-@exit
\ No newline at end of file
diff --git a/Contrib/Python/GetPythonEnvironment.Console.cmd b/Contrib/Python/GetPythonEnvironment.Console.cmd
deleted file mode 100644
index 6adad70b..00000000
--- a/Contrib/Python/GetPythonEnvironment.Console.cmd
+++ /dev/null
@@ -1,2 +0,0 @@
-@PowerShell -NoLogo -NoExit -ExecutionPolicy RemoteSigned -File "%~dp0GetPythonEnvironment.ps1"
-@exit
\ No newline at end of file
diff --git a/Contrib/Python/GetPythonEnvironment.ps1 b/Contrib/Python/NLedgerPyEnvironment.psm1
similarity index 51%
rename from Contrib/Python/GetPythonEnvironment.ps1
rename to Contrib/Python/NLedgerPyEnvironment.psm1
index 85223f37..462fa20c 100644
--- a/Contrib/Python/GetPythonEnvironment.ps1
+++ b/Contrib/Python/NLedgerPyEnvironment.psm1
@@ -1,74 +1,24 @@
 <#
 .SYNOPSIS
-Getting NLedger Python extension ready to work
+NLedger Python extension management
 
 .DESCRIPTION
-This script manages NLedger Python connection settings and dependent external software. Basic responsibilities are:
-- Validating local Python deployment to check compliance with NLedger requirements
-- Optional installing and configuring embedded Python deployment (any versions; Windows only)
-- Producing NLedger Python Extension settings file that allows NLedger to connect and use Python 
-- Enabling Python Extension in NLedger configuration settings
-- Optional installing NLedger Python module to Python environment that allows to use NLedger capabilities in Python session
-
-The provided commands allow you configure the connection either automatically or with any needed granularity. The commands are:
-Informational functions:
-- discover - Find Python deployments on the local machine
-- status - Show NLedger Python integration status
-Connection management function:
-- connect - Create a connection file that references to a Python deployment
-- disconnect - Remove the connection file
-- enable - Enable Python extension in NLedger settings (creates connection settings if they were not created yet)
-- disable - Disable Python extension in NLedger settings
-Technical functions for advanced configuring:
-- install-python - Install an isolated embedded Python (Windows only)
-- uninstall-python - Uninstall embedded Python
-- install-wheel - Install Wheel module (required to build Ledger package)
-- uninstall-wheel - Uninstall Wheel module
-- install-pythonnet - Install PythonNet module
-- uninstall-pythonnet - Uninstall PythonNet module
-- install-ledger - Install Ledger module (and PythonNet if it has not been installed yet)
-- uninstall-ledger - Uninstall Ledger module
-- test-ledger - Run Ledger module tests (ledger_tests.py)
-- test-connection - Return NLedger Python connection settings in a technical format
-
-Hint: in most cases, you only need to execute 'enable' command to configure and enable Python integration.
-The commands can be executed by running the script with '-command' parameter or in console mode by typing a command name.
-
-.PARAMETER command
-Command to execute. You can get detail information for every command by typing 'get-help [command]' in the console
+Provides functions for managing NLedger Python environment
 
-.PARAMETER path
-Optional path to Python executable file
-
-.PARAMETER version
-Optional version of dependent software
+.NOTES
+Author: Dmitry Merzlyakov
+Date:   December 14, 2023
+#> 
 
-Note: use 'set-executionpolicy -ExecutionPolicy RemoteSigned -Scope Process' to run the script in dev terminal
-
-#>
 [CmdletBinding()]
-Param(
-    [Parameter(Mandatory=$False)][ValidateSet("discover","status","connect","disconnect","enable","disable","test-connection","install-python","install-wheel","install-pythonnet","install-ledger","uninstall-python","uninstall-wheel","uninstall-pythonnet","uninstall-ledger","test-ledger")]$command,
-    [Parameter(Mandatory=$False)][string]$path,
-    [Parameter(Mandatory=$False)][string]$version,
-    [Switch][bool]$noAnsiColor = $False
-
-)
-
-trap 
-{
-  write-error $_ 
-  exit 1 
-}
+Param()
 
 [string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-Import-Module $Script:ScriptPath/PyManagement.psm1 -Force
-Import-Module $Script:ScriptPath/../NLManagement/NLSetup.psm1 -Force
-Import-Module $Script:ScriptPath/../NLManagement/NLCommon.psm1 -Force
-
-[bool]$Script:isWindowsPlatform = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)
-
-if ($noAnsiColor) {$Global:ANSI_Colorization=$False}
+Import-Module $Script:ScriptPath/PyManagement.psm1
+Import-Module $Script:ScriptPath/../Common/SysCommon.psm1
+Import-Module $Script:ScriptPath/../Common/SysPlatform.psm1
+Import-Module $Script:ScriptPath/../Common/SysConsole.psm1
+Import-Module $Script:ScriptPath/../Common/NLedgerConfig.psm1
 
 ## Default settings
 
@@ -250,9 +200,9 @@ function Get-StatusInfo {
             $Private:info["py_status_error"] = $Private:info["py_info"].status_error
         }
     }
-    $Private:info["nledger_binaries"] = (Test-NLedgerBinaryLoaded)
+    $Private:info["nledger_binaries"] = (Test-NLedgerAssemblyLoaded)
     if ($Private:info["nledger_binaries"]) {
-        $Private:info["extension_provider"] = ($(GetConfigData).Settings | Where-Object { $_.Name -eq "ExtensionProvider" } | Select-Object -First 1).EffectiveSettingValue
+        $Private:info["extension_provider"] = ($(Get-NLedgerConfigData).Settings | Where-Object { $_.Name -eq "ExtensionProvider" } | Select-Object -First 1).EffectiveSettingValue
         $Private:info["is_python_extension_enabled"] = $Private:info["extension_provider"] -eq "python"
     }
 
@@ -279,14 +229,14 @@ function Write-StatusInfo {
             }
         } else {
             $Private:info["Python Connection"] = ("{c:DarkRed}[Disabled]{f:Normal} Connection is not configured" | Out-AnsiString)
-            $Private:info["Connection Settings"] = ("{c:DarkYellow}[File not found]{f:Normal} $($_.py_settings_filename)`nUse Set-PythonConnection command to create a connection file" | Out-AnsiString)
+            $Private:info["Connection Settings"] = ("{c:DarkYellow}[File not found]{f:Normal} $($_.py_settings_filename)`nUse '{c:DarkYellow}python-connect{f:Normal}' command to create a connection file" | Out-AnsiString)
         }
         if ($_.nledger_binaries) {
             if ($_.is_python_extension_enabled) {
                 $Private:info["Python Extension"] = ("{c:DarkGreen}[Enabled]{f:Normal} Extension is active" | Out-AnsiString)
             } else {
                 if ([String]::IsNullOrEmpty($_.extension_provider)) {
-                    $Private:info["Python Extension"] = ("{c:DarkRed}[Disabled]{f:Normal} Extension provider is not set.`nUse {c:DarkYellow}enable{f:Normal} command to set correct provider." | Out-AnsiString)
+                    $Private:info["Python Extension"] = ("{c:DarkRed}[Disabled]{f:Normal} Extension provider is not set.`nUse '{c:DarkYellow}python-enable{f:Normal}' command to set correct provider." | Out-AnsiString)
                 } else {
                     $Private:info["Python Extension"] = ("{c:DarkRed}[Disabled]{f:Normal} Current extension provider is '$($_.extension_provider)' whereas 'python' expected`nUse {c:DarkYellow}enable{f:Normal} command to set correct provider." | Out-AnsiString)
                 }
@@ -300,18 +250,18 @@ function Write-StatusInfo {
     End { $Private:infos | Format-List }
 }
 
-function Test-Connection {
+function Get-PythonConnectionInfo {
     [CmdletBinding()]
     Param()
 
     $Private:settings = Get-PythonIntegrationSettings
     if ($Private:settings) {
         $Private:pyInfo = Get-PyInfo -pyExecutable $Private:settings.PyExecutable
-        return [System.Management.Automation.PSSerializer]::Serialize([PSCustomObject]@{
+        return [PSCustomObject]@{
             IsConnectionValid = -not [Boolean]$Private:pyInfo.status_error
             IsWheelInstalled = [Boolean]$Private:pyInfo.pyWheelInfo
             IsPythonNetInstalled = [Boolean]$Private:pyInfo.pyNetModuleInfo
-        })
+        }
     }
     return $null
 }
@@ -350,45 +300,48 @@ PythonNet and Ledger modules are optional and needs to be installed if you want
 Optional parameter containing a full path to a Python executable file.
 
 #>
-function Discover {
+function Search-PythonDeployments {
     [CmdletBinding()]
+    [Alias("python-discover")]
     Param([Parameter(Mandatory=$False)][string]$path)
   
-    Write-Output ""
-    if($path) {
-        Write-Output ("{c:DarkCyan}[Local Python]{f:Normal} Testing Python by path: $path" | Out-AnsiString )
-        Get-PyInfo -pyExecutable $path | Write-PyInfo
+    Assert-CommandCompleted {
         Write-Output ""
-      
-    } else {
-        Write-Verbose "Search local Python"
-        $path = Search-PyExecutable
-        if ($path) {
-            Write-Output ("{c:DarkCyan}[Local Python]{f:Normal} Found by path: $path" | Out-AnsiString )
+        if($path) {
+            Write-Output ("{c:DarkCyan}[Local Python]{f:Normal} Testing Python by path: $path" | Out-AnsiString )
             Get-PyInfo -pyExecutable $path | Write-PyInfo
-        } else { Write-Output ("{c:DarkCyan}[Local Python]{f:Normal} Not found" | Out-AnsiString )}
-        Write-Output ""
-  
-        if ($Script:isWindowsPlatform) {
-          Write-Verbose "Search embed Python"
-          $embeds = Search-PyEmbedInstalled -appPrefix $appPrefix -pyPlatform $pyPlatform -fullPath
-          if (!$embeds) { 
-              Write-Output ("{c:DarkCyan}[Embed Python]{f:Normal} Not found" | Out-AnsiString )
-          } else {
-              Write-Output ("{c:DarkCyan}[Embed Python]{f:Normal} Found $(($embeds | Measure-Object).Count) deployment(s)" | Out-AnsiString )
-              $embeds | ForEach-Object { Get-PyInfo -pyExecutable $_ } | Write-PyInfo
-          }
-        }
-          
-        Write-Verbose "Check NLedger Python settings"
-        $settings = Get-PythonIntegrationSettings
-        if($settings) {
-            Write-Output ( "{c:DarkCyan}[NLedger Settings]{f:Normal} Found connection settings file: $Script:settingsFileName" | Out-AnsiString )
-            Write-Output "Configured path to Python executable: $($settings.PyExecutable)"
-            Get-PyInfo -pyExecutable $settings.PyExecutable | Write-PyInfo
-        } else { Write-Output ("{c:DarkCyan}[NLedger Settings]{f:Normal} Not found (no file $Script:settingsFileName)" | Out-AnsiString ) }
-        Write-Output ""
-    }  
+            Write-Output ""
+        
+        } else {
+            Write-Verbose "Search local Python"
+            $path = Search-PyExecutable
+            if ($path) {
+                Write-Output ("{c:DarkCyan}[Local Python]{f:Normal} Found by path: $path" | Out-AnsiString )
+                Get-PyInfo -pyExecutable $path | Write-PyInfo
+            } else { Write-Output ("{c:DarkCyan}[Local Python]{f:Normal} Not found" | Out-AnsiString )}
+            Write-Output ""
+    
+            if (Test-IsWindows) {
+            Write-Verbose "Search embed Python"
+            $embeds = Search-PyEmbedInstalled -appPrefix $appPrefix -pyPlatform $pyPlatform -fullPath
+            if (!$embeds) { 
+                Write-Output ("{c:DarkCyan}[Embed Python]{f:Normal} Not found" | Out-AnsiString )
+            } else {
+                Write-Output ("{c:DarkCyan}[Embed Python]{f:Normal} Found $(($embeds | Measure-Object).Count) deployment(s)" | Out-AnsiString )
+                $embeds | ForEach-Object { Get-PyInfo -pyExecutable $_ } | Write-PyInfo
+            }
+            }
+            
+            Write-Verbose "Check NLedger Python settings"
+            $settings = Get-PythonIntegrationSettings
+            if($settings) {
+                Write-Output ( "{c:DarkCyan}[NLedger Settings]{f:Normal} Found connection settings file: $Script:settingsFileName" | Out-AnsiString )
+                Write-Output "Configured path to Python executable: $($settings.PyExecutable)"
+                Get-PyInfo -pyExecutable $settings.PyExecutable | Write-PyInfo
+            } else { Write-Output ("{c:DarkCyan}[NLedger Settings]{f:Normal} Not found (no file $Script:settingsFileName)" | Out-AnsiString ) }
+            Write-Output ""
+        }  
+    }
 }
 
 <#
@@ -403,7 +356,7 @@ Settings include a full path to a Python executable file, Python HOME and PATH v
 The command is intended to create NLedger Python extension settings automatically by extracting needed information from an existing Python deployment.
 
 In the first step, it determines the location of Python deployment in the following order:
-- If 'path' parameter is specified, it uses the parameter value explicitely
+- If 'path' parameter is specified, it uses the parameter value explicitly
 - If 'embed' parameter is specified, it installs an embedded Python in NLedger application folder and refers to it
 - If extension settings file already exists, it extracts the path from the file
 - Otherwise, it tries to find a local Python installation.
@@ -420,52 +373,55 @@ If this parameter is specified, the command installs and refers to the specified
 This parameter is available on Windows only.
 
 #>
-function Connect {
+function Connect-PythonDeployment {
     [CmdletBinding()]
+    [Alias("python-connect")]
     Param(
         [Parameter(Mandatory=$False)][string]$path,
         [Parameter(Mandatory=$False)][string]$embed
     )
 
-    if ($path -and $embed) { throw "Connect command cannot get both 'path' and 'embed' parameters at the same time."}
+    Assert-CommandCompleted {
+        if ($path -and $embed) { throw "Connect command cannot get both 'path' and 'embed' parameters at the same time."}
 
-    Write-Output ""
-    $Private:settings = Get-PythonIntegrationSettings
+        Write-Output ""
+        $Private:settings = Get-PythonIntegrationSettings
 
-    if (!$path -and !$embed) {
-        Write-Verbose "Auto-configuring parameters. Checking existing settings first."
-        if ($Private:settings) {
-            $path = $settings.PyExecutable
-            Write-Output "Found path '$path' specified in NLedger Python settings ($Script:settingsFileName)"
-        } else {
-            Write-Verbose "No settings file. Searching local Python"
-            $path = Search-PyExecutable
-            if (!$path) {
-                if ($Script:isWindowsPlatform) {
-                    $embed = $pyEmbedVersion
-                    Write-Output "Auto-configuring: use embed Python $pyEmbedVersion (since local Python not found and no settings file)"
-                } else { throw "Auto-configuring is not possible: local Python not found and no settings file. Specify 'path' parameter." }
-            }
-        }        
-    }
+        if (!$path -and !$embed) {
+            Write-Verbose "Auto-configuring parameters. Checking existing settings first."
+            if ($Private:settings) {
+                $path = $settings.PyExecutable
+                Write-Output "Found path '$path' specified in NLedger Python settings ($Script:settingsFileName)"
+            } else {
+                Write-Verbose "No settings file. Searching local Python"
+                $path = Search-PyExecutable
+                if (!$path) {
+                    if (Test-IsWindows) {
+                        $embed = $pyEmbedVersion
+                        Write-Output "Auto-configuring: use embed Python $pyEmbedVersion (since local Python not found and no settings file)"
+                    } else { throw "Auto-configuring is not possible: local Python not found and no settings file. Specify 'path' parameter." }
+                }
+            }        
+        }
 
-    if ($embed) {
-        Write-Verbose "Installing embedded python $embed"
-        $path = Search-PyExecutable -pyHome (Get-PyEmbed -appPrefix $appPrefix -pyVersion $embed -pyPlatform $pyPlatform)
-        Write-Output "Installed embed Python $embed by path $path"
-    }
+        if ($embed) {
+            Write-Verbose "Installing embedded python $embed"
+            $path = Search-PyExecutable -pyHome (Get-PyEmbed -appPrefix $appPrefix -pyVersion $embed -pyPlatform $pyPlatform)
+            Write-Output "Installed embed Python $embed by path $path"
+        }
 
-    $Private:info = Get-PyInfo -pyExecutable $path
-    if ($Private:info.status_error) { throw "Connection error: cannot use Python by path $path (Error: $($Private:info.status_error))" }
+        $Private:info = Get-PyInfo -pyExecutable $path
+        if ($Private:info.status_error) { throw "Connection error: cannot use Python by path $path (Error: $($Private:info.status_error))" }
 
-    Write-Verbose "Update or create settings"
-    if (!$settings -or ($settings.PyExecutable -ne $Private:info.pyExecutable -or $settings.PyDll -ne $Private:info.pyDll)) {
-        Write-Verbose "Settings file is outdated"
-        $settings = Update-PythonEnvironmentSettings -pyExecutable $Private:info.pyExecutable -pyDll $Private:info.pyDll
-        Write-Output "Settings file ($Script:settingsFileName) is updated"
-    } else { Write-Verbose "Settings file $Script:settingsFileName is actual"}
+        Write-Verbose "Update or create settings"
+        if (!$settings -or ($settings.PyExecutable -ne $Private:info.pyExecutable -or $settings.PyDll -ne $Private:info.pyDll)) {
+            Write-Verbose "Settings file is outdated"
+            $settings = Update-PythonEnvironmentSettings -pyExecutable $Private:info.pyExecutable -pyDll $Private:info.pyDll
+            Write-Output "Settings file ($Script:settingsFileName) is updated"
+        } else { Write-Verbose "Settings file $Script:settingsFileName is actual"}
 
-    Write-Output ("NLedger Python connection is {c:DarkYellow}active{f:Normal} (Settings file: $Script:settingsFileName)`n" | Out-AnsiString)
+        Write-Output ("NLedger Python connection is {c:DarkYellow}active{f:Normal} (Settings file: $Script:settingsFileName)`n" | Out-AnsiString)
+    }
 }
 
 <#
@@ -485,15 +441,18 @@ indicates whether Ledger capabilities can be used in a Python session (both modu
 Remember that Python sessions work isolately and do not need for any settings actually.
 
 #>
-function Status {
+function Get-PythonStatus {
     [CmdletBinding()]
+    [Alias("python-status")]
     Param()
 
-    Write-Output ("`n{c:DarkCyan}[Python Extension Status]{f:Normal}`n" | Out-AnsiString )
-    Write-Output "'Python Connection' status indicates whether the reference to Python is properly configured"
-    Write-Output "'Python Extension' status indicates whether NLedger uses the referenced Python"
+    Assert-CommandCompleted {
+        Write-Output ("`n{c:DarkCyan}[Python Extension Status]{f:Normal}`n" | Out-AnsiString )
+        Write-Output "'Python Connection' status indicates whether the reference to Python is properly configured"
+        Write-Output "'Python Extension' status indicates whether NLedger uses the referenced Python"
 
-    Get-StatusInfo | Write-StatusInfo
+        Get-StatusInfo | Write-StatusInfo
+    }
 }
 
 <#
@@ -507,21 +466,24 @@ This command checks whether Python extension is properly configured, executes 'c
 sets NLedger settings 'ExtensionProvider' to 'python' to make the extension operable.
 
 #>
-function Enable {
+function Enable-PythonExtension {
     [CmdletBinding()]
+    [Alias("python-enable")]
     Param()
     
-    $Private:info = Get-StatusInfo
-    if(!$Private:info.nledger_binaries) {throw "Cannot enable Python extension because NLedger binaries not found. Build NLedger or correct deployment issues"}
-    if ($Private:info.extension_provider -and $Private:info.extension_provider -ne "python") {throw "Cannot enable Python extension because 'ExtensionProvider' setting value in NLedger configuration already configured for another provider: $($Private:info.extensionProvider)"}
+    Assert-CommandCompleted {
+        $Private:info = Get-StatusInfo
+        if(!$Private:info.nledger_binaries) {throw "Cannot enable Python extension because NLedger binaries not found. Build NLedger or correct deployment issues"}
+        if ($Private:info.extension_provider -and $Private:info.extension_provider -ne "python") {throw "Cannot enable Python extension because 'ExtensionProvider' setting value in NLedger configuration already configured for another provider: $($Private:info.extensionProvider)"}
 
-    Connect
-    if ($Private:info.extension_provider -ne "python") { $null = SetConfigValue -scope "user" -settingName "ExtensionProvider" -settingValue "python" }
+        Connect-PythonDeployment
+        if ($Private:info.extension_provider -ne "python") { $null = Set-NLedgerConfigValue -scope "user" -settingName "ExtensionProvider" -settingValue "python" }
 
-    $Private:info = Get-StatusInfo
-    if ($Private:info.extension_provider -ne "python") { Write-Output ("{c:DarkRed}Cannot enable Python extension{f:Normal}" | Out-AnsiString) }
-    else { Write-Output ("NLedger Python extension is {c:DarkGreen}enabled{f:Normal}" | Out-AnsiString)}
-    Write-Output ""
+        $Private:info = Get-StatusInfo
+        if ($Private:info.extension_provider -ne "python") { Write-Output ("{c:DarkRed}Cannot enable Python extension{f:Normal}" | Out-AnsiString) }
+        else { Write-Output ("NLedger Python extension is {c:DarkGreen}enabled{f:Normal}" | Out-AnsiString)}
+        Write-Output ""
+    }
 }
 
 <#
@@ -533,21 +495,24 @@ Sets an empty value to NLedger 'ExtensionProvider' setting, making Python extens
 Extension configuration settings (the file NLedger.Extensibility.Python.settings.xml) themselves are not changed.
 
 #>
-function Disable {
+function Disable-PythonExtension {
     [CmdletBinding()]
+    [Alias("python-disable")]
     Param()
     
-    Write-Output ""
-    $Private:info = Get-StatusInfo
-    if(!$Private:info.nledger_binaries) {throw "Cannot enable Python extension because NLedger binaries not found. Build NLedger or correct deployment issues"}    
-    if ($Private:info.extension_provider -and $Private:info.extension_provider -ne "python") {throw "Cannot disable extension because 'ExtensionProvider' setting value in NLedger configuration already configured for another provider: $($Private:info.extensionProvider)"}
+    Assert-CommandCompleted {
+        Write-Output ""
+        $Private:info = Get-StatusInfo
+        if(!$Private:info.nledger_binaries) {throw "Cannot enable Python extension because NLedger binaries not found. Build NLedger or correct deployment issues"}    
+        if ($Private:info.extension_provider -and $Private:info.extension_provider -ne "python") {throw "Cannot disable extension because 'ExtensionProvider' setting value in NLedger configuration already configured for another provider: $($Private:info.extensionProvider)"}
 
-    if ($Private:info.extension_provider -eq "python") { $null = RemoveConfigValue -scope "user" -settingName "ExtensionProvider" }
+        if ($Private:info.extension_provider -eq "python") { $null = RemoveConfigValue -scope "user" -settingName "ExtensionProvider" }
 
-    $Private:info = Get-StatusInfo
-    if ($Private:info.extension_provider -eq "python") { Write-Output ("{c:DarkRed}Cannot disable extension{f:Normal}; use NLedger Configuration console to sort out the issue manually" | Out-AnsiString) }
-    else { Write-Output ("NLedger Python extension is {c:DarkRed}disabled{f:Normal}" | Out-AnsiString) }
-    Write-Output ""
+        $Private:info = Get-StatusInfo
+        if ($Private:info.extension_provider -eq "python") { Write-Output ("{c:DarkRed}Cannot disable extension{f:Normal}; use NLedger Configuration console to sort out the issue manually" | Out-AnsiString) }
+        else { Write-Output ("NLedger Python extension is {c:DarkRed}disabled{f:Normal}" | Out-AnsiString) }
+        Write-Output ""
+    }
 }
 
 <#
@@ -559,16 +524,19 @@ Deletes the file with NLedger Python extension settings (NLedger.Extensibility.P
 It makes Python extension unavailable regardless of whether the NLedger setting (ExtensionProvider) is configured for Python
 
 #>
-function Disconnect {
+function Disconnect-PythonDeployment {
     [CmdletBinding()]
+    [Alias("python-disconnect")]
     Param()
     
-    Write-Output ""
-    $Private:info = Get-StatusInfo
-    if ($Private:info.extension_provider -eq "python") {throw "Cannot unlink Python connection because Python extension is currently active ('ExtensionProvider' setting value in NLedger configuration is 'python'). Disable extension first using 'disable' command"}
+    Assert-CommandCompleted {
+        Write-Output ""
+        $Private:info = Get-StatusInfo
+        if ($Private:info.extension_provider -eq "python") {throw "Cannot unlink Python connection because Python extension is currently active ('ExtensionProvider' setting value in NLedger configuration is 'python'). Disable extension first using 'disable' command"}
 
-    Remove-PythonIntegrationSettings
-    Write-Output ("NLedger Python connection is {c:DarkYellow}not active{c:Gray} (settings file $Script:settingsFileName is removed)`n" | Out-AnsiString)
+        Remove-PythonIntegrationSettings
+        Write-Output ("NLedger Python connection is {c:DarkYellow}not active{c:Gray} (settings file $Script:settingsFileName is removed)`n" | Out-AnsiString)
+    }
 }
 
 <#
@@ -595,11 +563,12 @@ Default value is 3.8.1 (this version will be downloaded if 'version' parameter i
 #>
 function Install-Python {
     [CmdletBinding()]
+    [Alias("python-install")]
     Param([Parameter(Mandatory=$False)][string]$version = $pyEmbedVersion)
 
-    Write-Output ""
-    Write-Output "Embedded Python is available by path: $(Get-PyEmbed -appPrefix $appPrefix -pyVersion $version -pyPlatform $pyPlatform)"
-    Write-Output ""
+    Assert-CommandCompleted {
+        Write-Output "`nEmbedded Python is available by path: $(Get-PyEmbed -appPrefix $appPrefix -pyVersion $version -pyPlatform $pyPlatform)`n"
+    }
 }
 
 <#
@@ -615,18 +584,21 @@ Default value is 3.8.1 (this version will be uninstalled if 'version' parameter
 #>
 function Uninstall-Python {
     [CmdletBinding()]
+    [Alias("python-uninstall")]
     Param([Parameter(Mandatory=$False)][string]$version = $pyEmbedVersion)
 
-    Write-Output ""
-    $Private:settings = Get-PythonIntegrationSettings
-    $Private:path = Test-PyEmbedInstalled -appPrefix $appPrefix -pyPlatform $pyPlatform -pyVersion $version
-    if ($Private:path) {
-        if ($Private:settings -and [System.IO.Path]::GetFullPath($(Split-Path $Private:settings.PyExecutable)) -eq $Private:path) { throw "Cannot uninstall embed Python $version because it is currently linked (PyHome $Private:path). Unlink connection first."}
-        Uninstall-PyEmbed -appPrefix $appPrefix -pyPlatform $pyPlatform -pyVersion $version
-    }
+    Assert-CommandCompleted {
+        Write-Output ""
+        $Private:settings = Get-PythonIntegrationSettings
+        $Private:path = Test-PyEmbedInstalled -appPrefix $appPrefix -pyPlatform $pyPlatform -pyVersion $version
+        if ($Private:path) {
+            if ($Private:settings -and [System.IO.Path]::GetFullPath($(Split-Path $Private:settings.PyExecutable)) -eq $Private:path) { throw "Cannot uninstall embed Python $version because it is currently linked (PyHome $Private:path). Unlink connection first."}
+            Uninstall-PyEmbed -appPrefix $appPrefix -pyPlatform $pyPlatform -pyVersion $version
+        }
 
-    Write-Output "Embedded Python $version is uninstalled"
-    Write-Output ""
+        Write-Output "Embedded Python $version is uninstalled"
+        Write-Output ""
+    }
 }
 
 <#
@@ -636,8 +608,8 @@ Installs Wheel module to Python environment
 .DESCRIPTION
 Installs Wheel module to Python by means of Pip.
 
-Note: Wheel module is only needed if you want to build Ledger package from source code (e.g. by means of get-nledger-up.ps1).
-.Net Ledger and Ledger module can work without Wheel. 
+Note: Wheel module is only needed if you want to build Ledger package from source code 
+(e.g. by means of get-nledger-up.ps1). .Net Ledger and Ledger module can work without Wheel. 
 
 Note: you can check whether Wheel is installed by means of "discover" command. It will show Wheel version if it is found.
 
@@ -645,31 +617,34 @@ Note: you can check whether Wheel is installed by means of "discover" command. I
 Optional parameter containing a full path to Python executable file.
 If this parameter is omitted, the command uses path from current Python extension settings.
 #>
-function Install-Wheel {
+function Install-PythonWheel {
     [CmdletBinding()]
+    [Alias("python-install-wheel")]
     Param(
         [Parameter(Mandatory=$False)][string]$path
     )
 
-    if(!$path) {
-        $Private:settings = Get-PythonIntegrationSettings
-        if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
-        $path = $settings.PyExecutable
-    }
+    Assert-CommandCompleted {
+        if(!$path) {
+            $Private:settings = Get-PythonIntegrationSettings
+            if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
+            $path = $settings.PyExecutable
+        }
 
-    $Private:info = Get-PyInfo -pyExecutable $path
-    if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
+        $Private:info = Get-PyInfo -pyExecutable $path
+        if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
 
-    if(!($Private:info.pyWheelInfo)) {
-        $null = Install-PyModule -pyExe $path -pyModule $pyWheelModule -Verbose:$VerbosePreference
-    }
+        if(!($Private:info.pyWheelInfo)) {
+            $null = Install-PyModule -pyExe $path -pyModule $pyWheelModule -Verbose:$VerbosePreference
+        }
 
-    $Private:packageInfo = Test-PyModuleInstalled -pyExecutable $path -pyModule $pyWheelModule
+        $Private:packageInfo = Test-PyModuleInstalled -pyExecutable $path -pyModule $pyWheelModule
 
-    if($Private:packageInfo){
-        Write-Output ("Wheel {c:DarkYellow}$($Private:packageInfo.Version.Trim()){f:Normal} is installed ($path)" | Out-AnsiString)
-    } else {
-        Write-Output ("Wheel {c:DarkRed}has not been installed{f:Normal} ($path). Use -verbose for troubleshooting." | Out-AnsiString)
+        if($Private:packageInfo){
+            Write-Output ("Wheel {c:DarkYellow}$($Private:packageInfo.Version.Trim()){f:Normal} is installed ($path)" | Out-AnsiString)
+        } else {
+            Write-Output ("Wheel {c:DarkRed}has not been installed{f:Normal} ($path). Use -verbose for troubleshooting." | Out-AnsiString)
+        }
     }
 }
 
@@ -680,8 +655,8 @@ Uninstalls Wheel module from Python environment
 .DESCRIPTION
 Uninstall Wheel module to Python by means of Pip.
 
-Note: Wheel module is only needed if you want to build Ledger package from source code (e.g. by means of get-nledger-up.ps1).
-.Net Ledger and Ledger module can work without Wheel. 
+Note: Wheel module is only needed if you want to build Ledger package from source code 
+(e.g. by means of get-nledger-up.ps1). .Net Ledger and Ledger module can work without Wheel. 
 
 Note: you can check whether Wheel is installed by means of "discover" command. It will show Wheel version if it is found.
 
@@ -689,77 +664,97 @@ Note: you can check whether Wheel is installed by means of "discover" command. I
 Optional parameter containing a full path to Python executable file.
 If this parameter is omitted, the command uses path from current Python extension settings.
 #>
-function Uninstall-Wheel {
+function Uninstall-PythonWheel {
     [CmdletBinding()]
+    [Alias("python-uninstall-wheel")]
     Param([Parameter(Mandatory=$False)][string]$path)
 
-    if(!$path) {
-        $Private:settings = Get-PythonIntegrationSettings
-        if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
-        $path = $settings.PyExecutable
-    }
+    Assert-CommandCompleted {
+        if(!$path) {
+            $Private:settings = Get-PythonIntegrationSettings
+            if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
+            $path = $settings.PyExecutable
+        }
 
-    $Private:info = Get-PyInfo -pyExecutable $path
-    if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
+        $Private:info = Get-PyInfo -pyExecutable $path
+        if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
 
-    $null = Uninstall-PyModule -pyExe $path -pyModule $pyWheelModule -Verbose:$VerbosePreference
+        $null = Uninstall-PyModule -pyExe $path -pyModule $pyWheelModule -Verbose:$VerbosePreference
 
-    Write-Output "Wheel is uninstalled ($path)"
+        Write-Output "Wheel is uninstalled ($path)"
+    }
 }
 
 <#
 .SYNOPSIS
-Installs PythonNet module to Python environment
+Installs the PythonNet module into the Python environment.
 
 .DESCRIPTION
-Note: PythonNet and Ledger modules have to be installed only if you want to use NLedger capabilities in Python session.
-NLedger console application does not need for this module.
-
-Ledger module depends on PythonNet, so the latter is usually installed automatically when you install the Ledger module.
-However, you may need more granular control over which version of PythonNet is installed. 
-
-In this case, you should execute this command before installing Ledger module:
-- 'Install-PythonNet' without '-pre' switch installs a currently available PythonNet from PyPa repository (currently 2.5.x)
-- 'Install-PythonNet' with '-pre' switch installs the latest available pre-release of PythonNet 3
+The PythoneNet module is a required component for the Python NLedger module, 
+so if you want to use NLedger capabilities in a Python session, you must install it.
+Essentially, when the NLedger Python module is installed, it also triggers 
+the installation of the latest version of PythonNet, but you may want to
+to have more granular control over which version of PythonNet is used.
 
-Please, be aware that PythonNet 3 has not been officially released (at the moment 2021-10-18) so this is an experimental option (though it passed tests).
-Ledger module does not require PythonNet version 3 specifically; it properly works with any available version.
+This command installs PythonNet into the specified Python environment.
+The default version is 2.5.2, which guarantees that the NLedger Python module will work,
+but you can specify a different explicit version or even a pre-release version.
 
-In case of any issues with this command, you can manually install PythonNet following recommendations on PythonNet resources.
+If PythonNet is already installed, the command will reinstall it.
 
 .PARAMETER path
-Optional parameter containing a full path to Python executable file.
-If this parameter is omitted, the command uses path from current Python extension settings.
+An optional parameter containing the full path to the Python executable.
+If this parameter is omitted, the command uses the path from the current Python extension settings.
+
+.PARAMETER version
+An optional parameter containing the version of PythonNet to install.
+If this parameter is omitted, the command installs PythonNet 2.5.2.
 
 .PARAMETER pre
-Optional switch that forces installing pre-release of PythonNet version 3.
-If this parameter is omitted, the command installs a currently available PythonNet from PyPa repository.
+An optional switch that allows pre-release versions of PythonNet to be installed.
+If this parameter is omitted, the command installs only public versions of PythonNet from the PyPa repository.
+
+.EXAMPLE
+PS> python-install-pythonnet
+
+Installs or reinstalls PythonNet 2.5.2 in a connected Python environment.
 
+.EXAMPLE
+PS> python-install-pythonnet -version 3.0.1
+
+Installs or reinstalls PythonNet 3.0.1 in a connected Python environment.
+
+.NOTES
+Technically, this is a wrapper for "python -m pip install [module[==version]] --pre" command.
 #>
 function Install-PythonNet {
     [CmdletBinding()]
+    [Alias("python-install-pythonnet")]
     Param(
-        [Parameter(Mandatory=$False)][string]$path,
+        [Parameter()][string]$path,
+        [Parameter()][version]$version = "2.5.2",
         [Switch]$pre = $False
     )
 
-    if(!$path) {
-        $Private:settings = Get-PythonIntegrationSettings
-        if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
-        $path = $settings.PyExecutable
-    }
+    Assert-CommandCompleted {
+        if(!$path) {
+            $Private:settings = Get-PythonIntegrationSettings
+            if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
+            $path = $settings.PyExecutable
+        }
 
-    $Private:info = Get-PyInfo -pyExecutable $path
-    if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
+        $Private:info = Get-PyInfo -pyExecutable $path
+        if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
 
-    $null = Uninstall-PyModule -pyExe $path -pyModule "pythonnet" -Verbose:$VerbosePreference
-    $null = Install-PyModule -pyExe $path -pyModule "pythonnet" -pre:$pre -Verbose:$VerbosePreference
-    $Private:packageInfo = Test-PyModuleInstalled -pyExecutable $path -pyModule "pythonnet"
+        $null = Uninstall-PyModule -pyExe $path -pyModule "pythonnet" -Verbose:$VerbosePreference
+        $null = Install-PyModule -pyExe $path -pyModule "pythonnet" -version $version -pre:$pre -Verbose:$VerbosePreference
+        $Private:packageInfo = Test-PyModuleInstalled -pyExecutable $path -pyModule "pythonnet"
 
-    if($Private:packageInfo){
-        Write-Output ("PythonNet {c:DarkYellow}$($Private:packageInfo.Version.Trim()){f:Normal} is installed ($path)" | Out-AnsiString)
-    } else {
-        Write-Output ("PythonNet {c:DarkRed}has not been installed{f:Normal} ($path). Use -verbose for troubleshooting." | Out-AnsiString)
+        if($Private:packageInfo){
+            Write-Output ("PythonNet {c:DarkYellow}$($Private:packageInfo.Version.Trim()){f:Normal} is installed ($path)" | Out-AnsiString)
+        } else {
+            Write-Output ("PythonNet {c:DarkRed}has not been installed{f:Normal} ($path). Use -verbose for troubleshooting." | Out-AnsiString)
+        }
     }
 }
 
@@ -781,20 +776,23 @@ If this parameter is omitted, the command uses path from current Python extensio
 #>
 function Uninstall-PythonNet {
     [CmdletBinding()]
+    [Alias("python-uninstall-pythonnet")]
     Param([Parameter(Mandatory=$False)][string]$path)
 
-    if(!$path) {
-        $Private:settings = Get-PythonIntegrationSettings
-        if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
-        $path = $settings.PyExecutable
-    }
+    Assert-CommandCompleted {
+        if(!$path) {
+            $Private:settings = Get-PythonIntegrationSettings
+            if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
+            $path = $settings.PyExecutable
+        }
 
-    $Private:info = Get-PyInfo -pyExecutable $path
-    if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
+        $Private:info = Get-PyInfo -pyExecutable $path
+        if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
 
-    $null = Uninstall-PyModule -pyExe $path -pyModule "pythonnet" -Verbose:$VerbosePreference
+        $null = Uninstall-PyModule -pyExe $path -pyModule "pythonnet" -Verbose:$VerbosePreference
 
-    Write-Output "PythonNet is uninstalled ($path)"
+        Write-Output "PythonNet is uninstalled ($path)"
+    }
 }
 
 <#
@@ -819,30 +817,33 @@ Optional parameter containing a full path to Python executable file.
 If this parameter is omitted, the command uses path from current Python extension settings.
 
 #>
-function Install-Ledger {
+function Install-PythonLedger {
     [CmdletBinding()]
+    [Alias("python-install-ledger")]
     Param([Parameter(Mandatory=$False)][string]$path)
 
-    $Private:ledgerPackage = (Get-LatestAvailableLedgerModule).FileName
-    if (!$Private:ledgerPackage) {throw "Ledger package not found. Build NLedger or correct deployment issues"}
+    Assert-CommandCompleted {
+        $Private:ledgerPackage = (Get-LatestAvailableLedgerModule).FileName
+        if (!$Private:ledgerPackage) {throw "Ledger package not found. Build NLedger or correct deployment issues"}
 
-    if(!$path) {
-        $Private:settings = Get-PythonIntegrationSettings
-        if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
-        $path = $settings.PyExecutable
-    }
+        if(!$path) {
+            $Private:settings = Get-PythonIntegrationSettings
+            if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
+            $path = $settings.PyExecutable
+        }
 
-    $Private:info = Get-PyInfo -pyExecutable $path
-    if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
+        $Private:info = Get-PyInfo -pyExecutable $path
+        if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
 
-    $null = Uninstall-PyModule -pyExe $path -pyModule "ledger" -Verbose:$VerbosePreference
-    $null = Install-PyModule -pyExe $path -pyModule $Private:ledgerPackage -Verbose:$VerbosePreference
-    $Private:packageInfo = Test-PyModuleInstalled -pyExecutable $path -pyModule "ledger"
+        $null = Uninstall-PyModule -pyExe $path -pyModule "ledger" -Verbose:$VerbosePreference
+        $null = Install-PyModule -pyExe $path -pyModule $Private:ledgerPackage -Verbose:$VerbosePreference
+        $Private:packageInfo = Test-PyModuleInstalled -pyExecutable $path -pyModule "ledger"
 
-    if($Private:packageInfo){
-        Write-Output ("Ledger {c:DarkYellow}$($Private:packageInfo.Version.Trim()){f:Normal} is installed ($path)" | Out-AnsiString)
-    } else {
-        Write-Output ("Ledger {c:DarkRed}has not been installed{f:Normal} ($path). Use -verbose for troubleshooting." | Out-AnsiString)
+        if($Private:packageInfo){
+            Write-Output ("Ledger {c:DarkYellow}$($Private:packageInfo.Version.Trim()){f:Normal} is installed ($path)" | Out-AnsiString)
+        } else {
+            Write-Output ("Ledger {c:DarkRed}has not been installed{f:Normal} ($path). Use -verbose for troubleshooting." | Out-AnsiString)
+        }
     }
 }
 
@@ -862,27 +863,30 @@ Optional parameter containing a full path to Python executable file.
 If this parameter is omitted, the command uses path from current Python extension settings.
 
 #>
-function Uninstall-Ledger {
+function Uninstall-PythonLedger {
     [CmdletBinding()]
+    [Alias("python-uninstall-ledger")]
     Param([Parameter(Mandatory=$False)][string]$path)
 
-    if(!$path) {
-        $Private:settings = Get-PythonIntegrationSettings
-        if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
-        $path = $settings.PyExecutable
-    }
+    Assert-CommandCompleted {
+        if(!$path) {
+            $Private:settings = Get-PythonIntegrationSettings
+            if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
+            $path = $settings.PyExecutable
+        }
 
-    $Private:info = Get-PyInfo -pyExecutable $path
-    if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
+        $Private:info = Get-PyInfo -pyExecutable $path
+        if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
 
-    $null = Uninstall-PyModule -pyExe $path -pyModule "ledger" -Verbose:$VerbosePreference
+        $null = Uninstall-PyModule -pyExe $path -pyModule "ledger" -Verbose:$VerbosePreference
 
-    Write-Output "Ledger is uninstalled ($path)"
+        Write-Output "Ledger is uninstalled ($path)"
+    }
 }
 
 <#
 .SYNOPSIS
-Runs Ledger module tests
+Runs Python Ledger module tests
 
 .DESCRIPTION
 Ledger module package (ledger-[version].whl) is distributed with a test file (ledger_tests.py) that is based on Python unit tests.
@@ -898,138 +902,26 @@ Optional parameter containing a full path to Python executable file.
 If this parameter is omitted, the command uses path from current Python extension settings.
 
 #>
-function Test-Ledger {
+function Invoke-PythonLedgerTests {
     [CmdletBinding()]
+    [Alias("python-test-ledger")]
     Param([Parameter(Mandatory=$False)][string]$path)
 
-    [string]$Private:ledgerTests = [System.IO.Path]::GetFullPath("$Script:ScriptPath/ledger_tests.py")
-    if(!(Test-Path -LiteralPath $Private:ledgerTests -PathType Leaf)) {throw "File $($Private:ledgerTests) not found"}
-
-    if(!$path) {
-        $Private:settings = Get-PythonIntegrationSettings
-        if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
-        $path = $settings.PyExecutable
-    }
-
-    $Private:info = Get-PyInfo -pyExecutable $path
-    if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
-    if (!$Private:info.pyLedgerModuleInfo) { throw "Ledger module is not installed by path $path" }
+    Assert-CommandCompleted {
+        [string]$Private:ledgerTests = [System.IO.Path]::GetFullPath("$Script:ScriptPath/ledger_tests.py")
+        if(!(Test-Path -LiteralPath $Private:ledgerTests -PathType Leaf)) {throw "File $($Private:ledgerTests) not found"}
 
-    & $path $Private:ledgerTests
-    if ($LASTEXITCODE -ne 0) {throw "Python unit tests failed (Exit code: $LASTEXITCODE)."}
-}
+        if(!$path) {
+            $Private:settings = Get-PythonIntegrationSettings
+            if (!$Private:settings) { throw "Python path is not specified and no Python connection settings." }
+            $path = $settings.PyExecutable
+        }
 
-function Help {
-    [CmdletBinding()]
-    Param()
+        $Private:info = Get-PyInfo -pyExecutable $path
+        if ($Private:info.status_error) { throw "Python environment by path $path is not valid (Error: $($Private:info.error))" }
+        if (!$Private:info.pyLedgerModuleInfo) { throw "Ledger module is not installed by path $path" }
 
-    $Private:commands = [ordered]@{
-        ("{c:Yellow}discover{f:Normal}" | Out-AnsiString) = "Find Python deployments on the local machine"
-        ("{c:Yellow}status{f:Normal}" | Out-AnsiString) = "Show NLedger Python integration status"
-        ("{c:Yellow}connect{f:Normal}" | Out-AnsiString) = "Create a connection file that references to a Python deployment"
-        ("{c:Yellow}disconnect{f:Normal}" | Out-AnsiString) = "Remove the connection file"
-        ("{c:Yellow}enable{f:Normal}" | Out-AnsiString) = "Enable Python extension in NLedger settings"
-        ("{c:Yellow}disable{f:Normal}" | Out-AnsiString) = "Disable Python extension in NLedger settings"
-        ("{c:DarkYellow}install-{f:Normal}[target]" | Out-AnsiString) = "Install embedded Python (install-python) or Wheel (install-wheel) or PythonNet (install-pythonnet) or Ledger module (install-ledger)"
-        ("{c:DarkYellow}uninstall-{f:Normal}[target]" | Out-AnsiString) = "Uninstall listed targets"
-        ("{c:DarkYellow}test-ledger{f:Normal}" | Out-AnsiString) = "Run tests for installed Ledger module"
-        ("{c:DarkYellow}help{f:Normal}" | Out-AnsiString) = "Shows this help text"
-        ("{c:DarkYellow}get-help{f:Normal} [command]" | Out-AnsiString) = "Get additional information for a specified command"
-        ("{c:DarkYellow}exit{f:Normal}" | Out-AnsiString) = "Close console window"
+        & $path $Private:ledgerTests
+        if ($LASTEXITCODE -ne 0) {throw "Python unit tests failed (Exit code: $LASTEXITCODE)."}
     }
-
-    Write-Output "Available commands:"
-    ([PSCustomObject]$Private:commands) | Format-List
-}
-
-
-# Manage parameters
-
-if (!$command) {
-    Write-Output ""
-    Write-Output ("{c:White}NLedger Python Toolset Console" | Out-AnsiString)
-    Write-Output ("******************************{f:Normal}" | Out-AnsiString)
-    Write-Output "This script manages NLedger Python Extension settings"
-    Write-Output "It can discover environment details, configure and validate NLedger settings, install or configure dependent software."
-    Write-Output ""
-    Help
-    return
-}
-
-if ($command -eq 'discover') { 
-    if($version){throw "Command 'discover' does not accept 'version' parameter"}
-    Discover -path $path 
-}
-
-if ($command -eq 'status') { 
-    if($path -or $version){throw "Command 'status' does not accept any parameters"}
-    Status 
-}
-
-if ($command -eq 'connect') {
-    Connect -path $path -embed $version
-}
-
-if ($command -eq 'disconnect') { 
-    if($path -or $version){throw "Command 'disconnect' does not accept any parameters"}
-    Disconnect 
-}
-
-if ($command -eq 'enable') {
-    if($path -or $version){throw "Command 'enable' does not accept any parameters"}
-    Enable
-}
-
-if ($command -eq 'disable') {
-    if($path -or $version){throw "Command 'disable' does not accept any parameters"}
-    Disable
-}
-
-if ($command -eq 'test-connection') {
-    if($path -or $version){throw "Command 'test-connection' does not accept any parameters"}
-    Test-Connection
-}
-
-if ($command -eq 'install-python') {
-    if($path){throw "Command 'install-python' does not accept 'path' parameters"}
-    Install-Python -version $version
-}
-
-if ($command -eq 'install-wheel') {
-    Install-Wheel -path $path
-}
-
-if ($command -eq 'install-pythonnet') {
-    if($version -and $version -ne "pre"){throw "Command 'install-pythonnet' does not accept 'version' parameter if it not empty and not equal to 'pre'"}
-    Install-PythonNet -path $path -pre:($version -eq "pre")
-}
-
-if ($command -eq 'install-ledger') {
-    if ($version) {throw "Command 'install-ledger' does not accept 'version' parameter"}
-    Install-Ledger -path $path
-}
-
-if ($command -eq 'uninstall-python') {
-    if($path){throw "Command 'uninstall-python' does not accept 'path' parameters"}
-    if(!$version){throw "Command 'uninstall-python' requires 'version' parameters"}
-    Uninstall-Python -version $version
-}
-
-if ($command -eq 'uninstall-wheel') {
-    Uninstall-Wheel -path $path
-}
-
-if ($command -eq 'uninstall-pythonnet') {
-    if($version){throw "Command 'uninstall-pythonnet' does not accept 'version' parameters"}
-    Uninstall-PythonNet -path $path
-}
-
-if ($command -eq 'uninstall-ledger') {
-    if ($version) {throw "Command 'uninstall-ledger' does not accept 'version' parameter"}
-    Uninstall-Ledger -path $path
-}
-
-if ($command -eq 'test-ledger') {
-    if ($version) {throw "Command 'test-ledger' does not accept 'version' parameter"}
-    Test-Ledger -path $path
 }
diff --git a/Contrib/Python/PyManagement.psm1 b/Contrib/Python/PyManagement.psm1
index 5f9a5d3e..944170b3 100644
--- a/Contrib/Python/PyManagement.psm1
+++ b/Contrib/Python/PyManagement.psm1
@@ -121,17 +121,19 @@ function Test-PyModuleInstalled {
 function Install-PyModule {
     [CmdletBinding()]
     Param(
-        [Parameter(Mandatory=$True)][string]$pyExecutable,
-        [Parameter(Mandatory=$True)][string]$pyModule,
+        [Parameter(Mandatory)][string]$pyExecutable,
+        [Parameter(Mandatory)][string]$pyModule,
+        [Parameter()][version]$version,
         [Switch]$pre = $False
     )
 
     if (!(Test-Path -LiteralPath $pyExecutable -PathType Leaf)) { throw "Python executable not found: $pyExecutable"}
 
+    $verString = if($version){ "==$([string]$version)" }
     [string]$Private:preFlag = $(if($pre){"--pre"}else{""})
 
     Write-Verbose "Installing Python module: $pyModule"
-    [string]$Private:result = $( $(& "$pyExecutable" "-m" "pip" "install" $pyModule $Private:preFlag) 2>&1 | Out-String )
+    [string]$Private:result = $( $(& "$pyExecutable" "-m" "pip" "install" $pyModule$verString $Private:preFlag) 2>&1 | Out-String )
     Write-Verbose "Python returned: $Private:result"
 }
 
diff --git a/Contrib/NLManagement/NLSetup.Console.cmd b/Contrib/nledger-tools.cmd
similarity index 71%
rename from Contrib/NLManagement/NLSetup.Console.cmd
rename to Contrib/nledger-tools.cmd
index c5aeae52..52ae6900 100644
--- a/Contrib/NLManagement/NLSetup.Console.cmd
+++ b/Contrib/nledger-tools.cmd
@@ -1,2 +1,2 @@
-@PowerShell -NoLogo -NoExit -ExecutionPolicy RemoteSigned -File "%~dp0NLSetup.Console.ps1"
+@PowerShell -NoLogo -NoExit -ExecutionPolicy RemoteSigned -File "%~dp0nledger-tools.ps1" %*
 @exit
\ No newline at end of file
diff --git a/Contrib/nledger-tools.ps1 b/Contrib/nledger-tools.ps1
new file mode 100644
index 00000000..4ff19ba7
--- /dev/null
+++ b/Contrib/nledger-tools.ps1
@@ -0,0 +1,528 @@
+<#
+.SYNOPSIS
+NLedger Control Console
+
+.DESCRIPTION
+The NLedger Control Console provides a common way to manage your NLedger environment.
+It provides commands to install/uninstall NLedger, manage configuration settings,
+run tests, manage Python integration.
+
+It can be run as a script file from the command line, allowing you to execute individual commands.
+or behave like a console shell within a Powershell session.
+
+Use "help" to get a list of available commands, or "get-help [command]" for detailed information.
+
+.PARAMETER command
+Command to execute. Can be omitted if you are using this console in a Powershell session.
+
+.PARAMETER commandArguments
+Command arguments (if any).
+
+.NOTES
+Author: Dmitry Merzlyakov
+Date:   December 14, 2023
+#>    
+[CmdletBinding()]
+Param(
+  [Parameter(Position=0)][ValidateSet("status","install","uninstall","test","set-config","remove-config","show-config","python-discover","python-status","python-connect","python-disconnect","python-enable","python-disable","python-install","python-uninstall","python-install-wheel","python-uninstall-wheel","python-install-pythonnet","python-uninstall-pythonnet","python-install-ledger","python-uninstall-ledger","python-test-ledger","live-demo","nledger","help",IgnoreCase=$true)][string]$command,
+  [Parameter(Position=1, ValueFromRemainingArguments)][string[]]$commandArguments
+)
+
+function Assert-FileExists {
+    [CmdletBinding()]
+    Param(
+      [Parameter(Mandatory)][string]$fileName,
+      [Parameter()][string]$message
+    )
+
+    $fileName = [System.IO.Path]::GetFullPath($fileName)
+    if (!(Test-Path -LiteralPath $fileName -PathType Leaf)) { throw "File '$fileName' does not exist. $message" }
+    return $fileName
+}
+
+function Import-ModuleIfAvailable {
+    [CmdletBinding()]
+    Param([Parameter(Mandatory)][string]$fileName)
+
+    $fileName = [System.IO.Path]::GetFullPath($fileName)
+    [bool] $(if (Test-Path -LiteralPath $fileName -PathType Leaf) { Import-Module $fileName; $true })
+}
+
+[string]$Script:CommandPath = $MyInvocation.MyCommand.Path
+[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
+Import-Module (Assert-FileExists "$Script:ScriptPath/Common/SysCommon.psm1" -message "Check that code base is in valid state")
+Import-Module (Assert-FileExists "$Script:ScriptPath/Common/NLedgerEnvironment.psm1" -message "Check that code base is in valid state")
+Import-Module (Assert-FileExists "$Script:ScriptPath/Common/NLedgerConfig.psm1" -message "Check that code base is in valid state")
+$Script:isPythonAvailable = Import-ModuleIfAvailable "$Script:ScriptPath/Python/NLedgerPyEnvironment.psm1"
+$Script:isLiveDemoAvailable = Import-ModuleIfAvailable "$Script:ScriptPath/LiveDemo/NLDoc.LiveDemo.psm1"
+$Script:isTestFrameworkAvailable = Import-ModuleIfAvailable "$Script:ScriptPath/test/NLTest.psm1"
+
+$Global:AssertionCommandCompletedFailure = { Write-Output "{c:Red}[ERROR]{f:Normal} $($_.exception.message)`n" | Out-AnsiString }
+
+# Basic Console commands
+
+<#
+.SYNOPSIS
+Shows information about the current NLedger deployment
+
+.DESCRIPTION
+Provides information on the following aspects:
+- Path to the currently used NLedger executable (if it exists)
+- Indicates whether it is installed (in other words, added to the PATH variable) or 
+  simply preferred and will be used in the current deployment without being explicitly installed. 
+  If the NLedger added to PATH does not belong to the current deployment (for example, 
+  it is in a different folder), it is listed as External.
+- Information about all available NLedger binaries in the current deployment (for example, 
+  for net6 or net8 platforms).
+- Optional, information about the .Net runtimes available on the current machine.
+
+.PARAMETER details
+By default, the status is displayed in a compact form without detailed information.
+This switch can expand information about the available NLedger binaries and also show the currently installed .Net runtimes.
+
+.EXAMPLE
+PS> status
+
+Shows the NLedger deployment status in a compact form.
+
+.EXAMPLE
+PS> status -details
+
+Shows the status of NLedger deployment, including detailed information about available NLedger binaries and .Net runtimes.
+
+#>
+function Show-NLedgerStatus {
+  [CmdletBinding()]
+  [Alias("status")]
+  Param([switch]$details)
+
+  Assert-CommandCompleted {
+    $deploymentInfo = Get-NLedgerDeploymentInfo -Verbose:$VerbosePreference
+
+    $info = [ordered]@{}
+    if ($deploymentInfo.Installed -and $deploymentInfo.IsExternalInstall) { $info["NLedger (Installed, External)"] = $deploymentInfo.Installed }
+    if ($deploymentInfo.Installed -and !$deploymentInfo.IsExternalInstall) { $info["NLedger (Installed)"] = $deploymentInfo.Installed }
+    if (!$deploymentInfo.Installed -and $deploymentInfo.PreferredNLedgerExecutableInfo) { $info["NLedger (Preferred, Not Installed)"] = $deploymentInfo.PreferredNLedgerExecutableInfo.NLedgerExecutable }
+    if (!$deploymentInfo.Installed -and !$deploymentInfo.PreferredNLedgerExecutableInfo) { $info["NLedger"] = "Not found" }
+
+    if (!$details) {
+      $info["Available"] = ($deploymentInfo.Infos | ForEach-Object {
+        $item = ""
+        if ($_.IsInstalled) { $item += "{c:Yellow}" | Out-AnsiString }
+        if (!$_.HasRuntime) { $item += "{c:DarkGray}" | Out-AnsiString }
+        $item += "$(Out-TfmProfile $_.TfmCode $_.IsDebug) $(if($_.IsOsxRuntime){"[OSX]"})".Trim()
+        $item += "{f:Normal}" | Out-AnsiString
+        $item
+      }) -join ", "
+      if (!$deploymentInfo.Infos) { $info["Available"] = "Not found" }
+    }
+
+    $output = @( [PSCustomObject]$info )
+
+    if ($details) {
+      $output += $deploymentInfo.Infos | ForEach-Object {
+          $info = [ordered]@{}
+          $info["Executable"] = $_.NLedgerExecutable
+          $info["Link"] = $_.NLedgerLink | Out-MessageWhenEmpty
+          $info["TFM"] = "$(Out-TfmProfile $_.TfmCode $_.IsDebug) $(if($_.IsOsxRuntime){"[OSX]"})"
+          if ($_.IsInstalled) { $info["Installed"] = "Yes" }
+          $info["Runtime"] = if($_.HasRuntime){"Available"} else {"Not available"}
+          [PSCustomObject]$info
+      }
+
+      $output += [PSCustomObject][ordered]@{
+        ".Net Runtime(s)" = $deploymentInfo.Runtimes -join ", "
+      }
+    }
+
+    $output | Format-List
+  }
+}
+
+<#
+.SYNOPSIS
+Installs the current version of NLedger on the machine
+
+.DESCRIPTION
+Installing NLedger essentially involves adding the path to the NLedger binaries to your PATH variable so that you can later use it as a regular command line utility.
+Specifically, the installation includes three steps:
+- add the path to the selected NLedger to the PATH variable
+- optionally create a hard link named 'ledger' in the same folder (use the 'link' switch for it)
+- For .Net Frameworks, it also calls NGen to optimize the selected binary.
+
+By default, NLedger is installed for the latest runtime built into the Release profile.
+You can select a different executable by specifying the TFM code (for example, 'net6' or 'net8') and, if necessary, the profile (for example, 'Debug').
+A list of available binaries and corresponding TFM codes can be viewed with the command status -detail.
+
+If NLedger is already installed, the command will try to remove the previous installation before installing it again.
+If the command detects an external installation, the installation will be stopped. You should fix your PATH variable manually.
+If you select the same targetm platform (TFM code) as the one currently installed, the command will also stopped. You may perform the 'uninstall' manually.
+
+.PARAMETER tfmCode
+Optionally specifies the target runtime (TFM code) for NLedger binaries. By default, it looks for the latest available runtime.
+
+.PARAMETER profile
+Specifies the target profile (Release or Debug) for NLedger binaries. By default it uses Release. If this parameter is specified, the 'tfmCode' parameter must also be specified.
+
+.PARAMETER link
+Adds a 'ledger' hard link during installation. A hard link can be useful if you want to mimic the original Ledger and type something like 'ledger -f etc.' on the command line.
+
+.EXAMPLE
+PS> install
+
+Installs the preferred NLedger. The path to the preferred NLedger is displayed by the status command.
+
+.EXAMPLE
+PS> install net6
+
+Installs NLedger binaries built for the 'net6' runtime with the 'Release' profile. The list of available binaries is displayed by the status command.
+
+.EXAMPLE
+PS> install net5 debug
+
+Installs NLedger binaries built for the 'net5' runtime with the 'Debug' profile (assuming they were built locally)
+
+.EXAMPLE
+PS> install -link
+
+Install the preferred NLedger and create a hardlink 'ledger' to it.
+
+.NOTES
+Since the PATH variable changes during installation, it is recommended to restart the console after installation (if you are using it in interactive mode).
+
+In some cases, this command may require administrator rights (for example, to create a hard link or run NGen).
+#>
+function Install-NLedger {
+  [CmdletBinding()]
+  [Alias("install")]
+  Param(
+    [Parameter()][string]$tfmCode,
+    [Parameter()][ValidateSet("debug","release",IgnoreCase=$true)][string]$profile,
+    [switch]$link
+  )
+
+  Assert-CommandCompleted {
+    $deploymentInfo = Get-NLedgerDeploymentInfo
+    $info = $deploymentInfo | Select-NLedgerPreferrableInfo $tfmCode $profile
+
+    if ($info.IsInstalled) { return "NLedger binaries for {c:Yellow}$(Out-TfmProfile $info.TfmCode $info.IsDebug){f:Normal} are already installed." | Out-AnsiString }
+
+    if ($deploymentInfo.EffectiveInstalled) { $null = Uninstall-NLedgerExecutable }
+    Install-NLedgerExecutable $info.TfmCode $info.IsDebug -link:$link | Format-List
+  }
+}
+
+<#
+.SYNOPSIS
+Uninstalls the current version of NLedger on the machine
+
+.DESCRIPTION
+The command undoes the changes made when installing NLedger on your computer:
+- removes the path to NLedger from the PATH variable
+- deletes a hard link named "ledger" if it exists
+- For .Net Frameworks, it removes the NLedger image from the NGen cache.
+
+The command cannot remove an external NLedger installation (if NLedger does not belong to the current folder); in this case you can change PATH manually.
+
+.PARAMETER link
+Removes 'ledger' hard link if it is found in binaries.
+
+.EXAMPLE
+PS> uninstall
+
+Removes the currently installed NLedger from the system.
+
+.NOTES
+Since the PATH variable changes during installation, it is recommended to restart the console after installation (if you are using it in interactive mode).
+
+In some cases, this command may require administrator rights (for example, to remove a hard link or run NGen).
+#>
+function Uninstall-NLedger {
+  [CmdletBinding()]
+  [Alias("uninstall")]
+  Param([switch]$link)
+
+  Assert-CommandCompleted {
+    $null = Uninstall-NLedgerExecutable -link:$link
+    "NLedger is uninstalled"
+  }
+}
+
+<#
+.SYNOPSIS
+Updates NLedger confiuration settings
+
+.DESCRIPTION
+The command is intended to add or update NLedger configuration settings.
+It takes the parameter name and value and updates the corresponding configuration file.
+
+By default, it updates the user configuration file, which assumes 
+the scope is "user" (see "show-config" for more information).
+You can specify a different scope, such as the "application" scope 
+(application configuration file) or the "public" scope (for all users).
+If the configuration file does not exist, it will be created.
+
+Some settings require values within the acceptable range. For example, 
+Boolean settings accept only true or false values.
+Review the output of 'show-config -details' to verify the exact list of allowed values.
+
+.PARAMETER settingName
+The name of the NLedger configuration parameter. Allowed names are provided by the 'show-config' command.
+
+.PARAMETER settingValue
+The configuration parameter value you want to apply. See the "show-config -details" output 
+for a list of allowed values (if the option accepts only allowed values).
+
+.PARAMETER scope
+Specifies the scope of the configuration parameter value. 
+Valid values are "user" (current user scope - default), 
+"general" (all users), or "application" (application configuration).
+
+.EXAMPLE
+PS> set-config AnsiTerminalEmulation false
+
+Disables Ansi terminal emulation in NLedger for the current user.
+
+.EXAMPLE
+PS> set-config TimeZoneId "GMT Standard Time" common
+
+Sets the time zone to "GMT Standard Time" for all NLedger users on the current computer.
+
+.NOTES
+In some cases, this command may require administrator rights (for example, to change an application's configuration file).
+#>
+function Set-NLedgerConfig {
+  [CmdletBinding()]
+  [Alias("set-config")]
+  Param(
+    [Parameter(Mandatory)][string]$settingName,
+    [Parameter(Mandatory)][AllowEmptyString()][string]$settingValue,
+    [Parameter()][ValidateSet("app","common","user",IgnoreCase=$true)][string]$scope = "user"
+  )
+
+  Assert-CommandCompleted { Set-NLedgerConfigValue -scope $scope -settingName $settingName -settingValue $settingValue | Format-List }
+}
+
+<#
+.SYNOPSIS
+Remove NLedger confiuration settings
+
+.DESCRIPTION
+If you want to undo configuration changes, you can remove the entered configuration parameter.
+By default, the command tries to remove the setting for the "user" scope, but you can specify alternatives.
+If the command removes the last setting in a configuration file, the file itself will also be removed.
+
+.PARAMETER settingName
+The name of the NLedger configuration parameter. Allowed names are provided by the 'show-config' command.
+
+.PARAMETER scope
+Specifies the scope of the configuration parameter value. 
+Valid values are "user" (current user scope - default), 
+"general" (all users), or "application" (application configuration).
+
+.EXAMPLE
+PS> remove-config AnsiTerminalEmulation
+
+Undoes disabling Ansi terminal emulation in NLedger for the current user.
+
+.EXAMPLE
+PS> remove-config TimeZoneId common
+
+Resets the time zone to the default for all NLedger users on the current machine.
+
+.NOTES
+In some cases, this command may require administrator rights (for example, to change an application's configuration file).
+#>
+function Remove-NLedgerConfig {
+  [CmdletBinding()]
+  [Alias("remove-config")]
+  Param(
+    [Parameter(Mandatory)][string]$settingName,
+    [Parameter()][ValidateSet("app","common","user",IgnoreCase=$true)][string]$scope = "user"
+  )
+
+  Assert-CommandCompleted { Remove-NLedgerConfigValue -scope $scope -settingName $settingName | Format-List }
+}
+
+<#
+.SYNOPSIS
+Shows effective NLedger confiuration settings
+
+.DESCRIPTION
+NLedger settings can be stored in configuration files or environment variables. 
+If the parameter is not specified in any of the mentioned sources, NLedger uses 
+the default (hard-coded) value.
+
+This command provides comprehensive information about the current configuration
+settings and their effective values. In particular, it shows the names of 
+the settings, their types and values defined in each scope (listed in order of priority):
+- Default: values specified in the code.
+- Application: The value specified in the application configuration file.
+- Common: value specified in the common (accessible to all users) configuration file.
+- User: value specified in the current user's configuration file.
+- Env: The value specified in the environment variable (prefixed with "nledger" followed by the parameter name).
+- Effective: The effective setting value used by NLedger.
+
+With the 'details' flag, this command also shows the physical location of 
+configuration files and lists of allowed values (for settings that validate input)
+
+.PARAMETER settingFilter
+This option allows you to display a limited set of configuration options by filtering by their names.
+
+.PARAMETER details
+With the 'details' flag, this command shows detail information about configuration settings.
+
+.EXAMPLE
+PS> show-config
+
+Shows NLedger configuration settings in a table.
+
+.EXAMPLE
+PS> show-config demo
+
+Shows NLedger configuration settings that have the text "demo" in their name.
+
+.EXAMPLE
+PS> show-config -details
+
+Shows detail information about NLedger configuration settings.
+
+.NOTES
+For information about the NLedger Python connection file, see the 'python-status' command.
+#>
+function Show-NLedgerConfig {
+  [CmdletBinding()]
+  [Alias("show-config")]
+  Param(
+    [Parameter()][string]$settingFilter,
+    [Switch]$details
+  )
+
+  Assert-CommandCompleted {
+    $data = Get-NLedgerConfigData -Verbose:$VerbosePreference
+    $settings = $(if($settingFilter) { $data.Settings | Where-Object { $_.Name -match $settingFilter} } else { $data.Settings })
+
+    if (!$details) {
+      $settings | ForEach-Object {
+        [PSCustomObject]@{
+          Name = "{c:Yellow}$($_.Name){f:Normal}" | Out-AnsiString
+          Type = "{c:Gray}$($_.SettingType){f:Normal}" | Out-AnsiString
+          Default = $_.DefaultValue
+          App = $_.AppSettingValue
+          Common = $_.CommonSettingValue
+          User = $_.UserSettingValue
+          Env = $_.EnvironmentSettingValue
+          Effective = "{c:Yellow}$($_.EffectiveSettingValue){f:Normal}" | Out-AnsiString
+        }
+      } | Format-Table
+    } else {
+      @(
+        [PSCustomObject]@{ Scope='Common settings'; File=$data.CommonSettingsFile; Exists=($data.CommonSettingsFileExists | Out-YesNo) }
+        [PSCustomObject]@{ Scope='User settings'; File=$data.UserSettingsFile; Exists=($data.UserSettingsFileExists | Out-YesNo) }
+        [PSCustomObject]@{ Scope='App settings'; File=$data.AppSettingsFile; Exists=($data.AppSettingsFileExists | Out-YesNo) }
+      ) | Format-Table
+
+      function FormatValue {
+        param (
+          [Parameter()][bool]$hasValue,
+          [Parameter()][bool]$isAvailable,
+          [Parameter()][string]$value
+        )
+        if (!$isAvailable) { "N/A" }
+        else { if (!$hasValue) { "-" } else { "'$value'" } }
+      }
+
+      $settings | ForEach-Object {
+        [PSCustomObject]@{
+          Name = "{c:Yellow}$($_.Name){f:Normal}" | Out-AnsiString
+          Category = $_.Category
+          Description = $_.Description
+          Type = "{c:Gray}$($_.SettingType){f:Normal}" | Out-AnsiString
+          Permitted = "{c:Gray}$($_.PossibleValues -join ","){f:Normal}" | Out-AnsiString
+          Default = FormatValue $_.HasDefaultValue $true $_.DefaultValue
+          App = FormatValue $_.HasAppSettingValue $_.IsAvailableForApp $_.AppSettingValue
+          Common = FormatValue $_.HasCommonSettingValue $_.IsAvailableForCommon $_.CommonSettingValue
+          User = FormatValue $_.HasUserSettingValue $_.IsAvailableForUser $_.UserSettingValue
+          Env = FormatValue  $_.HasEnvironmentSettingValue $_.IsAvailableForEnv $_.EnvironmentSettingValue
+          Effective = FormatValue $_.HasEffectiveSettingValue $true "{c:Yellow}$($_.EffectiveSettingValue){f:Normal}" | Out-AnsiString
+        }
+      } | Format-List
+    }
+  }
+}
+
+<#
+.SYNOPSIS
+Runs the preferred or currently installed NLedger.
+
+.DESCRIPTION
+This command provides a quick way to launch NLedger, which belongs to your current deployments, in this Powershel console.
+This can be useful if it is not installed and you don't want to look for the executable in the deployment binaries.
+The command accepts any arguments; they are sent directly to NLedger.
+
+The command does not replace the main way to launch NLedger (entering Ledger or NLedger-cli at the command line); 
+it's just another way to run it without having to install it.
+
+.EXAMPLE
+PS> nledger -f .\test\input\drewr3.dat bal
+
+Shows the balance of the drewr3.dat file.
+#>
+function Invoke-NLedger {
+  [CmdletBinding()]
+  [Alias("nledger")]
+  Param([Parameter(Position=1, ValueFromRemainingArguments)][string[]]$commandArguments)
+
+  Assert-CommandCompleted {
+    $deploymentInfo = Get-NLedgerDeploymentInfo
+    if (!$deploymentInfo.PreferredNLedgerExecutableInfo) { "NLedger binaries are not available" }
+    Invoke-Expression (Get-CommandExpression $($deploymentInfo.PreferredNLedgerExecutableInfo.NLedgerExecutable) $commandArguments) 
+  }
+}
+
+<#
+.SYNOPSIS
+Shows available commands
+
+.DESCRIPTION
+Collects information about available commands from associated reference 
+descriptions and displays the corresponding aliases and synopsis in a table.
+
+.EXAMPLE
+PS> help
+
+Shows a quick reference list of available commands.
+
+.NOTES
+Use get-help [command] to get more information about a specific command.
+#>
+function Get-QuickHelp {
+  [CmdletBinding()]
+  [Alias("help")]
+  Param()
+
+  Write-Output ("`n{c:DarkCyan}Available console commands (use 'get-help [command]' for more information){f:Normal}`n" | Out-AnsiString )
+
+  $highlighted = @( "status","install","test","python-connect","help" )
+
+  Assert-CommandCompleted {
+    [array]$aliases = ((Get-Command $Script:CommandPath).Parameters.Command.Attributes | Where-Object { $_.TypeId.Name -eq "ValidateSetAttribute" }).ValidValues
+    Write-Verbose "Found aliases: $($aliases -join ',')"
+    Write-Verbose "Module availability: Python: $Script:isPythonAvailable; tests: $Script:isTestFrameworkAvailable; live demo: $Script:isLiveDemoAvailable"
+
+    $aliases | 
+    Where-Object { ($_ -notmatch "python-.*" -or $Script:isPythonAvailable) -and ($_ -ne "test" -or $Script:isTestFrameworkAvailable) -and ($_ -ne "live-demo" -or $Script:isLiveDemoAvailable) } |
+    ForEach-Object { 
+      $h = Get-Help $_; 
+      [PsCustomObject] @{ 
+        Alias = "$(if($_ -in $highlighted){"{c:Yellow}"}else{"{c:DarkYellow}"})$_{f:Normal}" | Out-AnsiString
+        Description = $h.Synopsis 
+      } 
+    } | Format-Table -HideTableHeaders -AutoSize
+  }
+
+}
+
+if($command) {Invoke-Expression (Get-CommandExpression $command $commandArguments) } else {
+  Write-Output "{c:White}NLedger Control Console{f:Normal}`nUse '{c:Yellow}help{f:Normal}' to get quick help on the available commands.`n" | Out-AnsiString
+}
\ No newline at end of file
diff --git a/Contrib/NLTestToolkit/NLTest.Meta.xml b/Contrib/test/NLTest.Meta.xml
similarity index 100%
rename from Contrib/NLTestToolkit/NLTest.Meta.xml
rename to Contrib/test/NLTest.Meta.xml
diff --git a/Contrib/NLTestToolkit/NLTest.ps1 b/Contrib/test/NLTest.ps1
similarity index 99%
rename from Contrib/NLTestToolkit/NLTest.ps1
rename to Contrib/test/NLTest.ps1
index 246a6868..dd8b3142 100644
--- a/Contrib/NLTestToolkit/NLTest.ps1
+++ b/Contrib/test/NLTest.ps1
@@ -69,7 +69,7 @@
 Param(
     [Parameter(Mandatory=$False)][string]$nledgerExePath = "",
     [Parameter(Mandatory=$False)][string]$nledgerTestPath = "..",
-    [Parameter(Mandatory=$False)][string]$filterRegex = "",
+    [Parameter(Mandatory=$False)][AllowEmptyString()][string]$filterRegex = "",
     [Parameter(Mandatory=$False)][string]$metaListPath = ".\NLTest.Meta.xml",
     [Parameter(Mandatory=$False)][string]$ignoreCategories = "",
     [Switch]$disableIgnoreList = $False,
diff --git a/Contrib/test/NLTest.psm1 b/Contrib/test/NLTest.psm1
new file mode 100644
index 00000000..e27ab227
--- /dev/null
+++ b/Contrib/test/NLTest.psm1
@@ -0,0 +1,109 @@
+<#
+.SYNOPSIS
+NLedger testing framework
+
+.DESCRIPTION
+Provides functions for running Ledger test files
+
+.NOTES
+Author: Dmitry Merzlyakov
+Date:   December 14, 2023
+#> 
+
+[CmdletBinding()]
+Param()
+
+[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
+Import-Module $Script:ScriptPath/../Common/SysCommon.psm1
+Import-Module $Script:ScriptPath/../Common/NLedgerEnvironment.psm1
+
+<#
+.SYNOPSIS
+Runs Ledger tests
+
+.DESCRIPTION
+The command runs the original Ledger tests and displays the result in the current 
+console. Additionally, it can generate an HTML report with detailed test results and 
+performance metrics.
+
+Test files and the corresponding testing environment are stored 
+in the '/Contrib/test' folder.
+
+By default, the command runs all available test files. You can select a subset of tests 
+by entering a filter condition in the 'filter' parameter.
+
+The command launches the currently installed NLedger (or the preferred one 
+if it is not installed). You can select a specific version of NLedger by providing 
+the TFM code for the available binary.
+
+.PARAMETER filter
+Filtering criteria in regular expression format, allowing the user to select a subset of test files.
+
+.PARAMETER report
+The switch generates a test report in HTML format. Report files are added to 
+the current user's documents folder in the 'NLedger' subfolder.
+
+.PARAMETER includeIgnored
+Some Ledger tests are excluded from the scope of testing (see the 'ignore' elements and 
+associated explanations in the NLTest.Meta.xml file). This switch forces these tests 
+to be included in the current test scope.
+
+.PARAMETER tfmCode
+The testing framework defaults to the installed or preferred version of NLedger. 
+This option allows you to specify which NLedger (in other words, for which runtime) you want to test.
+
+.PARAMETER profile
+If you explicitly specify the NLedger version using the 'tfmCode' parameter, 
+you can also specify a profile (Debug or Release) using the 'profile' parameter.
+
+.EXAMPLE
+PS> test
+
+Runs all available Ledger tests and displays test results in the console.
+
+.EXAMPLE
+PS> test py
+
+Runs all Ledger tests with 'py' in their names and displays test results in the console.
+
+.EXAMPLE
+PS> test py -report
+
+Runs all available Ledger tests and creates an html report.
+
+.EXAMPLE
+PS> test -tfmCode net6
+
+Runs all available Ledger tests using NLedger binaries built for the 'net6' runtime with 
+the 'Release' profile. The list of available binaries is displayed by the status command.
+
+.NOTES
+For more information about Ledger tests, see the 'Testing Framework' section of the Ledger documentation.
+#>
+function Invoke-NLedgerTests {
+  [CmdletBinding()]
+  [Alias("test")]
+  Param(
+    [Parameter()][string]$filter,
+    [switch]$report,
+    [switch]$includeIgnored,
+    [Parameter()][string]$tfmCode,
+    [Parameter()][ValidateSet("debug","release",IgnoreCase=$true)][string]$profile
+  )
+
+  Assert-CommandCompleted {
+    [string]$nlTestPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath/NLTest.ps1")
+    if (!(Test-Path -LiteralPath $nlTestPath -PathType Leaf)) { throw "File $nlTestPath not found."}
+
+    [string]$nledgerExePath = (Get-NLedgerDeploymentInfo | Select-NLedgerPreferrableInfo $tfmCode $profile).NLedgerExecutable
+
+    $params = @{
+      nledgerExePath = $nledgerExePath
+      filterRegex = $filter
+      showReport = $report
+      disableIgnoreList = $includeIgnored
+    }
+
+    $null = (& $nlTestPath @params)
+  }
+}
diff --git a/Contrib/NLTestToolkit/NLTest.xslt b/Contrib/test/NLTest.xslt
similarity index 100%
rename from Contrib/NLTestToolkit/NLTest.xslt
rename to Contrib/test/NLTest.xslt
diff --git a/Contrib/test/nledger/gh-issues-24.test b/Contrib/test/nledger/gh-issues-24.test
new file mode 100644
index 00000000..222b2039
--- /dev/null
+++ b/Contrib/test/nledger/gh-issues-24.test
@@ -0,0 +1,13 @@
+2022/01/30 * stuff  ;Misc
+    ; UUID: 0292006581600/20220130/0
+    Expenses:Unknown                         123 �
+    Assets:Wallet
+
+test print
+2022/01/30 * stuff
+    ;Misc
+    ; UUID: 0292006581600/20220130/0
+    Expenses:Unknown                           123 �
+    Assets:Wallet
+end test
+
diff --git a/Contrib/test/nledger/gh-issues-29.test b/Contrib/test/nledger/gh-issues-29.test
new file mode 100644
index 00000000..24046de0
--- /dev/null
+++ b/Contrib/test/nledger/gh-issues-29.test
@@ -0,0 +1,17 @@
+2008-07-17 Buy ABC
+	Assets:Investments:ABC  1945.83 ABC @ 1.3479 XYZ
+	Assets:Investments:Cash
+
+2017-01-13 Sell ABC
+	; sold at a loss
+	Assets:Investments:ABC  -1945.83 ABC {1.3479 XYZ} [2008-04-17] @@ 2500 XYZ
+	Income:Investment:Capital Gains      122.78 XYZ
+	Assets:Investments:Cash  			 2500.00 XYZ
+
+test bal
+         -122.78 XYZ  Assets:Investments:Cash
+          122.78 XYZ  Income:Investment:Capital Gains
+--------------------
+                   0
+end test
+
diff --git a/Contrib/test/regress/25A099C9.dat b/Contrib/test/regress/25A099C9.dat
index 1b7d2101..14f5f8d0 100644
--- a/Contrib/test/regress/25A099C9.dat
+++ b/Contrib/test/regress/25A099C9.dat
@@ -492,7 +492,7 @@ public:
       fits_in_long() returns true if to_long() would not lose
       precision.
 
-      to_string() returns an amount'ss "display value" as a string --
+      to_string() returns an amount's "display value" as a string --
       after rounding the value according to the commodity's default
       precision.  It is equivalent to: `round().to_fullstring()'.
 
diff --git a/Contrib/test/regress/370-period.test b/Contrib/test/regress/370-period.test
index 81275da6..7f30c170 100644
--- a/Contrib/test/regress/370-period.test
+++ b/Contrib/test/regress/370-period.test
@@ -1,4 +1,4 @@
-;period days should not be alligned
+;period days should not be aligned
 
 test period 'every 14 days from 2011/10/03'
 --- Period expression tokens ---
diff --git a/LICENSE b/LICENSE
index 78e71177..f09b18dc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2020, Dmitry Merzlyakov.  All rights reserved.
+Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
diff --git a/LICENSE.LEDGER b/LICENSE.LEDGER
index 771ef8fd..c923f39b 100644
--- a/LICENSE.LEDGER
+++ b/LICENSE.LEDGER
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2020, John Wiegley.  All rights reserved.
+Copyright (c) 2003-2022, John Wiegley.  All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
diff --git a/LICENSE.RTF b/LICENSE.RTF
index ce2e6bef..522e1824 100644
Binary files a/LICENSE.RTF and b/LICENSE.RTF differ
diff --git a/README.md b/README.md
index 2623b746..fa0b08e7 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ The main purpose of this project is to enable all Ledger features to .Net world.
 
 NLedger command line utility (NLedger.cli) is highly compatible with the original Ledger. 
 It supports all original features and command line options; the produced output is 100% identical to the original.
-Reliable compatibility level confirmed by 99% Ledger tests (except for a few that require deprecated features).
+Reliable compatibility level confirmed by 99.6% Ledger tests (except for a few that require deprecated features).
 Everything is done to ensure that users have the feeling of using a genuine Ledger. 
 
 NLedger is written in pure C# with no dependencies on any external libraries or any platform-specific features
@@ -18,24 +18,34 @@ This allows NLedger to work properly on any .Net compatible system and be embedd
 
 ## Quick Start
 
-If you have just installed NLedger MSI or ZIP package on Windows and want to know what to do next, you can try:
+First, install Ledger by following the instructions in the `Installation` section of this document.
 
+If you have just installed NLedger MSI on your Windows computer and want to know what to do next, you can try:
+
+- Run NLedger in *.Net Ledger Tools* Powershell console:
+  - Run the *.Net Ledger Tools* console (open the Start menu, go to the *.Net Ledger* folder and click *.Net Ledger Tools*)
+  - Type *ledger --version* in the console: you will see the installed software version
+  - Type *ledger bal -f test/input/drewr3.dat* - you will get a balance for one of the example files, which are located in the *test\input* folder
 - Run NLedger in a command line:
-  - Click *.Net Ledger Folder* icon in the main menu;
-  - Type *cmd* in the address bar of Windows Explorer window;
-  - In the command line window, type *ledger --version* - NLedger should show its version;
-  - Type *ledger bal -f test/input/drewr3.dat* - you will get the balance for one of the example files that are in *test\input* folder;
+  - Open the Start menu, go to the *.Net Ledger* folder and click *.Net Ledger Folder*
+  - Type *cmd* in the address bar of Windows Explorer window
+  - Type examples of the commands mentioned above (e.g. *ledger bal -f test/input/drewr3.dat*)
 - Run NLedger Live Demo:
-  - Click *.Net Ledger Live Demo* icon in the main menu;
-  - Check out the documentation and try all the examples in action;
+  - Run the *.Net Ledger Tools* console
+  - Type *live-demo* command: it will run the interactive Ledger documentation in the browser (assuming the Live Demo component is installed)
 - Read this file to the end, look at *Ledger 3 Documentation*, *.Net Ledger Guide* and try to find a use of this tool.
 
-If you installed NLedger from source code, you can open a new command prompt window, go to the NLedger folder and try:
-```
-ledger --version
-ledger bal -f test/input/drewr3.dat
-pwsh -file ./get-nledger-tools.ps1 -demo
-```
+If you have just extracted the NLedger zip package to your local computer or built NLedger from source codes, you can try:
+- Run NLedger in *.Net Ledger Tools* Powershell console:
+  - Run the *.Net Ledger Tools* console
+    - In a command line, go to the package root folder (in case of source code repository, it will be `/Contrib` folder)
+    - Run *nledger-tools.cmd* or execute *pwsh -NoLogo -NoExit -File nledger-tools.ps1*
+  - Type *nledger --version* in the console: you will see the current NLedger version. You can also try *nledger bal -f test/input/drewr3.dat* and other examples
+- If NLedger was installed by means of `install` command, you can run NLedger in a command line:
+  - Reopen the command line console, go to the package root folder and try examples above using *ledger* application name (for example, *ledger --version*)
+- Run NLedger Live Demo:
+  - Run the *.Net Ledger Tools* console
+  - Type *live-demo* command
 
 ## Features
 
@@ -112,7 +122,7 @@ seamless access to the same functions for external .Net applications.
   - Program API for developing with NLedger is created; NuGet packages are available;
   - Ledger testing framework is ported; 
   - Ledger tests are passed:
-    - 99% (708 out of 711) test cases passed;
+    - 99.6% (710 out of 713) test cases passed;
     - 3 test cases are ignored because of known limitations;
     - 0 failed.
   - The Ledger Python module is available as a standalone product for Python users. 
@@ -150,17 +160,17 @@ PowerShell is optional, you can still use NLedger if it is not installed, but th
 ```
 git clone https://github.com/dmitry-merzlyakov/nledger
 cd nledger
-pwsh -file ./get-nledger-tools.ps1 -pythonConnect
+pwsh -file ./Contrib/nledger-tools.ps1 python-connect
 pwsh -file ./get-nledger-up.ps1 -install
 ```
 
 On Windows, depending on your Powershell version, the last commands may look like:
 ```
-powershell -ExecutionPolicy RemoteSigned -File ./get-nledger-tools.ps1 -pythonConnect
+powershell -ExecutionPolicy RemoteSigned -File ./Contrib/nledger-tools.ps1 python-connect
 powershell -ExecutionPolicy RemoteSigned -File ./get-nledger-up.ps1 -install
 ```
 
-The command `pythonConnect` is needed if you want to run Python-related unit tests. It can be skipped otherwise.
+The command `python-connect` is needed if you want to run Python-related unit tests. It can be skipped otherwise.
 
 ### Install from NLedger Installation Package
 
@@ -176,15 +186,18 @@ The command `pythonConnect` is needed if you want to run Python-related unit tes
 
 (Windows only)
 
-- Download the latest NLedger installation package from [Releases](https://github.com/dmitry-merzlyakov/nledger/releases);
+- Download the latest NLedger installation zip package from [Releases](https://github.com/dmitry-merzlyakov/nledger/releases);
 - Unpack the package to a temp folder;
 - Open the file *nledger.html* and follow the installation instruction.
 
 OR (for impatient people):
 
 - move unpacked NLedger to a place of permanent location (e.g. *Program Files*);
-- Open *NLedger/Install* folder and execute NLedger.Install.cmd (confirm administrative privileges to let it call NGen); close the console;
-- Run Windows Command Line (e.g. type *cmd* in the search bar) and type *ledger* in it.
+- Open the root package folder and execute the command:
+```
+powershell -ExecutionPolicy RemoteSigned -File ./Contrib/nledger-tools.ps1 install -link
+```
+
 
 ## NLedger NuGet package
 
@@ -240,6 +253,13 @@ in the smallest detail. Thought it was quite big challenge for me
 I would like to express my gratitude to the creators of the [PythonNet](https://github.com/pythonnet/pythonnet) library, 
 who have worked hard to solve complex problems of interacting with Python and provided the developers with an effective tool. 
 
+My personal thanks to the people who contributed to the development of the project:
+- [Alen Å iljak](https://github.com/alensiljak)
+- [Antoine Aubry](https://github.com/aaubry)
+- [Charles Lindsay](https://github.com/VagyokC4)
+- [Doug Robertson](https://github.com/drobertson123)
+- [Spaette](https://github.com/spaette)
+
 ## Contact
 
 - Join us in the chat room here: [![Gitter chat room](https://badges.gitter.im/nledger/Lobby.svg)](https://gitter.im/nledger/lobby);
@@ -250,4 +270,4 @@ who have worked hard to solve complex problems of interacting with Python and pr
 
 The code is licensed under 3-clause [FreeBSD license](https://github.com/dmitry-merzlyakov/nledger/blob/master/LICENSE).
 
-(c) 2017-2021 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
+(c) 2017-2023 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
diff --git a/Source/NLedger.CLI/CommandLineArgs.cs b/Source/NLedger.CLI/CommandLineArgs.cs
index e9fc570f..012e648f 100644
--- a/Source/NLedger.CLI/CommandLineArgs.cs
+++ b/Source/NLedger.CLI/CommandLineArgs.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.CLI/NLedger.CLI.csproj b/Source/NLedger.CLI/NLedger.CLI.csproj
index 4838922f..fad8da32 100644
--- a/Source/NLedger.CLI/NLedger.CLI.csproj
+++ b/Source/NLedger.CLI/NLedger.CLI.csproj
@@ -2,8 +2,8 @@
   
     Exe
     NLedger-cli
-    net472;netcoreapp3.1
-    netcoreapp3.1
+    net48;net6.0;net8.0
+    $(LocalTargetFrameworks)
     publish\
     true
     Disk
@@ -23,8 +23,8 @@
     Dmitry Merzlyakov
     NLedger, the double-entry accounting tool
     NLedger, a .Net port of Ledger accounting system (www.ledger-cli.org)
-    Copyright © 2015-2021, Dmitry Merzlyakov
-    0.8.4
+    Copyright © 2015-2023, Dmitry Merzlyakov
+    0.8.5
     beta
     dev-environment
     bin\$(Configuration)\
diff --git a/Source/NLedger.CLI/Program.cs b/Source/NLedger.CLI/Program.cs
index df91ec48..f1ba9b64 100644
--- a/Source/NLedger.CLI/Program.cs
+++ b/Source/NLedger.CLI/Program.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings;
diff --git a/Source/NLedger.Extensibility.Python.Module/LICENSE.txt b/Source/NLedger.Extensibility.Python.Module/LICENSE.txt
index dd7a2fcf..f09b18dc 100644
--- a/Source/NLedger.Extensibility.Python.Module/LICENSE.txt
+++ b/Source/NLedger.Extensibility.Python.Module/LICENSE.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are
diff --git a/Source/NLedger.Extensibility.Python.Module/README.md b/Source/NLedger.Extensibility.Python.Module/README.md
index cafd5b52..f9673dec 100644
--- a/Source/NLedger.Extensibility.Python.Module/README.md
+++ b/Source/NLedger.Extensibility.Python.Module/README.md
@@ -257,4 +257,4 @@ If detect a problem with .Net Ledger Python module specifically - please, add an
 
 The code is licensed under 3-clause [FreeBSD license](https://github.com/dmitry-merzlyakov/nledger/blob/master/LICENSE).
 
-(c) 2017-2021 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
+(c) 2017-2023 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
diff --git a/Source/NLedger.Extensibility.Python.Module/build.ps1 b/Source/NLedger.Extensibility.Python.Module/build.ps1
index 233c44e3..88c98ebe 100644
--- a/Source/NLedger.Extensibility.Python.Module/build.ps1
+++ b/Source/NLedger.Extensibility.Python.Module/build.ps1
@@ -5,7 +5,7 @@
 .DESCRIPTION
     Helper script that is responsible to build NLedger Python package.
     Basically, it builds the package using pre-built .Net binaries and puts the output "wheel" file into Contrib/Python folder.
-    If build parameters are not specified explicitely, it discovers necessary information on the current environment.
+    If build parameters are not specified explicitly, it discovers necessary information on the current environment.
 
 .PARAMETER pyExecutable
     Fully-qualified path to Python executable file.
diff --git a/Source/NLedger.Extensibility.Python.Module/src/ledger/__init__.py b/Source/NLedger.Extensibility.Python.Module/src/ledger/__init__.py
index 9b506755..e4f574e1 100644
--- a/Source/NLedger.Extensibility.Python.Module/src/ledger/__init__.py
+++ b/Source/NLedger.Extensibility.Python.Module/src/ledger/__init__.py
@@ -1,9 +1,9 @@
 ####################################################################################
-# Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+# Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 # Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 # 
 # This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-# Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+# Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 # See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 ####################################################################################
 
@@ -432,7 +432,7 @@ def origin(self, value):
         self._origin = value
 
     def get_origin(self):
-        raise Exception("Method 'get_origin' should be defined in derived class if 'origin' value is not specified explicitely.")
+        raise Exception("Method 'get_origin' should be defined in derived class if 'origin' value is not specified explicitly.")
 
 ###########################
 # Ported extras
@@ -2748,7 +2748,7 @@ def exchange_commodities(self, commodities: str, addPrices: bool = None, moment
 
         assert(not (commodities is None) and isinstance(commodities, str))
         if addPrices is None:
-            return Value.to_value(self.origin.ExchangeCommodities(commodities, False, DateTime())) # default(DateTime) caused PythonNet issued, so arguments are populated explicitely
+            return Value.to_value(self.origin.ExchangeCommodities(commodities, False, DateTime())) # default(DateTime) caused PythonNet issued, so arguments are populated explicitly
 
         assert(isinstance(addPrices, bool))
         if moment is None:
diff --git a/Source/NLedger.Extensibility.Python.Module/tests/ledger_tests.py b/Source/NLedger.Extensibility.Python.Module/tests/ledger_tests.py
index ed8eb9e4..e6b86013 100644
--- a/Source/NLedger.Extensibility.Python.Module/tests/ledger_tests.py
+++ b/Source/NLedger.Extensibility.Python.Module/tests/ledger_tests.py
@@ -1,9 +1,9 @@
 ####################################################################################
-# Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+# Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 # Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 # 
 # This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-# Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+# Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 # See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 ####################################################################################
 
diff --git a/Source/NLedger.Extensibility.Python.Tests/NLedger.Extensibility.Python.Tests.csproj b/Source/NLedger.Extensibility.Python.Tests/NLedger.Extensibility.Python.Tests.csproj
index a7498a42..1b8fc9d8 100644
--- a/Source/NLedger.Extensibility.Python.Tests/NLedger.Extensibility.Python.Tests.csproj
+++ b/Source/NLedger.Extensibility.Python.Tests/NLedger.Extensibility.Python.Tests.csproj
@@ -1,13 +1,13 @@
 
   
-    net472;netcoreapp3.1
-    netcoreapp3.1
+    net48;net6.0;net8.0
+    $(LocalTargetFrameworks)
     NLedger
     Dmitry Merzlyakov
     NLedger, the double-entry accounting tool
     NLedger, a .Net port of Ledger accounting system (www.ledger-cli.org)
-    Copyright © 2015-2021, Dmitry Merzlyakov
-    0.8.4
+    Copyright © 2015-2023, Dmitry Merzlyakov
+    0.8.5
     beta
     dev-environment
     bin\$(Configuration)\
diff --git a/Source/NLedger.Extensibility.Python.Tests/Platform/EnvPythonConfigurationReaderTests.cs b/Source/NLedger.Extensibility.Python.Tests/Platform/EnvPythonConfigurationReaderTests.cs
index 0ac34d8d..d61bd067 100644
--- a/Source/NLedger.Extensibility.Python.Tests/Platform/EnvPythonConfigurationReaderTests.cs
+++ b/Source/NLedger.Extensibility.Python.Tests/Platform/EnvPythonConfigurationReaderTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Python.Platform;
diff --git a/Source/NLedger.Extensibility.Python.Tests/Platform/LocalResourceAppModuleResolverTests.cs b/Source/NLedger.Extensibility.Python.Tests/Platform/LocalResourceAppModuleResolverTests.cs
index 46c17de8..56b6e8bb 100644
--- a/Source/NLedger.Extensibility.Python.Tests/Platform/LocalResourceAppModuleResolverTests.cs
+++ b/Source/NLedger.Extensibility.Python.Tests/Platform/LocalResourceAppModuleResolverTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Python.Platform;
diff --git a/Source/NLedger.Extensibility.Python.Tests/Platform/XmlFilePythonConfigurationReaderTests.cs b/Source/NLedger.Extensibility.Python.Tests/Platform/XmlFilePythonConfigurationReaderTests.cs
index 0dd65630..05c54fc7 100644
--- a/Source/NLedger.Extensibility.Python.Tests/Platform/XmlFilePythonConfigurationReaderTests.cs
+++ b/Source/NLedger.Extensibility.Python.Tests/Platform/XmlFilePythonConfigurationReaderTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Python.Platform;
diff --git a/Source/NLedger.Extensibility.Python.Tests/PythonFact.cs b/Source/NLedger.Extensibility.Python.Tests/PythonFact.cs
index b08ddda8..aa6bff9a 100644
--- a/Source/NLedger.Extensibility.Python.Tests/PythonFact.cs
+++ b/Source/NLedger.Extensibility.Python.Tests/PythonFact.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Python.Platform;
diff --git a/Source/NLedger.Extensibility.Python.Tests/PythonFunctorTests.cs b/Source/NLedger.Extensibility.Python.Tests/PythonFunctorTests.cs
index b767585d..a0f4c2c0 100644
--- a/Source/NLedger.Extensibility.Python.Tests/PythonFunctorTests.cs
+++ b/Source/NLedger.Extensibility.Python.Tests/PythonFunctorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Python.Platform;
diff --git a/Source/NLedger.Extensibility.Python.Tests/PythonModuleTests.cs b/Source/NLedger.Extensibility.Python.Tests/PythonModuleTests.cs
index 6e733197..6aeff893 100644
--- a/Source/NLedger.Extensibility.Python.Tests/PythonModuleTests.cs
+++ b/Source/NLedger.Extensibility.Python.Tests/PythonModuleTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
@@ -61,17 +61,17 @@ public void PythonModule_ExecuteUnitTests()
                     using (var scope = Py.CreateScope("ledger_tests"))
                     {
                         // Unit tests are executed in local scope. Since Python unit test runner can only manage "main" scope,
-                        // it is necessary to run it explicitely (unittest.main(...)) specifying a test file name as a parameter
+                        // it is necessary to run it explicitly (unittest.main(...)) specifying a test file name as a parameter
                         // Finally, get a boolean value that indicates whether all tests passed well or not (...result.wasSuccessful())
 
                         // Test runner parameters are: 
-                        // exit=False - supresses exiting the current process when all tests are done
-                        // module=None - supresses module importing (basically, "main")
+                        // exit=False - suppresses exiting the current process when all tests are done
+                        // module=None - suppresses module importing (basically, "main")
                         // argv[0] - just a string indicating the current process name (required)
                         // argv[1] - name of a unit test file (should be searchable by Python paths)
 
                         // This method only use a final boolean value (Yes/No) to check whether tests are passed without any diagnostics.
-                        // If it is neccessary to troubleshoot this step, it is recommended to extract a test result object and go through detected errors
+                        // If it is necessary to troubleshoot this step, it is recommended to extract a test result object and go through detected errors
                         // FOr example: var res = scope.Eval(@"unittest.main(exit=False,module=None,argv=('EmbeddedHost','ledger_tests')).result");
 
                         scope.Set("module_test_folder", moduleTestFolder);
diff --git a/Source/NLedger.Extensibility.Python.Tests/PythonValueConverterTests.cs b/Source/NLedger.Extensibility.Python.Tests/PythonValueConverterTests.cs
index cbf10572..f76aef1d 100644
--- a/Source/NLedger.Extensibility.Python.Tests/PythonValueConverterTests.cs
+++ b/Source/NLedger.Extensibility.Python.Tests/PythonValueConverterTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Extensibility.Python.Tests/ServiceApiIntegrationTests.cs b/Source/NLedger.Extensibility.Python.Tests/ServiceApiIntegrationTests.cs
index f8ad27e8..b6f81011 100644
--- a/Source/NLedger.Extensibility.Python.Tests/ServiceApiIntegrationTests.cs
+++ b/Source/NLedger.Extensibility.Python.Tests/ServiceApiIntegrationTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
diff --git a/Source/NLedger.Extensibility.Python/Extensions.cs b/Source/NLedger.Extensibility.Python/Extensions.cs
index d52325ea..cf18f6f6 100644
--- a/Source/NLedger.Extensibility.Python/Extensions.cs
+++ b/Source/NLedger.Extensibility.Python/Extensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using Python.Runtime;
diff --git a/Source/NLedger.Extensibility.Python/NLedger.Extensibility.Python.csproj b/Source/NLedger.Extensibility.Python/NLedger.Extensibility.Python.csproj
index 1c39ea42..8bc4387e 100644
--- a/Source/NLedger.Extensibility.Python/NLedger.Extensibility.Python.csproj
+++ b/Source/NLedger.Extensibility.Python/NLedger.Extensibility.Python.csproj
@@ -1,12 +1,13 @@
 
   
-    netstandard2.0
+    netstandard2.0;net6.0;net8.0
+    $(LocalLibraryTargetFrameworks)
     NLedger
     Dmitry Merzlyakov
     NLedger, the double-entry accounting tool
     NLedger, a .Net port of Ledger accounting system (www.ledger-cli.org)
-    Copyright © 2015-2021, Dmitry Merzlyakov
-    0.8.4
+    Copyright © 2015-2023, Dmitry Merzlyakov
+    0.8.5
     beta
     dev-environment
     bin\$(Configuration)\
diff --git a/Source/NLedger.Extensibility.Python/Platform/EnvPythonConfigurationReader.cs b/Source/NLedger.Extensibility.Python/Platform/EnvPythonConfigurationReader.cs
index 685e526d..83ce32d8 100644
--- a/Source/NLedger.Extensibility.Python/Platform/EnvPythonConfigurationReader.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/EnvPythonConfigurationReader.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/Platform/IAppModuleResolver.cs b/Source/NLedger.Extensibility.Python/Platform/IAppModuleResolver.cs
index 65bcf811..4b59af3b 100644
--- a/Source/NLedger.Extensibility.Python/Platform/IAppModuleResolver.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/IAppModuleResolver.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/Platform/IPythonConfigurationReader.cs b/Source/NLedger.Extensibility.Python/Platform/IPythonConfigurationReader.cs
index f2eecabd..91f36a0e 100644
--- a/Source/NLedger.Extensibility.Python/Platform/IPythonConfigurationReader.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/IPythonConfigurationReader.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/Platform/LocalResourceAppModuleResolver.cs b/Source/NLedger.Extensibility.Python/Platform/LocalResourceAppModuleResolver.cs
index 20fe56ee..135d7c59 100644
--- a/Source/NLedger.Extensibility.Python/Platform/LocalResourceAppModuleResolver.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/LocalResourceAppModuleResolver.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/Platform/PythonConfiguration.cs b/Source/NLedger.Extensibility.Python/Platform/PythonConfiguration.cs
index c070d200..ef6a93da 100644
--- a/Source/NLedger.Extensibility.Python/Platform/PythonConfiguration.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/PythonConfiguration.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/Platform/PythonConnectionContext.cs b/Source/NLedger.Extensibility.Python/Platform/PythonConnectionContext.cs
index 6fd338ae..929e6bb7 100644
--- a/Source/NLedger.Extensibility.Python/Platform/PythonConnectionContext.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/PythonConnectionContext.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/Platform/PythonConnector.cs b/Source/NLedger.Extensibility.Python/Platform/PythonConnector.cs
index 93fd7f98..ecc5ab36 100644
--- a/Source/NLedger.Extensibility.Python/Platform/PythonConnector.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/PythonConnector.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/Platform/PythonHost.cs b/Source/NLedger.Extensibility.Python/Platform/PythonHost.cs
index 2b509ebd..ed85e67b 100644
--- a/Source/NLedger.Extensibility.Python/Platform/PythonHost.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/PythonHost.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/Platform/XmlFilePythonConfigurationReader.cs b/Source/NLedger.Extensibility.Python/Platform/XmlFilePythonConfigurationReader.cs
index b3766105..e46edc88 100644
--- a/Source/NLedger.Extensibility.Python/Platform/XmlFilePythonConfigurationReader.cs
+++ b/Source/NLedger.Extensibility.Python/Platform/XmlFilePythonConfigurationReader.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Extensibility.Python/PythonExtensionProvider.cs b/Source/NLedger.Extensibility.Python/PythonExtensionProvider.cs
index 34856c5c..316381f4 100644
--- a/Source/NLedger.Extensibility.Python/PythonExtensionProvider.cs
+++ b/Source/NLedger.Extensibility.Python/PythonExtensionProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Python.Platform;
diff --git a/Source/NLedger.Extensibility.Python/PythonFunctor.cs b/Source/NLedger.Extensibility.Python/PythonFunctor.cs
index a7b0c1fa..178886f9 100644
--- a/Source/NLedger.Extensibility.Python/PythonFunctor.cs
+++ b/Source/NLedger.Extensibility.Python/PythonFunctor.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Extensibility.Python/PythonModule.cs b/Source/NLedger.Extensibility.Python/PythonModule.cs
index 43b8a361..07d65db2 100644
--- a/Source/NLedger.Extensibility.Python/PythonModule.cs
+++ b/Source/NLedger.Extensibility.Python/PythonModule.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Extensibility.Python/PythonSession.cs b/Source/NLedger.Extensibility.Python/PythonSession.cs
index 3e55c8ba..0d63e5e8 100644
--- a/Source/NLedger.Extensibility.Python/PythonSession.cs
+++ b/Source/NLedger.Extensibility.Python/PythonSession.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Extensibility.Python/PythonSessionConnectionContext.cs b/Source/NLedger.Extensibility.Python/PythonSessionConnectionContext.cs
index 126cfd88..3f0301a8 100644
--- a/Source/NLedger.Extensibility.Python/PythonSessionConnectionContext.cs
+++ b/Source/NLedger.Extensibility.Python/PythonSessionConnectionContext.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Python.Platform;
diff --git a/Source/NLedger.Extensibility.Python/PythonValueConverter.cs b/Source/NLedger.Extensibility.Python/PythonValueConverter.cs
index 96bcc77f..db34e4ab 100644
--- a/Source/NLedger.Extensibility.Python/PythonValueConverter.cs
+++ b/Source/NLedger.Extensibility.Python/PythonValueConverter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.IntegrationTests/NLedger.IntegrationTests.csproj b/Source/NLedger.IntegrationTests/NLedger.IntegrationTests.csproj
index 60725bdd..6ae49b40 100644
--- a/Source/NLedger.IntegrationTests/NLedger.IntegrationTests.csproj
+++ b/Source/NLedger.IntegrationTests/NLedger.IntegrationTests.csproj
@@ -1,13 +1,13 @@
 
   
-    net472;netcoreapp3.1
-    netcoreapp3.1
+    net48;net6.0;net8.0
+    $(LocalTargetFrameworks)
     NLedger
     Dmitry Merzlyakov
     NLedger, the double-entry accounting tool
     NLedger, a .Net port of Ledger accounting system (www.ledger-cli.org)
-    Copyright © 2015-2021, Dmitry Merzlyakov
-    0.8.4
+    Copyright © 2015-2023, Dmitry Merzlyakov
+    0.8.5
     beta
     dev-environment
     bin\$(Configuration)\
diff --git a/Source/NLedger.IntegrationTests/PythonFact.cs b/Source/NLedger.IntegrationTests/PythonFact.cs
index d4ce5b0c..1d367d29 100644
--- a/Source/NLedger.IntegrationTests/PythonFact.cs
+++ b/Source/NLedger.IntegrationTests/PythonFact.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Python;
diff --git a/Source/NLedger.IntegrationTests/TestCase.cs b/Source/NLedger.IntegrationTests/TestCase.cs
index 455baddc..22e611e3 100644
--- a/Source/NLedger.IntegrationTests/TestCase.cs
+++ b/Source/NLedger.IntegrationTests/TestCase.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.IntegrationTests/TestRunner.cs b/Source/NLedger.IntegrationTests/TestRunner.cs
index 9cc25231..f96bd478 100644
--- a/Source/NLedger.IntegrationTests/TestRunner.cs
+++ b/Source/NLedger.IntegrationTests/TestRunner.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts;
diff --git a/Source/NLedger.IntegrationTests/TestSetBaseline.cs b/Source/NLedger.IntegrationTests/TestSetBaseline.cs
index a7f1ae9b..93e889fd 100644
--- a/Source/NLedger.IntegrationTests/TestSetBaseline.cs
+++ b/Source/NLedger.IntegrationTests/TestSetBaseline.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using Xunit;
diff --git a/Source/NLedger.IntegrationTests/TestSetManual.cs b/Source/NLedger.IntegrationTests/TestSetManual.cs
index fa30c444..d3f8628c 100644
--- a/Source/NLedger.IntegrationTests/TestSetManual.cs
+++ b/Source/NLedger.IntegrationTests/TestSetManual.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using Xunit;
diff --git a/Source/NLedger.IntegrationTests/TestSetNLedger.cs b/Source/NLedger.IntegrationTests/TestSetNLedger.cs
index a33cee61..03a90ca9 100644
--- a/Source/NLedger.IntegrationTests/TestSetNLedger.cs
+++ b/Source/NLedger.IntegrationTests/TestSetNLedger.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using Xunit;
@@ -17,6 +17,20 @@ public TestSet_test_nledger()
             Extensibility.Python.Platform.PythonConnector.Current.KeepAlive = false;
         }
 
+        [Fact]
+        [Trait("Category", "Integration")]
+        public void IntegrationTest_test_nledger_gh_issues_24()
+        {
+            new TestRunner(@"test/nledger/gh-issues-24.test").Run();
+        }
+
+        [Fact]
+        [Trait("Category", "Integration")]
+        public void IntegrationTest_test_nledger_gh_issues_29()
+        {
+            new TestRunner(@"test/nledger/gh-issues-29.test").Run();
+        }
+
         [Fact]
         [Trait("Category", "Integration")]
         public void IntegrationTest_test_nledger_gh_issues_5()
diff --git a/Source/NLedger.IntegrationTests/TestSetRegress.cs b/Source/NLedger.IntegrationTests/TestSetRegress.cs
index 4202da82..651b2c8f 100644
--- a/Source/NLedger.IntegrationTests/TestSetRegress.cs
+++ b/Source/NLedger.IntegrationTests/TestSetRegress.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using Xunit;
diff --git a/Source/NLedger.IntegrationTests/TestSetTemplate.cs b/Source/NLedger.IntegrationTests/TestSetTemplate.cs
index a2ea0a85..7faad63b 100644
--- a/Source/NLedger.IntegrationTests/TestSetTemplate.cs
+++ b/Source/NLedger.IntegrationTests/TestSetTemplate.cs
@@ -1,8 +1,8 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
diff --git a/Source/NLedger.IntegrationTests/TestSetTemplate.tt b/Source/NLedger.IntegrationTests/TestSetTemplate.tt
index 6840fc9d..6641ecda 100644
--- a/Source/NLedger.IntegrationTests/TestSetTemplate.tt
+++ b/Source/NLedger.IntegrationTests/TestSetTemplate.tt
@@ -39,11 +39,11 @@ void GenerateSet(string folderName, string pathToTests = @"..\..\Contrib", strin
 
 #>
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2022, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2022, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using Xunit;
diff --git a/Source/NLedger.IntegrationTests/unit/TestAmount.cs b/Source/NLedger.IntegrationTests/unit/TestAmount.cs
index 5b9779c9..ac01b55e 100644
--- a/Source/NLedger.IntegrationTests/unit/TestAmount.cs
+++ b/Source/NLedger.IntegrationTests/unit/TestAmount.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.IntegrationTests/unit/TestBalance.cs b/Source/NLedger.IntegrationTests/unit/TestBalance.cs
index 59a0c5df..603222b3 100644
--- a/Source/NLedger.IntegrationTests/unit/TestBalance.cs
+++ b/Source/NLedger.IntegrationTests/unit/TestBalance.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.IntegrationTests/unit/TestCommodity.cs b/Source/NLedger.IntegrationTests/unit/TestCommodity.cs
index a8a100a8..a7a0e928 100644
--- a/Source/NLedger.IntegrationTests/unit/TestCommodity.cs
+++ b/Source/NLedger.IntegrationTests/unit/TestCommodity.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.IntegrationTests/unit/TestExpr.cs b/Source/NLedger.IntegrationTests/unit/TestExpr.cs
index e457b0f3..f58f6248 100644
--- a/Source/NLedger.IntegrationTests/unit/TestExpr.cs
+++ b/Source/NLedger.IntegrationTests/unit/TestExpr.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Querying;
diff --git a/Source/NLedger.IntegrationTests/unit/TestTimes.cs b/Source/NLedger.IntegrationTests/unit/TestTimes.cs
index d27a49f3..6ef1fbc2 100644
--- a/Source/NLedger.IntegrationTests/unit/TestTimes.cs
+++ b/Source/NLedger.IntegrationTests/unit/TestTimes.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger.IntegrationTests/unit/TestValue.cs b/Source/NLedger.IntegrationTests/unit/TestValue.cs
index d5a8d7b6..ec801cbf 100644
--- a/Source/NLedger.IntegrationTests/unit/TestValue.cs
+++ b/Source/NLedger.IntegrationTests/unit/TestValue.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Abstracts/Impl/ProcessManagerTests.cs b/Source/NLedger.Tests/Abstracts/Impl/ProcessManagerTests.cs
index 50389510..48d07865 100644
--- a/Source/NLedger.Tests/Abstracts/Impl/ProcessManagerTests.cs
+++ b/Source/NLedger.Tests/Abstracts/Impl/ProcessManagerTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
diff --git a/Source/NLedger.Tests/Accounts/AccountTests.cs b/Source/NLedger.Tests/Accounts/AccountTests.cs
index f160ded6..0b4f42d3 100644
--- a/Source/NLedger.Tests/Accounts/AccountTests.cs
+++ b/Source/NLedger.Tests/Accounts/AccountTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Accounts/AccountXDataDetailsTests.cs b/Source/NLedger.Tests/Accounts/AccountXDataDetailsTests.cs
index face0f9a..ae652181 100644
--- a/Source/NLedger.Tests/Accounts/AccountXDataDetailsTests.cs
+++ b/Source/NLedger.Tests/Accounts/AccountXDataDetailsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Amounts/AmountTests.cs b/Source/NLedger.Tests/Amounts/AmountTests.cs
index bcacc4da..f6f311a7 100644
--- a/Source/NLedger.Tests/Amounts/AmountTests.cs
+++ b/Source/NLedger.Tests/Amounts/AmountTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
@@ -283,7 +283,7 @@ public void Amount_IsZero_RoundsToCommodityPrecision()
             Commodity commodityA = new Commodity(CommodityPool.Current, new CommodityBase("AmtNZeroA")) { Precision = 2 };
             // Set a value that less than commodity precision (2) but higher than quantity precision (8)
             Amount amountA = new Amount(Quantity.Parse("0.008", 8), commodityA);
-            Assert.False(amountA.IsZero);  // The value is rounded to 0.01 accorrding to Commodity precision
+            Assert.False(amountA.IsZero);  // The value is rounded to 0.01 according to Commodity precision
         }
 
         [Fact]
@@ -474,7 +474,7 @@ public void Amount_Add_ChangesPrecision()
             Amount amount2 = new Amount(quantity2, null);
 
             Amount result = amount1.InPlaceAdd(amount2);
-            Assert.Equal(2, result.Quantity.Precision);
+            Assert.Equal(3, result.Quantity.Precision);
         }
 
         [Fact]
diff --git a/Source/NLedger.Tests/Annotate/AnnotatedCommodityTests.cs b/Source/NLedger.Tests/Annotate/AnnotatedCommodityTests.cs
index 5e2751ac..380fe09d 100644
--- a/Source/NLedger.Tests/Annotate/AnnotatedCommodityTests.cs
+++ b/Source/NLedger.Tests/Annotate/AnnotatedCommodityTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Annotate/AnnotationKeepDetailsTests.cs b/Source/NLedger.Tests/Annotate/AnnotationKeepDetailsTests.cs
index 81cdda45..e80363d5 100644
--- a/Source/NLedger.Tests/Annotate/AnnotationKeepDetailsTests.cs
+++ b/Source/NLedger.Tests/Annotate/AnnotationKeepDetailsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Annotate;
diff --git a/Source/NLedger.Tests/Annotate/AnnotationTests.cs b/Source/NLedger.Tests/Annotate/AnnotationTests.cs
index 5e6df87c..b3bdb06b 100644
--- a/Source/NLedger.Tests/Annotate/AnnotationTests.cs
+++ b/Source/NLedger.Tests/Annotate/AnnotationTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/BalanceTests.cs b/Source/NLedger.Tests/BalanceTests.cs
index 4881cf1b..b3bf6d13 100644
--- a/Source/NLedger.Tests/BalanceTests.cs
+++ b/Source/NLedger.Tests/BalanceTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/BigIntTests.cs b/Source/NLedger.Tests/BigIntTests.cs
index 9b181463..dcbc1e36 100644
--- a/Source/NLedger.Tests/BigIntTests.cs
+++ b/Source/NLedger.Tests/BigIntTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Commodities;
@@ -19,7 +19,7 @@ namespace NLedger.Tests
 {
     // By default, this test uses BigRational arithmetic to validate BigInt.
     // In case you want to validate BigInt with Decimal arithmetic, uncomment the next alias.
-    // See Amount.cs for further information about Qunatity Arithmetics in NLedger
+    // See Amount.cs for further information about Quantity Arithmetics in NLedger
     using BigInt = BigInt;
     //using BigInt = BigInt;
 
diff --git a/Source/NLedger.Tests/Chain/ChainCommonTests.cs b/Source/NLedger.Tests/Chain/ChainCommonTests.cs
index f2f45eb9..36f432fb 100644
--- a/Source/NLedger.Tests/Chain/ChainCommonTests.cs
+++ b/Source/NLedger.Tests/Chain/ChainCommonTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger.Tests/Chain/ItemHandlerTests.cs b/Source/NLedger.Tests/Chain/ItemHandlerTests.cs
index 64f36892..d4d6b5b9 100644
--- a/Source/NLedger.Tests/Chain/ItemHandlerTests.cs
+++ b/Source/NLedger.Tests/Chain/ItemHandlerTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger.Tests/Commodities/CommodityHistoryTests.cs b/Source/NLedger.Tests/Commodities/CommodityHistoryTests.cs
index d0b6b802..d0a0b262 100644
--- a/Source/NLedger.Tests/Commodities/CommodityHistoryTests.cs
+++ b/Source/NLedger.Tests/Commodities/CommodityHistoryTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Commodities/CommodityPoolTests.cs b/Source/NLedger.Tests/Commodities/CommodityPoolTests.cs
index 0b107b79..3c01e9cd 100644
--- a/Source/NLedger.Tests/Commodities/CommodityPoolTests.cs
+++ b/Source/NLedger.Tests/Commodities/CommodityPoolTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts;
diff --git a/Source/NLedger.Tests/Commodities/CommodityTests.cs b/Source/NLedger.Tests/Commodities/CommodityTests.cs
index 02c8cc39..080975ba 100644
--- a/Source/NLedger.Tests/Commodities/CommodityTests.cs
+++ b/Source/NLedger.Tests/Commodities/CommodityTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Commodities/MemoizedPriceEntryTests.cs b/Source/NLedger.Tests/Commodities/MemoizedPriceEntryTests.cs
index ee663df8..7d576a62 100644
--- a/Source/NLedger.Tests/Commodities/MemoizedPriceEntryTests.cs
+++ b/Source/NLedger.Tests/Commodities/MemoizedPriceEntryTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Commodities;
diff --git a/Source/NLedger.Tests/CompareItemsTests.cs b/Source/NLedger.Tests/CompareItemsTests.cs
index 26df9d2f..d8b2b306 100644
--- a/Source/NLedger.Tests/CompareItemsTests.cs
+++ b/Source/NLedger.Tests/CompareItemsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Expressions/ExprOpTests.cs b/Source/NLedger.Tests/Expressions/ExprOpTests.cs
index 48870d86..cba7e7a6 100644
--- a/Source/NLedger.Tests/Expressions/ExprOpTests.cs
+++ b/Source/NLedger.Tests/Expressions/ExprOpTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/Expressions/ExprParserTests.cs b/Source/NLedger.Tests/Expressions/ExprParserTests.cs
index c43a229b..ef3a8d71 100644
--- a/Source/NLedger.Tests/Expressions/ExprParserTests.cs
+++ b/Source/NLedger.Tests/Expressions/ExprParserTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Expressions/ExprTests.cs b/Source/NLedger.Tests/Expressions/ExprTests.cs
index cf2bd980..fc8f8291 100644
--- a/Source/NLedger.Tests/Expressions/ExprTests.cs
+++ b/Source/NLedger.Tests/Expressions/ExprTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/Expressions/ExprTokenTests.cs b/Source/NLedger.Tests/Expressions/ExprTokenTests.cs
index 4cc6881a..d8e98a96 100644
--- a/Source/NLedger.Tests/Expressions/ExprTokenTests.cs
+++ b/Source/NLedger.Tests/Expressions/ExprTokenTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Extensibility/EmptyExtensionProviderTests.cs b/Source/NLedger.Tests/Extensibility/EmptyExtensionProviderTests.cs
index 51314f1a..8ddd8c4c 100644
--- a/Source/NLedger.Tests/Extensibility/EmptyExtensionProviderTests.cs
+++ b/Source/NLedger.Tests/Extensibility/EmptyExtensionProviderTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility;
diff --git a/Source/NLedger.Tests/Extensibility/Export/FlagsAdapterTests.cs b/Source/NLedger.Tests/Extensibility/Export/FlagsAdapterTests.cs
index a3811774..013ba3a1 100644
--- a/Source/NLedger.Tests/Extensibility/Export/FlagsAdapterTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Export/FlagsAdapterTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Extensibility/Export/FlagsConverterTests.cs b/Source/NLedger.Tests/Extensibility/Export/FlagsConverterTests.cs
index b56411c3..51938631 100644
--- a/Source/NLedger.Tests/Extensibility/Export/FlagsConverterTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Export/FlagsConverterTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Export;
diff --git a/Source/NLedger.Tests/Extensibility/Export/ListAdapterTests.cs b/Source/NLedger.Tests/Extensibility/Export/ListAdapterTests.cs
index 08e1b73b..8a031f26 100644
--- a/Source/NLedger.Tests/Extensibility/Export/ListAdapterTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Export/ListAdapterTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Extensibility/ExtendedSessionTests.cs b/Source/NLedger.Tests/Extensibility/ExtendedSessionTests.cs
index d06eb0a5..3e360a22 100644
--- a/Source/NLedger.Tests/Extensibility/ExtendedSessionTests.cs
+++ b/Source/NLedger.Tests/Extensibility/ExtendedSessionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/Extensibility/ExtensionProviderSelectorTests.cs b/Source/NLedger.Tests/Extensibility/ExtensionProviderSelectorTests.cs
index d442a607..d1c05f42 100644
--- a/Source/NLedger.Tests/Extensibility/ExtensionProviderSelectorTests.cs
+++ b/Source/NLedger.Tests/Extensibility/ExtensionProviderSelectorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility;
diff --git a/Source/NLedger.Tests/Extensibility/Net/BaseFunctorTests.cs b/Source/NLedger.Tests/Extensibility/Net/BaseFunctorTests.cs
index 0303c66b..74a6879d 100644
--- a/Source/NLedger.Tests/Extensibility/Net/BaseFunctorTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/BaseFunctorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Net;
diff --git a/Source/NLedger.Tests/Extensibility/Net/MethodFunctorTests.cs b/Source/NLedger.Tests/Extensibility/Net/MethodFunctorTests.cs
index c572cf4b..bf9bb97d 100644
--- a/Source/NLedger.Tests/Extensibility/Net/MethodFunctorTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/MethodFunctorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Net;
diff --git a/Source/NLedger.Tests/Extensibility/Net/NamespaceResolverTests.cs b/Source/NLedger.Tests/Extensibility/Net/NamespaceResolverTests.cs
index 6478abde..b74596b5 100644
--- a/Source/NLedger.Tests/Extensibility/Net/NamespaceResolverTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/NamespaceResolverTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Net;
diff --git a/Source/NLedger.Tests/Extensibility/Net/NetClassScopeTests.cs b/Source/NLedger.Tests/Extensibility/Net/NetClassScopeTests.cs
index f84e176a..43afaa88 100644
--- a/Source/NLedger.Tests/Extensibility/Net/NetClassScopeTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/NetClassScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Net;
diff --git a/Source/NLedger.Tests/Extensibility/Net/NetNamespaceScopeTests.cs b/Source/NLedger.Tests/Extensibility/Net/NetNamespaceScopeTests.cs
index b57ca4ba..eba77c64 100644
--- a/Source/NLedger.Tests/Extensibility/Net/NetNamespaceScopeTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/NetNamespaceScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Net;
diff --git a/Source/NLedger.Tests/Extensibility/Net/NetSessionIntegrationTests.cs b/Source/NLedger.Tests/Extensibility/Net/NetSessionIntegrationTests.cs
index 2b861576..a58a0ac2 100644
--- a/Source/NLedger.Tests/Extensibility/Net/NetSessionIntegrationTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/NetSessionIntegrationTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
@@ -136,6 +136,7 @@ public void NetSession_IntegrationTest4()
         {
             var inputText = @"
 import assembly System.IO.FileSystem            # This name is for .Net Core
+import assembly System.Private.CoreLib          # This name is for .Net 6
 import assembly mscorlib                        # This name is for .Net Framework
 import alias isfile for System.IO.File.Exists
 
@@ -158,7 +159,7 @@ check isfile(value)
 
             var session = engine.CreateSession("-f /dev/stdin", inputText);
             Assert.True(session.IsActive, session.ErrorText);
-            Assert.Equal("Warning: \"\", line 12: Metadata check failed for (PATH: test/baseline/feat-import_py.test): isfile(value)", session.ErrorText.Trim());
+            Assert.Equal("Warning: \"\", line 13: Metadata check failed for (PATH: test/baseline/feat-import_py.test): isfile(value)", session.ErrorText.Trim());
 
             var response = session.ExecuteCommand("reg");
             Assert.False(response.HasErrors);
diff --git a/Source/NLedger.Tests/Extensibility/Net/NetSessionTests.cs b/Source/NLedger.Tests/Extensibility/Net/NetSessionTests.cs
index 05c79d84..cdc6fba5 100644
--- a/Source/NLedger.Tests/Extensibility/Net/NetSessionTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/NetSessionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Net;
diff --git a/Source/NLedger.Tests/Extensibility/Net/PathFunctorTests.cs b/Source/NLedger.Tests/Extensibility/Net/PathFunctorTests.cs
index f922549c..1b2543f2 100644
--- a/Source/NLedger.Tests/Extensibility/Net/PathFunctorTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/PathFunctorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Net;
diff --git a/Source/NLedger.Tests/Extensibility/Net/ValueConverterTests.cs b/Source/NLedger.Tests/Extensibility/Net/ValueConverterTests.cs
index 13bf536e..68889756 100644
--- a/Source/NLedger.Tests/Extensibility/Net/ValueConverterTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/ValueConverterTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Extensibility/Net/ValueFunctorTests.cs b/Source/NLedger.Tests/Extensibility/Net/ValueFunctorTests.cs
index 75ca1a92..1c5594d6 100644
--- a/Source/NLedger.Tests/Extensibility/Net/ValueFunctorTests.cs
+++ b/Source/NLedger.Tests/Extensibility/Net/ValueFunctorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility.Net;
diff --git a/Source/NLedger.Tests/Extensibility/SessionExtensionsTests.cs b/Source/NLedger.Tests/Extensibility/SessionExtensionsTests.cs
index 93a0547c..772363f2 100644
--- a/Source/NLedger.Tests/Extensibility/SessionExtensionsTests.cs
+++ b/Source/NLedger.Tests/Extensibility/SessionExtensionsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Extensibility;
diff --git a/Source/NLedger.Tests/Extensions.cs b/Source/NLedger.Tests/Extensions.cs
index 09988a5b..4bdfa928 100644
--- a/Source/NLedger.Tests/Extensions.cs
+++ b/Source/NLedger.Tests/Extensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Tests/Filters/AnonymizePostsTests.cs b/Source/NLedger.Tests/Filters/AnonymizePostsTests.cs
index 1411a6ee..9a0b1ce6 100644
--- a/Source/NLedger.Tests/Filters/AnonymizePostsTests.cs
+++ b/Source/NLedger.Tests/Filters/AnonymizePostsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Filters/CalcPostsTests.cs b/Source/NLedger.Tests/Filters/CalcPostsTests.cs
index 88385a2a..5d892ec7 100644
--- a/Source/NLedger.Tests/Filters/CalcPostsTests.cs
+++ b/Source/NLedger.Tests/Filters/CalcPostsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Filters/DisplayFilterPostsTests.cs b/Source/NLedger.Tests/Filters/DisplayFilterPostsTests.cs
index e1f81495..ddead8d0 100644
--- a/Source/NLedger.Tests/Filters/DisplayFilterPostsTests.cs
+++ b/Source/NLedger.Tests/Filters/DisplayFilterPostsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger.Tests/Filters/ForecastPostsTests.cs b/Source/NLedger.Tests/Filters/ForecastPostsTests.cs
index 8af4fd85..c03946a4 100644
--- a/Source/NLedger.Tests/Filters/ForecastPostsTests.cs
+++ b/Source/NLedger.Tests/Filters/ForecastPostsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Filters;
diff --git a/Source/NLedger.Tests/Filters/GeneratePostsTests.cs b/Source/NLedger.Tests/Filters/GeneratePostsTests.cs
index 0ed13c66..2c547724 100644
--- a/Source/NLedger.Tests/Filters/GeneratePostsTests.cs
+++ b/Source/NLedger.Tests/Filters/GeneratePostsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Filters;
diff --git a/Source/NLedger.Tests/Filters/SortPostsTests.cs b/Source/NLedger.Tests/Filters/SortPostsTests.cs
index 48b36a89..8787f8b3 100644
--- a/Source/NLedger.Tests/Filters/SortPostsTests.cs
+++ b/Source/NLedger.Tests/Filters/SortPostsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Filters;
diff --git a/Source/NLedger.Tests/Filters/SubtotalPostsTests.cs b/Source/NLedger.Tests/Filters/SubtotalPostsTests.cs
index 3a37e4d8..9be0d283 100644
--- a/Source/NLedger.Tests/Filters/SubtotalPostsTests.cs
+++ b/Source/NLedger.Tests/Filters/SubtotalPostsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Formatting/FormatTests.cs b/Source/NLedger.Tests/Formatting/FormatTests.cs
index a7548484..1ee151f8 100644
--- a/Source/NLedger.Tests/Formatting/FormatTests.cs
+++ b/Source/NLedger.Tests/Formatting/FormatTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Items/ItemTests.cs b/Source/NLedger.Tests/Items/ItemTests.cs
index a7c9cf48..efb6f78f 100644
--- a/Source/NLedger.Tests/Items/ItemTests.cs
+++ b/Source/NLedger.Tests/Items/ItemTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
@@ -218,6 +218,14 @@ public void Item_ParseTags_Populates_TagsWithValues()
             Assert.Equal("2012/02/02", item.GetTag("MyTag").ToString());
         }
 
+        [Fact]
+        public void Item_ParseTags_Populates_IsParsedFlag()
+        {
+            TestItem item = new TestItem();
+            item.ParseTags(" MyTag: 2012/02/02", null);
+            Assert.True(item.GetMetadata().First().Value.IsParsed);
+        }
+
         [Fact]
         public void Item_Id_ReturnsUUIDTagsIfExists()
         {
diff --git a/Source/NLedger.Tests/Iterators/BasicAccountsIteratorTests.cs b/Source/NLedger.Tests/Iterators/BasicAccountsIteratorTests.cs
index d964428c..c10824ad 100644
--- a/Source/NLedger.Tests/Iterators/BasicAccountsIteratorTests.cs
+++ b/Source/NLedger.Tests/Iterators/BasicAccountsIteratorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Iterators/GeneratePostsIteratorTests.cs b/Source/NLedger.Tests/Iterators/GeneratePostsIteratorTests.cs
index 5a7cb407..a4f70578 100644
--- a/Source/NLedger.Tests/Iterators/GeneratePostsIteratorTests.cs
+++ b/Source/NLedger.Tests/Iterators/GeneratePostsIteratorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Iterators;
diff --git a/Source/NLedger.Tests/Journals/JournalTests.cs b/Source/NLedger.Tests/Journals/JournalTests.cs
index 1d209e28..16c34e85 100644
--- a/Source/NLedger.Tests/Journals/JournalTests.cs
+++ b/Source/NLedger.Tests/Journals/JournalTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/NLedger.Tests.csproj b/Source/NLedger.Tests/NLedger.Tests.csproj
index 74c36e08..65ac7a2e 100644
--- a/Source/NLedger.Tests/NLedger.Tests.csproj
+++ b/Source/NLedger.Tests/NLedger.Tests.csproj
@@ -1,13 +1,13 @@
 
   
-    net452;netcoreapp3.1
-    netcoreapp3.1
+    net48;net6.0;net8.0
+    $(LocalTargetFrameworks)
     NLedger
     Dmitry Merzlyakov
     NLedger, the double-entry accounting tool
     NLedger, a .Net port of Ledger accounting system (www.ledger-cli.org)
-    Copyright © 2015-2021, Dmitry Merzlyakov
-    0.8.4
+    Copyright © 2015-2023, Dmitry Merzlyakov
+    0.8.5
     beta
     dev-environment
     bin\$(Configuration)\
diff --git a/Source/NLedger.Tests/Output/FormatAccountsTests.cs b/Source/NLedger.Tests/Output/FormatAccountsTests.cs
index 21c5d4d8..b43f8899 100644
--- a/Source/NLedger.Tests/Output/FormatAccountsTests.cs
+++ b/Source/NLedger.Tests/Output/FormatAccountsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Output/ReportCommoditiesTests.cs b/Source/NLedger.Tests/Output/ReportCommoditiesTests.cs
index b2d50d32..81b43fd3 100644
--- a/Source/NLedger.Tests/Output/ReportCommoditiesTests.cs
+++ b/Source/NLedger.Tests/Output/ReportCommoditiesTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Commodities;
diff --git a/Source/NLedger.Tests/PostTests.cs b/Source/NLedger.Tests/PostTests.cs
index d3804966..b625caa0 100644
--- a/Source/NLedger.Tests/PostTests.cs
+++ b/Source/NLedger.Tests/PostTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/PreCmdTests.cs b/Source/NLedger.Tests/PreCmdTests.cs
index b7b3096e..c17f525b 100644
--- a/Source/NLedger.Tests/PreCmdTests.cs
+++ b/Source/NLedger.Tests/PreCmdTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger.Tests/Scopus/BindScopeTests.cs b/Source/NLedger.Tests/Scopus/BindScopeTests.cs
index 02ea646c..adba5d83 100644
--- a/Source/NLedger.Tests/Scopus/BindScopeTests.cs
+++ b/Source/NLedger.Tests/Scopus/BindScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/Scopus/CallScopeTests.cs b/Source/NLedger.Tests/Scopus/CallScopeTests.cs
index 22634f89..072f4e9c 100644
--- a/Source/NLedger.Tests/Scopus/CallScopeTests.cs
+++ b/Source/NLedger.Tests/Scopus/CallScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Scopus/ChildScopeTests.cs b/Source/NLedger.Tests/Scopus/ChildScopeTests.cs
index 46973533..fb85cf0a 100644
--- a/Source/NLedger.Tests/Scopus/ChildScopeTests.cs
+++ b/Source/NLedger.Tests/Scopus/ChildScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/Scopus/ContextScopeTests.cs b/Source/NLedger.Tests/Scopus/ContextScopeTests.cs
index 62dfc08c..72cf9938 100644
--- a/Source/NLedger.Tests/Scopus/ContextScopeTests.cs
+++ b/Source/NLedger.Tests/Scopus/ContextScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger.Tests/Scopus/EmptyScopeTests.cs b/Source/NLedger.Tests/Scopus/EmptyScopeTests.cs
index 5a19d007..f1d0c7ca 100644
--- a/Source/NLedger.Tests/Scopus/EmptyScopeTests.cs
+++ b/Source/NLedger.Tests/Scopus/EmptyScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger.Tests/Scopus/GlobalScopeTests.cs b/Source/NLedger.Tests/Scopus/GlobalScopeTests.cs
index 15bd8d14..330af15a 100644
--- a/Source/NLedger.Tests/Scopus/GlobalScopeTests.cs
+++ b/Source/NLedger.Tests/Scopus/GlobalScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
diff --git a/Source/NLedger.Tests/Scopus/MockScope.cs b/Source/NLedger.Tests/Scopus/MockScope.cs
index fb5c1212..4483157b 100644
--- a/Source/NLedger.Tests/Scopus/MockScope.cs
+++ b/Source/NLedger.Tests/Scopus/MockScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/Scopus/OptionCollectionTests.cs b/Source/NLedger.Tests/Scopus/OptionCollectionTests.cs
index dd4986ba..271989ac 100644
--- a/Source/NLedger.Tests/Scopus/OptionCollectionTests.cs
+++ b/Source/NLedger.Tests/Scopus/OptionCollectionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger.Tests/Scopus/OptionTests.cs b/Source/NLedger.Tests/Scopus/OptionTests.cs
index 38718ac0..d7a944a1 100644
--- a/Source/NLedger.Tests/Scopus/OptionTests.cs
+++ b/Source/NLedger.Tests/Scopus/OptionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
@@ -389,7 +389,7 @@ public void Option_Handler_ChecksThatTheFirstArgumentIsStringWhenWantsArgIsYes()
             scope1.PushFront(Value.Get("string"));
             scope1.PushBack(Value.Get(true));
             option1.Handler(scope1);
-            Assert.Equal("true", option1.Value); // Indicates that the call was successfull
+            Assert.Equal("true", option1.Value); // Indicates that the call was successful
 
             Option option2 = new Option("myname_");
             CallScope scope2 = new CallScope(new EmptyScope());
@@ -426,7 +426,7 @@ public void Option_Handler_ChecksThatTheFirstArgumentIsStringWhenWantsArgIsNo()
             CallScope scope1 = new CallScope(new EmptyScope());
             scope1.PushFront(Value.Get("string"));
             option1.Handler(scope1);
-            Assert.True(option1.Handled); // Indicates that the call was successfull
+            Assert.True(option1.Handled); // Indicates that the call was successful
 
             Option option2 = new Option("myname");
             CallScope scope2 = new CallScope(new EmptyScope());
diff --git a/Source/NLedger.Tests/Scopus/ReportTests.cs b/Source/NLedger.Tests/Scopus/ReportTests.cs
index 4e7d08f2..bb0480f6 100644
--- a/Source/NLedger.Tests/Scopus/ReportTests.cs
+++ b/Source/NLedger.Tests/Scopus/ReportTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/Scopus/ScopeExtensionsTests.cs b/Source/NLedger.Tests/Scopus/ScopeExtensionsTests.cs
index 4ecd127f..52305ebc 100644
--- a/Source/NLedger.Tests/Scopus/ScopeExtensionsTests.cs
+++ b/Source/NLedger.Tests/Scopus/ScopeExtensionsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger.Tests/Scopus/SessionTests.cs b/Source/NLedger.Tests/Scopus/SessionTests.cs
index 1e911f56..41637acf 100644
--- a/Source/NLedger.Tests/Scopus/SessionTests.cs
+++ b/Source/NLedger.Tests/Scopus/SessionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
@@ -70,6 +70,12 @@ public void Session_Description_ReturnsCurrentSessionKey()
         [Fact]
         public void Session_ReadData_UsesDefaultLedgerFileNameIfNoFilesSpecifiedAndFilesBecauseOfNoFile()
         {
+            // The fake file system instance guarantess that the session object does not see a default ledger file
+            // that might physically exist on the machine (e.g. %HOMEPATH%\ledger on Windows)
+            var fs = new NLedger.Utility.ServiceAPI.MemoryFileSystemProvider();
+            MainApplicationContext.Current.SetApplicationServiceProvider(new ApplicationServiceProvider
+                (fileSystemProviderFactory: () => fs));
+
             Session session = new Session();
             Assert.Throws(() => session.ReadData(null));
         }
diff --git a/Source/NLedger.Tests/Scopus/SymbolScopeTests.cs b/Source/NLedger.Tests/Scopus/SymbolScopeTests.cs
index 00749f6b..46d8932e 100644
--- a/Source/NLedger.Tests/Scopus/SymbolScopeTests.cs
+++ b/Source/NLedger.Tests/Scopus/SymbolScopeTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/Scopus/SymbolTests.cs b/Source/NLedger.Tests/Scopus/SymbolTests.cs
index 639c5623..c1ae12fb 100644
--- a/Source/NLedger.Tests/Scopus/SymbolTests.cs
+++ b/Source/NLedger.Tests/Scopus/SymbolTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger.Tests/SelectTests.cs b/Source/NLedger.Tests/SelectTests.cs
index 76b777e9..b262b04f 100644
--- a/Source/NLedger.Tests/SelectTests.cs
+++ b/Source/NLedger.Tests/SelectTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger.Tests/TemporariesTests.cs b/Source/NLedger.Tests/TemporariesTests.cs
index 8e1f5c5e..24e27618 100644
--- a/Source/NLedger.Tests/TemporariesTests.cs
+++ b/Source/NLedger.Tests/TemporariesTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/TestConsoleProvider.cs b/Source/NLedger.Tests/TestConsoleProvider.cs
index 0f91ec47..9b5396e1 100644
--- a/Source/NLedger.Tests/TestConsoleProvider.cs
+++ b/Source/NLedger.Tests/TestConsoleProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts;
diff --git a/Source/NLedger.Tests/TestFixture.cs b/Source/NLedger.Tests/TestFixture.cs
index 5182cb24..d4a4701e 100644
--- a/Source/NLedger.Tests/TestFixture.cs
+++ b/Source/NLedger.Tests/TestFixture.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger.Tests/Textual/TextualParserTests.cs b/Source/NLedger.Tests/Textual/TextualParserTests.cs
index c5e8a60c..92df0ee0 100644
--- a/Source/NLedger.Tests/Textual/TextualParserTests.cs
+++ b/Source/NLedger.Tests/Textual/TextualParserTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/TextualReaderTests.cs b/Source/NLedger.Tests/TextualReaderTests.cs
index 03f147c1..e29e04ee 100644
--- a/Source/NLedger.Tests/TextualReaderTests.cs
+++ b/Source/NLedger.Tests/TextualReaderTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Tests/TimeLogging/TimeLogTests.cs b/Source/NLedger.Tests/TimeLogging/TimeLogTests.cs
index c99f8e22..1c0f9494 100644
--- a/Source/NLedger.Tests/TimeLogging/TimeLogTests.cs
+++ b/Source/NLedger.Tests/TimeLogging/TimeLogTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Times/CTimeToNetFormatConverterTests.cs b/Source/NLedger.Tests/Times/CTimeToNetFormatConverterTests.cs
index 2f2ff3bd..dce5e27b 100644
--- a/Source/NLedger.Tests/Times/CTimeToNetFormatConverterTests.cs
+++ b/Source/NLedger.Tests/Times/CTimeToNetFormatConverterTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger.Tests/Times/DateDurationTests.cs b/Source/NLedger.Tests/Times/DateDurationTests.cs
index c5d30ab1..2831b7f9 100644
--- a/Source/NLedger.Tests/Times/DateDurationTests.cs
+++ b/Source/NLedger.Tests/Times/DateDurationTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger.Tests/Times/DateIntervalTests.cs b/Source/NLedger.Tests/Times/DateIntervalTests.cs
index 74ccbadb..06b89b0b 100644
--- a/Source/NLedger.Tests/Times/DateIntervalTests.cs
+++ b/Source/NLedger.Tests/Times/DateIntervalTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger.Tests/Times/DateParserLexerTests.cs b/Source/NLedger.Tests/Times/DateParserLexerTests.cs
index cfdfc0fe..fe6a6bda 100644
--- a/Source/NLedger.Tests/Times/DateParserLexerTests.cs
+++ b/Source/NLedger.Tests/Times/DateParserLexerTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger.Tests/Times/LexerTokenTests.cs b/Source/NLedger.Tests/Times/LexerTokenTests.cs
index 4c76a6a9..85e4d7ec 100644
--- a/Source/NLedger.Tests/Times/LexerTokenTests.cs
+++ b/Source/NLedger.Tests/Times/LexerTokenTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger.Tests/Times/TimesCommonTests.cs b/Source/NLedger.Tests/Times/TimesCommonTests.cs
index 14fea952..67377219 100644
--- a/Source/NLedger.Tests/Times/TimesCommonTests.cs
+++ b/Source/NLedger.Tests/Times/TimesCommonTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger.Tests/Utility/BigValues/BigRationalTests.cs b/Source/NLedger.Tests/Utility/BigValues/BigRationalTests.cs
index 484623ee..e0a23839 100644
--- a/Source/NLedger.Tests/Utility/BigValues/BigRationalTests.cs
+++ b/Source/NLedger.Tests/Utility/BigValues/BigRationalTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.BigValues;
diff --git a/Source/NLedger.Tests/Utility/BoostVariantTests.cs b/Source/NLedger.Tests/Utility/BoostVariantTests.cs
index 411433cb..369caf5d 100644
--- a/Source/NLedger.Tests/Utility/BoostVariantTests.cs
+++ b/Source/NLedger.Tests/Utility/BoostVariantTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/CollectionIteratorTests.cs b/Source/NLedger.Tests/Utility/CollectionIteratorTests.cs
index 20dd6af5..43d558fe 100644
--- a/Source/NLedger.Tests/Utility/CollectionIteratorTests.cs
+++ b/Source/NLedger.Tests/Utility/CollectionIteratorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/CommandLineTests.cs b/Source/NLedger.Tests/Utility/CommandLineTests.cs
index 5d4c11b5..35f286e2 100644
--- a/Source/NLedger.Tests/Utility/CommandLineTests.cs
+++ b/Source/NLedger.Tests/Utility/CommandLineTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/DateExtensionTests.cs b/Source/NLedger.Tests/Utility/DateExtensionTests.cs
index 14752527..9620f587 100644
--- a/Source/NLedger.Tests/Utility/DateExtensionTests.cs
+++ b/Source/NLedger.Tests/Utility/DateExtensionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Tests/Utility/DateTests.cs b/Source/NLedger.Tests/Utility/DateTests.cs
index 03d28854..03778762 100644
--- a/Source/NLedger.Tests/Utility/DateTests.cs
+++ b/Source/NLedger.Tests/Utility/DateTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Tests/Utility/ErrorContextTests.cs b/Source/NLedger.Tests/Utility/ErrorContextTests.cs
index f029e9a4..b3d25675 100644
--- a/Source/NLedger.Tests/Utility/ErrorContextTests.cs
+++ b/Source/NLedger.Tests/Utility/ErrorContextTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
diff --git a/Source/NLedger.Tests/Utility/FileNameComparerTests.cs b/Source/NLedger.Tests/Utility/FileNameComparerTests.cs
index 45292f49..7b25b693 100644
--- a/Source/NLedger.Tests/Utility/FileNameComparerTests.cs
+++ b/Source/NLedger.Tests/Utility/FileNameComparerTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/FileSystemTests.cs b/Source/NLedger.Tests/Utility/FileSystemTests.cs
index 3fc49891..7f3d87ac 100644
--- a/Source/NLedger.Tests/Utility/FileSystemTests.cs
+++ b/Source/NLedger.Tests/Utility/FileSystemTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/Graph/AdjacencyListTests.cs b/Source/NLedger.Tests/Utility/Graph/AdjacencyListTests.cs
index 5963b905..6a9531a2 100644
--- a/Source/NLedger.Tests/Utility/Graph/AdjacencyListTests.cs
+++ b/Source/NLedger.Tests/Utility/Graph/AdjacencyListTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Graph;
diff --git a/Source/NLedger.Tests/Utility/Graph/EdgeDescriptorTests.cs b/Source/NLedger.Tests/Utility/Graph/EdgeDescriptorTests.cs
index f8033868..528fe68d 100644
--- a/Source/NLedger.Tests/Utility/Graph/EdgeDescriptorTests.cs
+++ b/Source/NLedger.Tests/Utility/Graph/EdgeDescriptorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Graph;
diff --git a/Source/NLedger.Tests/Utility/Graph/GraphExtensionsTests.cs b/Source/NLedger.Tests/Utility/Graph/GraphExtensionsTests.cs
index 482a580b..876764f7 100644
--- a/Source/NLedger.Tests/Utility/Graph/GraphExtensionsTests.cs
+++ b/Source/NLedger.Tests/Utility/Graph/GraphExtensionsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Graph;
diff --git a/Source/NLedger.Tests/Utility/Graph/ReadOnlyGraphTests.cs b/Source/NLedger.Tests/Utility/Graph/ReadOnlyGraphTests.cs
index c73efc1c..92548625 100644
--- a/Source/NLedger.Tests/Utility/Graph/ReadOnlyGraphTests.cs
+++ b/Source/NLedger.Tests/Utility/Graph/ReadOnlyGraphTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Graph;
diff --git a/Source/NLedger.Tests/Utility/Graph/ShortestPathSearcherTests.cs b/Source/NLedger.Tests/Utility/Graph/ShortestPathSearcherTests.cs
index 382052dd..0b842cd6 100644
--- a/Source/NLedger.Tests/Utility/Graph/ShortestPathSearcherTests.cs
+++ b/Source/NLedger.Tests/Utility/Graph/ShortestPathSearcherTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Graph;
diff --git a/Source/NLedger.Tests/Utility/Graph/VertexDescriptorTests.cs b/Source/NLedger.Tests/Utility/Graph/VertexDescriptorTests.cs
index 7b580ff8..ed9ca172 100644
--- a/Source/NLedger.Tests/Utility/Graph/VertexDescriptorTests.cs
+++ b/Source/NLedger.Tests/Utility/Graph/VertexDescriptorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Graph;
diff --git a/Source/NLedger.Tests/Utility/InputTextStreamTests.cs b/Source/NLedger.Tests/Utility/InputTextStreamTests.cs
index f645857e..344a1b0a 100644
--- a/Source/NLedger.Tests/Utility/InputTextStreamTests.cs
+++ b/Source/NLedger.Tests/Utility/InputTextStreamTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/ObjectExtensionsTests.cs b/Source/NLedger.Tests/Utility/ObjectExtensionsTests.cs
index f3ac97d3..9a9e9869 100644
--- a/Source/NLedger.Tests/Utility/ObjectExtensionsTests.cs
+++ b/Source/NLedger.Tests/Utility/ObjectExtensionsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/Rnd/BoolGeneratorTests.cs b/Source/NLedger.Tests/Utility/Rnd/BoolGeneratorTests.cs
index ac8a9a43..608441cb 100644
--- a/Source/NLedger.Tests/Utility/Rnd/BoolGeneratorTests.cs
+++ b/Source/NLedger.Tests/Utility/Rnd/BoolGeneratorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Rnd;
diff --git a/Source/NLedger.Tests/Utility/Rnd/CharGeneratorTests.cs b/Source/NLedger.Tests/Utility/Rnd/CharGeneratorTests.cs
index 0e646dec..d8236c89 100644
--- a/Source/NLedger.Tests/Utility/Rnd/CharGeneratorTests.cs
+++ b/Source/NLedger.Tests/Utility/Rnd/CharGeneratorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Rnd;
diff --git a/Source/NLedger.Tests/Utility/Rnd/DoubleGeneratorTests.cs b/Source/NLedger.Tests/Utility/Rnd/DoubleGeneratorTests.cs
index 3cf4a41c..ca406a01 100644
--- a/Source/NLedger.Tests/Utility/Rnd/DoubleGeneratorTests.cs
+++ b/Source/NLedger.Tests/Utility/Rnd/DoubleGeneratorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Rnd;
diff --git a/Source/NLedger.Tests/Utility/Rnd/IntegerGeneratorTests.cs b/Source/NLedger.Tests/Utility/Rnd/IntegerGeneratorTests.cs
index 0ae02128..50d91277 100644
--- a/Source/NLedger.Tests/Utility/Rnd/IntegerGeneratorTests.cs
+++ b/Source/NLedger.Tests/Utility/Rnd/IntegerGeneratorTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Rnd;
diff --git a/Source/NLedger.Tests/Utility/SHA1Tests.cs b/Source/NLedger.Tests/Utility/SHA1Tests.cs
index 3fdd2fb7..e00ca46c 100644
--- a/Source/NLedger.Tests/Utility/SHA1Tests.cs
+++ b/Source/NLedger.Tests/Utility/SHA1Tests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/ServiceAPI/MemoryFileSystemProviderTests.cs b/Source/NLedger.Tests/Utility/ServiceAPI/MemoryFileSystemProviderTests.cs
index 73cc28e9..1e234b76 100644
--- a/Source/NLedger.Tests/Utility/ServiceAPI/MemoryFileSystemProviderTests.cs
+++ b/Source/NLedger.Tests/Utility/ServiceAPI/MemoryFileSystemProviderTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.ServiceAPI;
diff --git a/Source/NLedger.Tests/Utility/ServiceAPI/ServiceAPIIntegrationTests.cs b/Source/NLedger.Tests/Utility/ServiceAPI/ServiceAPIIntegrationTests.cs
index 8c4cd3df..c3bfa956 100644
--- a/Source/NLedger.Tests/Utility/ServiceAPI/ServiceAPIIntegrationTests.cs
+++ b/Source/NLedger.Tests/Utility/ServiceAPI/ServiceAPIIntegrationTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
@@ -210,14 +210,14 @@ public void ServiceAPI_IntegrationTests_9()
             Assert.Single(posts);
 
             // Note: once session response is received, current thread is out of NLedger application context.
-            // It means that queried objects (posts in this example) are accessible, but provide limited functinality.
+            // It means that queried objects (posts in this example) are accessible, but provide limited functionality.
             // Some properties or functions are accessible; some might trigger runtime exceptions.
             var post = posts.Single();
             Assert.Equal("Expenses:Food", post.Account.ToString());
             Assert.Equal(20, post.Amount.Quantity.ToLong());
 
             // If you need to get full access to all properties and functions, you need to set NLedger application context.
-            // (at least, for a limited scoope like "using" below). In bounds of this scope, all NLedger functinality is available.
+            // (at least, for a limited scope like "using" below). In bounds of this scope, all NLedger functionality is available.
             using (response.MainApplicationContext.AcquireCurrentThread())
             {
                 Assert.Equal("Payee", post.Payee);
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/CascadeSettingsContainerTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/CascadeSettingsContainerTests.cs
index 078f0ada..cb76ce6a 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/CascadeSettingsContainerTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/CascadeSettingsContainerTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/BaseSettingDefinitionTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/BaseSettingDefinitionTests.cs
index 1fe5c810..6e7ac3f5 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/BaseSettingDefinitionTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/BaseSettingDefinitionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/BoolSettingDefinitionTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/BoolSettingDefinitionTests.cs
index 813d1ed4..a28dcb74 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/BoolSettingDefinitionTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/BoolSettingDefinitionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/EncodingSettingDefinitionTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/EncodingSettingDefinitionTests.cs
index 465d6876..6f26664e 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/EncodingSettingDefinitionTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/EncodingSettingDefinitionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/IntegerSettingDefinitionTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/IntegerSettingDefinitionTests.cs
index e79c7697..c6540930 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/IntegerSettingDefinitionTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/IntegerSettingDefinitionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/StringSettingDefinitionTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/StringSettingDefinitionTests.cs
index 0e1491ca..66160dd1 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/StringSettingDefinitionTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/StringSettingDefinitionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/TimeZoneSettingDefinitionTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/TimeZoneSettingDefinitionTests.cs
index 5e27ae1a..507f19ca 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/TimeZoneSettingDefinitionTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Definitions/TimeZoneSettingDefinitionTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/SettingValueTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/SettingValueTests.cs
index d573722c..63edf0ed 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/SettingValueTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/SettingValueTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/ConfigurationFileSettingsSourceTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/ConfigurationFileSettingsSourceTests.cs
index 5b5ad9d3..926bd140 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/ConfigurationFileSettingsSourceTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/ConfigurationFileSettingsSourceTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/CustomDataSourceTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/CustomDataSourceTests.cs
index 9dd91355..3e8b8c34 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/CustomDataSourceTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/CustomDataSourceTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/DefaultSettingsSourceTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/DefaultSettingsSourceTests.cs
index e8ca87d8..6bc0524d 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/DefaultSettingsSourceTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/DefaultSettingsSourceTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/EnvironmentVariablesSettingsSourceTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/EnvironmentVariablesSettingsSourceTests.cs
index c4bcb5f8..32de9146 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/EnvironmentVariablesSettingsSourceTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/EnvironmentVariablesSettingsSourceTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/SystemConfigurationSettingsSourceTests.cs b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/SystemConfigurationSettingsSourceTests.cs
index bf9e619b..5292b39f 100644
--- a/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/SystemConfigurationSettingsSourceTests.cs
+++ b/Source/NLedger.Tests/Utility/Settings/CascadeSettings/Sources/SystemConfigurationSettingsSourceTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger.Tests/Utility/StringExtensionsTests.cs b/Source/NLedger.Tests/Utility/StringExtensionsTests.cs
index fe81ff44..92a4eb2b 100644
--- a/Source/NLedger.Tests/Utility/StringExtensionsTests.cs
+++ b/Source/NLedger.Tests/Utility/StringExtensionsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger.Tests/Utility/Xml/XmlExtensionsTests.cs b/Source/NLedger.Tests/Utility/Xml/XmlExtensionsTests.cs
index 7d602e03..4c6cce00 100644
--- a/Source/NLedger.Tests/Utility/Xml/XmlExtensionsTests.cs
+++ b/Source/NLedger.Tests/Utility/Xml/XmlExtensionsTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Xml;
diff --git a/Source/NLedger.Tests/Utils/CancellationManagerTests.cs b/Source/NLedger.Tests/Utils/CancellationManagerTests.cs
index 5a11f158..08d6a191 100644
--- a/Source/NLedger.Tests/Utils/CancellationManagerTests.cs
+++ b/Source/NLedger.Tests/Utils/CancellationManagerTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utils;
diff --git a/Source/NLedger.Tests/Utils/LoggerTests.cs b/Source/NLedger.Tests/Utils/LoggerTests.cs
index bac8c21f..61716546 100644
--- a/Source/NLedger.Tests/Utils/LoggerTests.cs
+++ b/Source/NLedger.Tests/Utils/LoggerTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utils;
diff --git a/Source/NLedger.Tests/Utils/TimerContextTests.cs b/Source/NLedger.Tests/Utils/TimerContextTests.cs
index 03725d6c..b238a0bf 100644
--- a/Source/NLedger.Tests/Utils/TimerContextTests.cs
+++ b/Source/NLedger.Tests/Utils/TimerContextTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utils;
diff --git a/Source/NLedger.Tests/Values/DefaultValueComparerTests.cs b/Source/NLedger.Tests/Values/DefaultValueComparerTests.cs
index 9238dc83..ac75d8e1 100644
--- a/Source/NLedger.Tests/Values/DefaultValueComparerTests.cs
+++ b/Source/NLedger.Tests/Values/DefaultValueComparerTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Values;
diff --git a/Source/NLedger.Tests/Values/ValueStorageTests.cs b/Source/NLedger.Tests/Values/ValueStorageTests.cs
index aac1e2ef..74e67cae 100644
--- a/Source/NLedger.Tests/Values/ValueStorageTests.cs
+++ b/Source/NLedger.Tests/Values/ValueStorageTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Values/ValueTests.cs b/Source/NLedger.Tests/Values/ValueTests.cs
index 2829616f..a2ed38ad 100644
--- a/Source/NLedger.Tests/Values/ValueTests.cs
+++ b/Source/NLedger.Tests/Values/ValueTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger.Tests/Xacts/AddBalancingPostTests.cs b/Source/NLedger.Tests/Xacts/AddBalancingPostTests.cs
index 5814450c..28fc252b 100644
--- a/Source/NLedger.Tests/Xacts/AddBalancingPostTests.cs
+++ b/Source/NLedger.Tests/Xacts/AddBalancingPostTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger.Tests/Xacts/AutoXactTests.cs b/Source/NLedger.Tests/Xacts/AutoXactTests.cs
index b3628fb2..954836af 100644
--- a/Source/NLedger.Tests/Xacts/AutoXactTests.cs
+++ b/Source/NLedger.Tests/Xacts/AutoXactTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger.Tests/Xacts/XactTests.cs b/Source/NLedger.Tests/Xacts/XactTests.cs
index 19e92ee8..b1f08138 100644
--- a/Source/NLedger.Tests/Xacts/XactTests.cs
+++ b/Source/NLedger.Tests/Xacts/XactTests.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Abstracts/IFileSystemProvider.cs b/Source/NLedger/Abstracts/IFileSystemProvider.cs
index 0cbf3de8..0caebf70 100644
--- a/Source/NLedger/Abstracts/IFileSystemProvider.cs
+++ b/Source/NLedger/Abstracts/IFileSystemProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Abstracts/IManPageProvider.cs b/Source/NLedger/Abstracts/IManPageProvider.cs
index 6a9b48e6..7ff7d844 100644
--- a/Source/NLedger/Abstracts/IManPageProvider.cs
+++ b/Source/NLedger/Abstracts/IManPageProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -22,7 +22,7 @@ public interface IManPageProvider
         /// 
         /// Show man page and immediately return execution flow
         /// 
-        /// Indicates whether the operation is successfull
+        /// Indicates whether the operation is successful
         bool Show();
     }
 }
diff --git a/Source/NLedger/Abstracts/IPagerProvider.cs b/Source/NLedger/Abstracts/IPagerProvider.cs
index 56b5ddf6..17959da9 100644
--- a/Source/NLedger/Abstracts/IPagerProvider.cs
+++ b/Source/NLedger/Abstracts/IPagerProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Abstracts/IProcessManager.cs b/Source/NLedger/Abstracts/IProcessManager.cs
index 26ed1229..4c84be11 100644
--- a/Source/NLedger/Abstracts/IProcessManager.cs
+++ b/Source/NLedger/Abstracts/IProcessManager.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Abstracts/IQuoteProvider.cs b/Source/NLedger/Abstracts/IQuoteProvider.cs
index 8ac2bb8d..0a0a7cc0 100644
--- a/Source/NLedger/Abstracts/IQuoteProvider.cs
+++ b/Source/NLedger/Abstracts/IQuoteProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Abstracts/IVirtualConsoleProvider.cs b/Source/NLedger/Abstracts/IVirtualConsoleProvider.cs
index 8d706034..1928186c 100644
--- a/Source/NLedger/Abstracts/IVirtualConsoleProvider.cs
+++ b/Source/NLedger/Abstracts/IVirtualConsoleProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -59,7 +59,7 @@ public interface IVirtualConsoleProvider
         /// See https://tiswww.case.edu/php/chet/readline/history.html
         /// 
         /// Optional key that filters history
-        /// Text to expact
+        /// Text to expect
         /// Result
         /// 
         /// Note: return Zero if history is not available
diff --git a/Source/NLedger/Abstracts/Impl/FileSystemProvider.cs b/Source/NLedger/Abstracts/Impl/FileSystemProvider.cs
index 4588d05e..c4e1d512 100644
--- a/Source/NLedger/Abstracts/Impl/FileSystemProvider.cs
+++ b/Source/NLedger/Abstracts/Impl/FileSystemProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Abstracts/Impl/ManPageProvider.cs b/Source/NLedger/Abstracts/Impl/ManPageProvider.cs
index 06d2e9d7..3b3664b4 100644
--- a/Source/NLedger/Abstracts/Impl/ManPageProvider.cs
+++ b/Source/NLedger/Abstracts/Impl/ManPageProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Abstracts/Impl/PagerProvider.cs b/Source/NLedger/Abstracts/Impl/PagerProvider.cs
index 8ac06bc2..06a722c4 100644
--- a/Source/NLedger/Abstracts/Impl/PagerProvider.cs
+++ b/Source/NLedger/Abstracts/Impl/PagerProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
@@ -81,7 +81,7 @@ public virtual void RunPager(string pagerPath, string outputText)
             }
             catch (Exception ex)
             {
-                Logger.Current.Debug("pager", () => String.Format("Error occured during pager execution: {0}", ex.Message));
+                Logger.Current.Debug("pager", () => String.Format("Error occurred during pager execution: {0}", ex.Message));
                 throw new LogicError(String.Format("Error in the pager: {0}", ex.Message));
             }
         }
diff --git a/Source/NLedger/Abstracts/Impl/ProcessManager.cs b/Source/NLedger/Abstracts/Impl/ProcessManager.cs
index 6002c6c2..1383c733 100644
--- a/Source/NLedger/Abstracts/Impl/ProcessManager.cs
+++ b/Source/NLedger/Abstracts/Impl/ProcessManager.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Abstracts/Impl/QuoteProvider.cs b/Source/NLedger/Abstracts/Impl/QuoteProvider.cs
index 4cececfb..5d7c6473 100644
--- a/Source/NLedger/Abstracts/Impl/QuoteProvider.cs
+++ b/Source/NLedger/Abstracts/Impl/QuoteProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Abstracts/Impl/VirtualConsoleProvider.cs b/Source/NLedger/Abstracts/Impl/VirtualConsoleProvider.cs
index 31a23ca0..8ed73f79 100644
--- a/Source/NLedger/Abstracts/Impl/VirtualConsoleProvider.cs
+++ b/Source/NLedger/Abstracts/Impl/VirtualConsoleProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Accounts/Account.cs b/Source/NLedger/Accounts/Account.cs
index 34d66fcc..892e63b5 100644
--- a/Source/NLedger/Accounts/Account.cs
+++ b/Source/NLedger/Accounts/Account.cs
@@ -1,13 +1,14 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
 using NLedger.Scopus;
+using NLedger.Utility;
 using NLedger.Utils;
 using NLedger.Values;
 using System;
@@ -562,7 +563,7 @@ private static Value GetEarliest(Account account)
 
         private static Value GetEarliestCheckin(Account account)
         {
-            return account.SelfDetails().EarliestCheckin != null ? Value.Get(account.SelfDetails().EarliestCheckin) : Value.Empty;
+            return !account.SelfDetails().EarliestCheckin.IsNotADateTime() ? Value.Get(account.SelfDetails().EarliestCheckin) : Value.Empty;
         }
 
         private static Value GetSubcount(Account account)
@@ -582,7 +583,7 @@ private static Value GetLatest(Account account)
 
         private static Value GetLatestCheckout(Account account)
         {
-            return account.SelfDetails().LatestCheckout != null ? Value.Get(account.SelfDetails().LatestCheckout) : Value.Empty;
+            return !account.SelfDetails().LatestCheckout.IsNotADateTime() ? Value.Get(account.SelfDetails().LatestCheckout) : Value.Empty;
         }
 
         private static Value GetLatestCheckoutCleared(Account account)
diff --git a/Source/NLedger/Accounts/AccountXData.cs b/Source/NLedger/Accounts/AccountXData.cs
index 899d9032..5a6a93bf 100644
--- a/Source/NLedger/Accounts/AccountXData.cs
+++ b/Source/NLedger/Accounts/AccountXData.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Values;
diff --git a/Source/NLedger/Accounts/AccountXDataDetails.cs b/Source/NLedger/Accounts/AccountXDataDetails.cs
index 1de653df..8bdc246e 100644
--- a/Source/NLedger/Accounts/AccountXDataDetails.cs
+++ b/Source/NLedger/Accounts/AccountXDataDetails.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Items;
diff --git a/Source/NLedger/Amounts/Amount.cs b/Source/NLedger/Amounts/Amount.cs
index 6392febe..0a4fd3ff 100644
--- a/Source/NLedger/Amounts/Amount.cs
+++ b/Source/NLedger/Amounts/Amount.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -187,7 +187,7 @@ public static void Initialize()
         {
             CommodityPool.Cleanup();
 
-            // Add time commodity conversions, so that timelog's may be parsed
+            // Add time commodity conversions, so that timelogs may be parsed
             // in terms of seconds, but reported as minutes or hours.
             Commodity commS = CommodityPool.Current.Create("s");
             if (commS != null)
@@ -866,7 +866,7 @@ public Amount InPlaceAdd(Amount amount)
             BigInt quantity = Quantity + amount.Quantity;
 
             if (HasCommodity == amount.HasCommodity && quantity.Precision < amount.Quantity.Precision)
-                quantity.SetPrecision(amount.Quantity.Precision);
+                quantity = quantity.SetPrecision(amount.Quantity.Precision);
 
             Quantity = quantity;
             return this;
@@ -1505,7 +1505,7 @@ public string Print(AmountPrintEnum flags = AmountPrintEnum.AMOUNT_PRINT_NO_FLAG
         }
 
         /// 
-        /// to_string() returns an amount'ss "display value" as a string --
+        /// to_string() returns an amount's "display value" as a string --
         /// after rounding the value according to the commodity's default
         /// precision.  It is equivalent to: `round().to_fullstring()'.
         /// 
diff --git a/Source/NLedger/Amounts/AmountError.cs b/Source/NLedger/Amounts/AmountError.cs
index c68dd510..ce67f9f7 100644
--- a/Source/NLedger/Amounts/AmountError.cs
+++ b/Source/NLedger/Amounts/AmountError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Amounts/AmountParseFlagsEnum.cs b/Source/NLedger/Amounts/AmountParseFlagsEnum.cs
index 4175e294..0e9ddba5 100644
--- a/Source/NLedger/Amounts/AmountParseFlagsEnum.cs
+++ b/Source/NLedger/Amounts/AmountParseFlagsEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Amounts/AmountPrintEnum.cs b/Source/NLedger/Amounts/AmountPrintEnum.cs
index ad0846bb..71538dae 100644
--- a/Source/NLedger/Amounts/AmountPrintEnum.cs
+++ b/Source/NLedger/Amounts/AmountPrintEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Annotate/AnnotatedCommodity.cs b/Source/NLedger/Annotate/AnnotatedCommodity.cs
index a5e453d7..e6f03fea 100644
--- a/Source/NLedger/Annotate/AnnotatedCommodity.cs
+++ b/Source/NLedger/Annotate/AnnotatedCommodity.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Commodities;
diff --git a/Source/NLedger/Annotate/Annotation.cs b/Source/NLedger/Annotate/Annotation.cs
index f208857d..a7803817 100644
--- a/Source/NLedger/Annotate/Annotation.cs
+++ b/Source/NLedger/Annotate/Annotation.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Annotate/AnnotationKeepDetails.cs b/Source/NLedger/Annotate/AnnotationKeepDetails.cs
index 19333ea7..04a90bbf 100644
--- a/Source/NLedger/Annotate/AnnotationKeepDetails.cs
+++ b/Source/NLedger/Annotate/AnnotationKeepDetails.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Commodities;
diff --git a/Source/NLedger/AssertionFailedError.cs b/Source/NLedger/AssertionFailedError.cs
index 4b455d87..34fe5e96 100644
--- a/Source/NLedger/AssertionFailedError.cs
+++ b/Source/NLedger/AssertionFailedError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Balance.cs b/Source/NLedger/Balance.cs
index 59cfa727..9fadb093 100644
--- a/Source/NLedger/Balance.cs
+++ b/Source/NLedger/Balance.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -648,7 +648,7 @@ public List SortedAmounts()
         /**
          * Iteration primitives.  `map_sorted_amounts' allows one to visit
          * each amount in balance in the proper order for displaying to the
-         * user.  Mostly used by `print' and other routinse where the sort
+         * user.  Mostly used by `print' and other routines where the sort
          * order of the amounts' commodities is significant.
          */
         public void MapSortedAmounts(Action fn)
diff --git a/Source/NLedger/BalanceError.cs b/Source/NLedger/BalanceError.cs
index 8761226a..c071c180 100644
--- a/Source/NLedger/BalanceError.cs
+++ b/Source/NLedger/BalanceError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/BigInt.cs b/Source/NLedger/BigInt.cs
index aba7b2a6..362ca0c3 100644
--- a/Source/NLedger/BigInt.cs
+++ b/Source/NLedger/BigInt.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Commodities;
diff --git a/Source/NLedger/Chain/AccountHandler.cs b/Source/NLedger/Chain/AccountHandler.cs
index b8397ef5..76bb7aee 100644
--- a/Source/NLedger/Chain/AccountHandler.cs
+++ b/Source/NLedger/Chain/AccountHandler.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Chain/ChainCommon.cs b/Source/NLedger/Chain/ChainCommon.cs
index da4ba12b..1ded78d0 100644
--- a/Source/NLedger/Chain/ChainCommon.cs
+++ b/Source/NLedger/Chain/ChainCommon.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
@@ -161,7 +161,7 @@ public static PostHandler ChainPostHandlers(PostHandler baseHandler, Report repo
                 // xact, which has one post for each commodity in each account.
                 //
                 // period_posts is like subtotal_posts, but it subtotals according to time
-                // periods rather than totalling everything.
+                // periods rather than totaling everything.
                 //
                 // day_of_week_posts is like period_posts, except that it reports
                 // all the posts that fall on each subsequent day of the week.
diff --git a/Source/NLedger/Chain/ItemHandler.cs b/Source/NLedger/Chain/ItemHandler.cs
index 7050f003..43a50b92 100644
--- a/Source/NLedger/Chain/ItemHandler.cs
+++ b/Source/NLedger/Chain/ItemHandler.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utils;
diff --git a/Source/NLedger/Chain/PostHandler.cs b/Source/NLedger/Chain/PostHandler.cs
index 37069e6d..60d170c5 100644
--- a/Source/NLedger/Chain/PostHandler.cs
+++ b/Source/NLedger/Chain/PostHandler.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Commodities/Commodity.cs b/Source/NLedger/Commodities/Commodity.cs
index 8fcbb697..fa94cf88 100644
--- a/Source/NLedger/Commodities/Commodity.cs
+++ b/Source/NLedger/Commodities/Commodity.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
@@ -33,7 +33,7 @@ public class Commodity : IComparable, IEquatable, ICompara
          * for default ordering of commodities. The previous considerations still make sence: changing SortedDictionary to Dictionary
          * leads to failed tests (cmd-pricemap.test, regress\7C44010B.test) because of differences in hashing between .Net Dictionary and the unordered_map.
          * DM: migrated test "cmd-org.test" revealed an issue with class balance_t.
-         * In partucular, its member "amounts" (typedef std::map amounts_map)
+         * In particular, its member "amounts" (typedef std::map amounts_map)
          * does not specify any comparison rules (there is no third generic type in the template), 
          * so std::map uses a default comparer (std:less). It compares commodity instances by means of operator "<" - __x < __y.
          * Since commodity_to does not override this operator, the system compares _object_allocation_addresses_ in memory.
diff --git a/Source/NLedger/Commodities/CommodityBase.cs b/Source/NLedger/Commodities/CommodityBase.cs
index 729ddc8d..6cdf8104 100644
--- a/Source/NLedger/Commodities/CommodityBase.cs
+++ b/Source/NLedger/Commodities/CommodityBase.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Commodities/CommodityFlagsEnum.cs b/Source/NLedger/Commodities/CommodityFlagsEnum.cs
index 5465b791..9d94c9f3 100644
--- a/Source/NLedger/Commodities/CommodityFlagsEnum.cs
+++ b/Source/NLedger/Commodities/CommodityFlagsEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Commodities/CommodityHistory.cs b/Source/NLedger/Commodities/CommodityHistory.cs
index e1f5423e..c00f3e70 100644
--- a/Source/NLedger/Commodities/CommodityHistory.cs
+++ b/Source/NLedger/Commodities/CommodityHistory.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Commodities/CommodityPool.cs b/Source/NLedger/Commodities/CommodityPool.cs
index 04deb7aa..85d401e1 100644
--- a/Source/NLedger/Commodities/CommodityPool.cs
+++ b/Source/NLedger/Commodities/CommodityPool.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Commodities/ICommodityHistory.cs b/Source/NLedger/Commodities/ICommodityHistory.cs
index f3ee509f..86bd0d7b 100644
--- a/Source/NLedger/Commodities/ICommodityHistory.cs
+++ b/Source/NLedger/Commodities/ICommodityHistory.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Commodities/PricePoint.cs b/Source/NLedger/Commodities/PricePoint.cs
index 3528c03c..c7c4c6ad 100644
--- a/Source/NLedger/Commodities/PricePoint.cs
+++ b/Source/NLedger/Commodities/PricePoint.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/CompareItems.cs b/Source/NLedger/CompareItems.cs
index 45e37988..d9bc4d2f 100644
--- a/Source/NLedger/CompareItems.cs
+++ b/Source/NLedger/CompareItems.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Converter.cs b/Source/NLedger/Converter.cs
index 61800120..6c136d5b 100644
--- a/Source/NLedger/Converter.cs
+++ b/Source/NLedger/Converter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
@@ -106,7 +106,7 @@ public Value ConvertCommand(CallScope args)
 
             // If not, transform the payee according to regexps
 
-            // Set the account to a default vaule, then transform the account according
+            // Set the account to a default value, then transform the account according
             // to the payee
 
             // Print out the final form of the transaction
diff --git a/Source/NLedger/CountError.cs b/Source/NLedger/CountError.cs
index d611c53c..31e8984f 100644
--- a/Source/NLedger/CountError.cs
+++ b/Source/NLedger/CountError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Csv/CsvHeadersEnum.cs b/Source/NLedger/Csv/CsvHeadersEnum.cs
index 8eeae935..e656df47 100644
--- a/Source/NLedger/Csv/CsvHeadersEnum.cs
+++ b/Source/NLedger/Csv/CsvHeadersEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Csv/CsvReader.cs b/Source/NLedger/Csv/CsvReader.cs
index 74e13d08..e92bb357 100644
--- a/Source/NLedger/Csv/CsvReader.cs
+++ b/Source/NLedger/Csv/CsvReader.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Drafts/Draft.cs b/Source/NLedger/Drafts/Draft.cs
index 3dac86c1..33b25308 100644
--- a/Source/NLedger/Drafts/Draft.cs
+++ b/Source/NLedger/Drafts/Draft.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Drafts/DraftXactPostTemplate.cs b/Source/NLedger/Drafts/DraftXactPostTemplate.cs
index ce15110b..781c2e27 100644
--- a/Source/NLedger/Drafts/DraftXactPostTemplate.cs
+++ b/Source/NLedger/Drafts/DraftXactPostTemplate.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Drafts/DraftXactTemplate.cs b/Source/NLedger/Drafts/DraftXactTemplate.cs
index fc07b416..578461db 100644
--- a/Source/NLedger/Drafts/DraftXactTemplate.cs
+++ b/Source/NLedger/Drafts/DraftXactTemplate.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Drafts/DraftsCommon.cs b/Source/NLedger/Drafts/DraftsCommon.cs
index 9783db03..5d398266 100644
--- a/Source/NLedger/Drafts/DraftsCommon.cs
+++ b/Source/NLedger/Drafts/DraftsCommon.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Print;
diff --git a/Source/NLedger/Expressions/CalcError.cs b/Source/NLedger/Expressions/CalcError.cs
index 3b946ccf..99052925 100644
--- a/Source/NLedger/Expressions/CalcError.cs
+++ b/Source/NLedger/Expressions/CalcError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Expressions/CheckExprPair.cs b/Source/NLedger/Expressions/CheckExprPair.cs
index 5bbc7e61..7e17f6f4 100644
--- a/Source/NLedger/Expressions/CheckExprPair.cs
+++ b/Source/NLedger/Expressions/CheckExprPair.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Expressions/CompileError.cs b/Source/NLedger/Expressions/CompileError.cs
index 4eeac558..9acf7ed4 100644
--- a/Source/NLedger/Expressions/CompileError.cs
+++ b/Source/NLedger/Expressions/CompileError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Expressions/Expr.cs b/Source/NLedger/Expressions/Expr.cs
index 80c7b436..166d0246 100644
--- a/Source/NLedger/Expressions/Expr.cs
+++ b/Source/NLedger/Expressions/Expr.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Expressions/ExprBase.cs b/Source/NLedger/Expressions/ExprBase.cs
index 4a0cab01..e247263b 100644
--- a/Source/NLedger/Expressions/ExprBase.cs
+++ b/Source/NLedger/Expressions/ExprBase.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Expressions/ExprOp.cs b/Source/NLedger/Expressions/ExprOp.cs
index eb11097d..44c9ef43 100644
--- a/Source/NLedger/Expressions/ExprOp.cs
+++ b/Source/NLedger/Expressions/ExprOp.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Commodities;
@@ -136,7 +136,7 @@ public static void CheckTypeContext(Scope scope, Value result)
         public static ExprOp FindDefinition(ExprOp op, Scope scope, ExprOp locus, int depth, int recursionDepth = 0)
         {
             // If the object we are apply call notation to is a FUNCTION value
-            // or a O_LAMBDA expression, then this is the object we want to
+            // or an O_LAMBDA expression, then this is the object we want to
             // call.
             if (op.IsFunction || op.Kind == OpKindEnum.O_LAMBDA)
                 return op;
diff --git a/Source/NLedger/Expressions/ExprOpCollection.cs b/Source/NLedger/Expressions/ExprOpCollection.cs
index eef26655..9d02bb36 100644
--- a/Source/NLedger/Expressions/ExprOpCollection.cs
+++ b/Source/NLedger/Expressions/ExprOpCollection.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger/Expressions/ExprOpContext.cs b/Source/NLedger/Expressions/ExprOpContext.cs
index b7933dc0..54e5fff6 100644
--- a/Source/NLedger/Expressions/ExprOpContext.cs
+++ b/Source/NLedger/Expressions/ExprOpContext.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Expressions/ExprParser.cs b/Source/NLedger/Expressions/ExprParser.cs
index b5a0fea8..cadd3258 100644
--- a/Source/NLedger/Expressions/ExprParser.cs
+++ b/Source/NLedger/Expressions/ExprParser.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Expressions/ExprToken.cs b/Source/NLedger/Expressions/ExprToken.cs
index 66257a3a..b938a7a1 100644
--- a/Source/NLedger/Expressions/ExprToken.cs
+++ b/Source/NLedger/Expressions/ExprToken.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Expressions/ExprTokenKind.cs b/Source/NLedger/Expressions/ExprTokenKind.cs
index 1ac28484..98288cdb 100644
--- a/Source/NLedger/Expressions/ExprTokenKind.cs
+++ b/Source/NLedger/Expressions/ExprTokenKind.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Expressions/MergedExpr.cs b/Source/NLedger/Expressions/MergedExpr.cs
index 25008e73..20925620 100644
--- a/Source/NLedger/Expressions/MergedExpr.cs
+++ b/Source/NLedger/Expressions/MergedExpr.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger/Extensibility/EmptyExtensionProvider.cs b/Source/NLedger/Extensibility/EmptyExtensionProvider.cs
index 0fc202e5..cebe9839 100644
--- a/Source/NLedger/Extensibility/EmptyExtensionProvider.cs
+++ b/Source/NLedger/Extensibility/EmptyExtensionProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/Export/ExportedConsts.cs b/Source/NLedger/Extensibility/Export/ExportedConsts.cs
index 08f2c568..8f9829c6 100644
--- a/Source/NLedger/Extensibility/Export/ExportedConsts.cs
+++ b/Source/NLedger/Extensibility/Export/ExportedConsts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/Export/FlagsAdapter.cs b/Source/NLedger/Extensibility/Export/FlagsAdapter.cs
index b0bc5929..6235e0fc 100644
--- a/Source/NLedger/Extensibility/Export/FlagsAdapter.cs
+++ b/Source/NLedger/Extensibility/Export/FlagsAdapter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Commodities;
diff --git a/Source/NLedger/Extensibility/Export/FlagsConverter.cs b/Source/NLedger/Extensibility/Export/FlagsConverter.cs
index 7bfbf900..a7613410 100644
--- a/Source/NLedger/Extensibility/Export/FlagsConverter.cs
+++ b/Source/NLedger/Extensibility/Export/FlagsConverter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/Export/ListAdapter.cs b/Source/NLedger/Extensibility/Export/ListAdapter.cs
index 3f6e49c2..03faeb7d 100644
--- a/Source/NLedger/Extensibility/Export/ListAdapter.cs
+++ b/Source/NLedger/Extensibility/Export/ListAdapter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -16,7 +16,7 @@ namespace NLedger.Extensibility.Export
 {
     /// 
     /// This is a wrapper for exported List objects. It keeps a reference to an original list, mimics basic methods but hides interfaces 
-    /// that might identify the origin as a list. Replacing lists with the wrapper prevents impicit conversion by connectors that causes loosing 
+    /// that might identify the origin as a list. Replacing lists with the wrapper prevents implicit conversion by connectors that causes loosing 
     /// a reference to the origin. So, wrapped lists properly supply mutability (manipulations with the exported list are reflected in the origin).
     /// 
     public class ListAdapter
diff --git a/Source/NLedger/Extensibility/ExtendedSession.cs b/Source/NLedger/Extensibility/ExtendedSession.cs
index e0cdeb36..0c788f72 100644
--- a/Source/NLedger/Extensibility/ExtendedSession.cs
+++ b/Source/NLedger/Extensibility/ExtendedSession.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Extensibility/ExtensionEvalModeEnum.cs b/Source/NLedger/Extensibility/ExtensionEvalModeEnum.cs
index 5c24b5eb..29e1d5ac 100644
--- a/Source/NLedger/Extensibility/ExtensionEvalModeEnum.cs
+++ b/Source/NLedger/Extensibility/ExtensionEvalModeEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/ExtensionProviderSelector.cs b/Source/NLedger/Extensibility/ExtensionProviderSelector.cs
index 6ab330ff..3d6406ec 100644
--- a/Source/NLedger/Extensibility/ExtensionProviderSelector.cs
+++ b/Source/NLedger/Extensibility/ExtensionProviderSelector.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/IExtensionProvider.cs b/Source/NLedger/Extensibility/IExtensionProvider.cs
index 1320df1e..ea49ed18 100644
--- a/Source/NLedger/Extensibility/IExtensionProvider.cs
+++ b/Source/NLedger/Extensibility/IExtensionProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/Net/BaseFunctor.cs b/Source/NLedger/Extensibility/Net/BaseFunctor.cs
index 3f15a81b..1493f1f4 100644
--- a/Source/NLedger/Extensibility/Net/BaseFunctor.cs
+++ b/Source/NLedger/Extensibility/Net/BaseFunctor.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Extensibility/Net/INamespaceResolver.cs b/Source/NLedger/Extensibility/Net/INamespaceResolver.cs
index f702b92d..b9bfb5bd 100644
--- a/Source/NLedger/Extensibility/Net/INamespaceResolver.cs
+++ b/Source/NLedger/Extensibility/Net/INamespaceResolver.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/Net/IValueConverter.cs b/Source/NLedger/Extensibility/Net/IValueConverter.cs
index b6f776d2..55e21b61 100644
--- a/Source/NLedger/Extensibility/Net/IValueConverter.cs
+++ b/Source/NLedger/Extensibility/Net/IValueConverter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Values;
diff --git a/Source/NLedger/Extensibility/Net/MethodFunctor.cs b/Source/NLedger/Extensibility/Net/MethodFunctor.cs
index aeda85bb..78fb5144 100644
--- a/Source/NLedger/Extensibility/Net/MethodFunctor.cs
+++ b/Source/NLedger/Extensibility/Net/MethodFunctor.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Extensibility/Net/NamespaceResolver.cs b/Source/NLedger/Extensibility/Net/NamespaceResolver.cs
index 367a6da6..033b32f3 100644
--- a/Source/NLedger/Extensibility/Net/NamespaceResolver.cs
+++ b/Source/NLedger/Extensibility/Net/NamespaceResolver.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/Net/NetClassScope.cs b/Source/NLedger/Extensibility/Net/NetClassScope.cs
index dcff6830..f215a179 100644
--- a/Source/NLedger/Extensibility/Net/NetClassScope.cs
+++ b/Source/NLedger/Extensibility/Net/NetClassScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Extensibility/Net/NetExtensionProvider.cs b/Source/NLedger/Extensibility/Net/NetExtensionProvider.cs
index 53912387..9a7f4b34 100644
--- a/Source/NLedger/Extensibility/Net/NetExtensionProvider.cs
+++ b/Source/NLedger/Extensibility/Net/NetExtensionProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Extensibility/Net/NetNamespaceScope.cs b/Source/NLedger/Extensibility/Net/NetNamespaceScope.cs
index 2adca34f..cc14567c 100644
--- a/Source/NLedger/Extensibility/Net/NetNamespaceScope.cs
+++ b/Source/NLedger/Extensibility/Net/NetNamespaceScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Extensibility/Net/NetSession.cs b/Source/NLedger/Extensibility/Net/NetSession.cs
index f1a3ee9c..8f21f9eb 100644
--- a/Source/NLedger/Extensibility/Net/NetSession.cs
+++ b/Source/NLedger/Extensibility/Net/NetSession.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Extensibility/Net/PathFunctor.cs b/Source/NLedger/Extensibility/Net/PathFunctor.cs
index bd96fb9c..11db5bb7 100644
--- a/Source/NLedger/Extensibility/Net/PathFunctor.cs
+++ b/Source/NLedger/Extensibility/Net/PathFunctor.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Extensibility/Net/ValueConverter.cs b/Source/NLedger/Extensibility/Net/ValueConverter.cs
index 28d7cbe6..0d14df41 100644
--- a/Source/NLedger/Extensibility/Net/ValueConverter.cs
+++ b/Source/NLedger/Extensibility/Net/ValueConverter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Extensibility/Net/ValueFunctor.cs b/Source/NLedger/Extensibility/Net/ValueFunctor.cs
index 630777e1..fb991a3c 100644
--- a/Source/NLedger/Extensibility/Net/ValueFunctor.cs
+++ b/Source/NLedger/Extensibility/Net/ValueFunctor.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger/Extensibility/SessionExtensions.cs b/Source/NLedger/Extensibility/SessionExtensions.cs
index b94be837..f17ab316 100644
--- a/Source/NLedger/Extensibility/SessionExtensions.cs
+++ b/Source/NLedger/Extensibility/SessionExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
@@ -62,7 +62,7 @@ public static CommandExecutionResult ExecuteCommand(this Session session, string
         /// Executes a Ledger command with arguments and returns the output as a text. Helpful for third-party integration software.
         /// 
         /// Current session instance
-        /// Enuemrable of strings that contains a command with arguments
+        /// Enumerable of strings that contains a command with arguments
         /// Optional flag indicating whether it shoudl read journal files before executing teh command
         /// Command execution result (output text and/or error messages)
         /// This method is composed from Main.Execute, GlobalScope.ExecuteCommandWrapper and GlobalScope.ExecuteCommand.
diff --git a/Source/NLedger/Filters/AnonymizePosts.cs b/Source/NLedger/Filters/AnonymizePosts.cs
index 2cee31e2..fce16783 100644
--- a/Source/NLedger/Filters/AnonymizePosts.cs
+++ b/Source/NLedger/Filters/AnonymizePosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/BudgetPosts.cs b/Source/NLedger/Filters/BudgetPosts.cs
index cdb5badb..2d2ae2db 100644
--- a/Source/NLedger/Filters/BudgetPosts.cs
+++ b/Source/NLedger/Filters/BudgetPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/ByPayeePosts.cs b/Source/NLedger/Filters/ByPayeePosts.cs
index 929f9a6a..1afde19c 100644
--- a/Source/NLedger/Filters/ByPayeePosts.cs
+++ b/Source/NLedger/Filters/ByPayeePosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/CalcPosts.cs b/Source/NLedger/Filters/CalcPosts.cs
index 966f2c5e..46278127 100644
--- a/Source/NLedger/Filters/CalcPosts.cs
+++ b/Source/NLedger/Filters/CalcPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/ChangedValuePost.cs b/Source/NLedger/Filters/ChangedValuePost.cs
index 3f750a32..e1e180a5 100644
--- a/Source/NLedger/Filters/ChangedValuePost.cs
+++ b/Source/NLedger/Filters/ChangedValuePost.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/CollapsePosts.cs b/Source/NLedger/Filters/CollapsePosts.cs
index 3af56297..675bea56 100644
--- a/Source/NLedger/Filters/CollapsePosts.cs
+++ b/Source/NLedger/Filters/CollapsePosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/CollectPosts.cs b/Source/NLedger/Filters/CollectPosts.cs
index df0d4eaa..ab9c356a 100644
--- a/Source/NLedger/Filters/CollectPosts.cs
+++ b/Source/NLedger/Filters/CollectPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/DayOfWeekPosts.cs b/Source/NLedger/Filters/DayOfWeekPosts.cs
index 769c3560..bd80298b 100644
--- a/Source/NLedger/Filters/DayOfWeekPosts.cs
+++ b/Source/NLedger/Filters/DayOfWeekPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/DisplayFilterPosts.cs b/Source/NLedger/Filters/DisplayFilterPosts.cs
index fc397de2..cd9570f2 100644
--- a/Source/NLedger/Filters/DisplayFilterPosts.cs
+++ b/Source/NLedger/Filters/DisplayFilterPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/FilterPosts.cs b/Source/NLedger/Filters/FilterPosts.cs
index 63502cc9..2ec56ee8 100644
--- a/Source/NLedger/Filters/FilterPosts.cs
+++ b/Source/NLedger/Filters/FilterPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/FiltersCommon.cs b/Source/NLedger/Filters/FiltersCommon.cs
index 151aeb2d..e1133bb6 100644
--- a/Source/NLedger/Filters/FiltersCommon.cs
+++ b/Source/NLedger/Filters/FiltersCommon.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/ForecastPosts.cs b/Source/NLedger/Filters/ForecastPosts.cs
index c70d516a..483f4f0e 100644
--- a/Source/NLedger/Filters/ForecastPosts.cs
+++ b/Source/NLedger/Filters/ForecastPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
@@ -83,7 +83,7 @@ public override void Flush()
             // of the pending_posts_list for each posting.
             //
             // The algorithm below works by iterating through the N periodic postings
-            // over and over, until each of them mets the termination critera for the
+            // over and over, until each of them meets the termination criteria for the
             // forecast and is removed from the set.
 
             while (PendingPosts.Any())
diff --git a/Source/NLedger/Filters/GeneratePosts.cs b/Source/NLedger/Filters/GeneratePosts.cs
index 8116ac66..7104d20c 100644
--- a/Source/NLedger/Filters/GeneratePosts.cs
+++ b/Source/NLedger/Filters/GeneratePosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/IgnorePosts.cs b/Source/NLedger/Filters/IgnorePosts.cs
index 1bf2075e..40254e20 100644
--- a/Source/NLedger/Filters/IgnorePosts.cs
+++ b/Source/NLedger/Filters/IgnorePosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/InjectPosts.cs b/Source/NLedger/Filters/InjectPosts.cs
index 00d566f1..3387245d 100644
--- a/Source/NLedger/Filters/InjectPosts.cs
+++ b/Source/NLedger/Filters/InjectPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/IntervalPosts.cs b/Source/NLedger/Filters/IntervalPosts.cs
index 683d4034..ed0477b1 100644
--- a/Source/NLedger/Filters/IntervalPosts.cs
+++ b/Source/NLedger/Filters/IntervalPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/PassDownAccounts.cs b/Source/NLedger/Filters/PassDownAccounts.cs
index cb403f32..47ebca10 100644
--- a/Source/NLedger/Filters/PassDownAccounts.cs
+++ b/Source/NLedger/Filters/PassDownAccounts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/PassDownPosts.cs b/Source/NLedger/Filters/PassDownPosts.cs
index aa2a699c..03bbf8b8 100644
--- a/Source/NLedger/Filters/PassDownPosts.cs
+++ b/Source/NLedger/Filters/PassDownPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/PostSplitter.cs b/Source/NLedger/Filters/PostSplitter.cs
index b0199797..0b08a9a4 100644
--- a/Source/NLedger/Filters/PostSplitter.cs
+++ b/Source/NLedger/Filters/PostSplitter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/PostsAsEquity.cs b/Source/NLedger/Filters/PostsAsEquity.cs
index ad1b4512..b1dfe41d 100644
--- a/Source/NLedger/Filters/PostsAsEquity.cs
+++ b/Source/NLedger/Filters/PostsAsEquity.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/PushToPostsLists.cs b/Source/NLedger/Filters/PushToPostsLists.cs
index fda78128..9fab9054 100644
--- a/Source/NLedger/Filters/PushToPostsLists.cs
+++ b/Source/NLedger/Filters/PushToPostsLists.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/RelatedPosts.cs b/Source/NLedger/Filters/RelatedPosts.cs
index 712bb750..f0fd709c 100644
--- a/Source/NLedger/Filters/RelatedPosts.cs
+++ b/Source/NLedger/Filters/RelatedPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/SortPosts.cs b/Source/NLedger/Filters/SortPosts.cs
index bdda744b..d65b8b5c 100644
--- a/Source/NLedger/Filters/SortPosts.cs
+++ b/Source/NLedger/Filters/SortPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/SortXacts.cs b/Source/NLedger/Filters/SortXacts.cs
index e36aa660..218d9990 100644
--- a/Source/NLedger/Filters/SortXacts.cs
+++ b/Source/NLedger/Filters/SortXacts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Filters/SubtotalPosts.cs b/Source/NLedger/Filters/SubtotalPosts.cs
index 7bfcb591..82226354 100644
--- a/Source/NLedger/Filters/SubtotalPosts.cs
+++ b/Source/NLedger/Filters/SubtotalPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/TransferDetails.cs b/Source/NLedger/Filters/TransferDetails.cs
index ed05f139..f73c54f3 100644
--- a/Source/NLedger/Filters/TransferDetails.cs
+++ b/Source/NLedger/Filters/TransferDetails.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Filters/TransferDetailsElementEnum.cs b/Source/NLedger/Filters/TransferDetailsElementEnum.cs
index 13523599..c87cc259 100644
--- a/Source/NLedger/Filters/TransferDetailsElementEnum.cs
+++ b/Source/NLedger/Filters/TransferDetailsElementEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Filters/TruncateXacts.cs b/Source/NLedger/Filters/TruncateXacts.cs
index 15c12800..cd48f251 100644
--- a/Source/NLedger/Filters/TruncateXacts.cs
+++ b/Source/NLedger/Filters/TruncateXacts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/FormatEmacsPosts.cs b/Source/NLedger/FormatEmacsPosts.cs
index 00584489..2260ee18 100644
--- a/Source/NLedger/FormatEmacsPosts.cs
+++ b/Source/NLedger/FormatEmacsPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/FormatPTree.cs b/Source/NLedger/FormatPTree.cs
index 66f05729..d24303c0 100644
--- a/Source/NLedger/FormatPTree.cs
+++ b/Source/NLedger/FormatPTree.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Formatting/Format.cs b/Source/NLedger/Formatting/Format.cs
index 17f92c47..a641bf61 100644
--- a/Source/NLedger/Formatting/Format.cs
+++ b/Source/NLedger/Formatting/Format.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Formatting/FormatElement.cs b/Source/NLedger/Formatting/FormatElement.cs
index f4873606..ab4fc916 100644
--- a/Source/NLedger/Formatting/FormatElement.cs
+++ b/Source/NLedger/Formatting/FormatElement.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Formatting/FormatElementEnum.cs b/Source/NLedger/Formatting/FormatElementEnum.cs
index e73c3bf3..0e9a5bf7 100644
--- a/Source/NLedger/Formatting/FormatElementEnum.cs
+++ b/Source/NLedger/Formatting/FormatElementEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Formatting/FormatElisionStyleEnum.cs b/Source/NLedger/Formatting/FormatElisionStyleEnum.cs
index 633003a5..cbbda0e8 100644
--- a/Source/NLedger/Formatting/FormatElisionStyleEnum.cs
+++ b/Source/NLedger/Formatting/FormatElisionStyleEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Formatting/FormatError.cs b/Source/NLedger/Formatting/FormatError.cs
index 98ad9e4e..a3de5cbc 100644
--- a/Source/NLedger/Formatting/FormatError.cs
+++ b/Source/NLedger/Formatting/FormatError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/ITextualReader.cs b/Source/NLedger/ITextualReader.cs
index c0efc52f..4c7cf22e 100644
--- a/Source/NLedger/ITextualReader.cs
+++ b/Source/NLedger/ITextualReader.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Items/Item.cs b/Source/NLedger/Items/Item.cs
index eb120a28..30bb63e1 100644
--- a/Source/NLedger/Items/Item.cs
+++ b/Source/NLedger/Items/Item.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
@@ -180,10 +180,10 @@ public virtual void ParseTags(string note, Scope scope, bool overwriteExisting =
                     if (byValue)
                     {
                         BindScope boundScope = new BindScope(scope, this);
-                        SetTag(tag, new Expr(field).Calc(boundScope), overwriteExisting);
+                        SetTag(tag, new Expr(field).Calc(boundScope), overwriteExisting, true);
                     }
                     else
-                        SetTag(tag, Value.Get(field), overwriteExisting);
+                        SetTag(tag, Value.Get(field), overwriteExisting, true);
 
                     break;
                 }
diff --git a/Source/NLedger/Items/ItemPosition.cs b/Source/NLedger/Items/ItemPosition.cs
index 1244b56e..059ef519 100644
--- a/Source/NLedger/Items/ItemPosition.cs
+++ b/Source/NLedger/Items/ItemPosition.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Items/ItemStateEnum.cs b/Source/NLedger/Items/ItemStateEnum.cs
index 6cdb34d6..4fa9d365 100644
--- a/Source/NLedger/Items/ItemStateEnum.cs
+++ b/Source/NLedger/Items/ItemStateEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Items/ItemTag.cs b/Source/NLedger/Items/ItemTag.cs
index 5d03a8b5..e3d9fe96 100644
--- a/Source/NLedger/Items/ItemTag.cs
+++ b/Source/NLedger/Items/ItemTag.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Values;
diff --git a/Source/NLedger/Iterators/BasicAccountsIterator.cs b/Source/NLedger/Iterators/BasicAccountsIterator.cs
index da3d75fa..615229e3 100644
--- a/Source/NLedger/Iterators/BasicAccountsIterator.cs
+++ b/Source/NLedger/Iterators/BasicAccountsIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Iterators/GeneratePostsIterator.cs b/Source/NLedger/Iterators/GeneratePostsIterator.cs
index 83060999..17ee5101 100644
--- a/Source/NLedger/Iterators/GeneratePostsIterator.cs
+++ b/Source/NLedger/Iterators/GeneratePostsIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger/Iterators/IIterator.cs b/Source/NLedger/Iterators/IIterator.cs
index ebd7e5e5..384e1232 100644
--- a/Source/NLedger/Iterators/IIterator.cs
+++ b/Source/NLedger/Iterators/IIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Iterators/JournalPostsIterator.cs b/Source/NLedger/Iterators/JournalPostsIterator.cs
index 27002ea6..4b7adfee 100644
--- a/Source/NLedger/Iterators/JournalPostsIterator.cs
+++ b/Source/NLedger/Iterators/JournalPostsIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Journals;
diff --git a/Source/NLedger/Iterators/PostCommoditiesIterator.cs b/Source/NLedger/Iterators/PostCommoditiesIterator.cs
index 7a12a8bd..28edf39a 100644
--- a/Source/NLedger/Iterators/PostCommoditiesIterator.cs
+++ b/Source/NLedger/Iterators/PostCommoditiesIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Iterators/SortedAccountsIterator.cs b/Source/NLedger/Iterators/SortedAccountsIterator.cs
index b2bd487c..7b206879 100644
--- a/Source/NLedger/Iterators/SortedAccountsIterator.cs
+++ b/Source/NLedger/Iterators/SortedAccountsIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Iterators/XactPostsIterator.cs b/Source/NLedger/Iterators/XactPostsIterator.cs
index 6fa22ce0..7792dd37 100644
--- a/Source/NLedger/Iterators/XactPostsIterator.cs
+++ b/Source/NLedger/Iterators/XactPostsIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Xacts;
diff --git a/Source/NLedger/Iterators/XactsIterator.cs b/Source/NLedger/Iterators/XactsIterator.cs
index 22e3c9fa..c2b3a255 100644
--- a/Source/NLedger/Iterators/XactsIterator.cs
+++ b/Source/NLedger/Iterators/XactsIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Journals;
diff --git a/Source/NLedger/Journals/Journal.cs b/Source/NLedger/Journals/Journal.cs
index 1dc40862..4383e96c 100644
--- a/Source/NLedger/Journals/Journal.cs
+++ b/Source/NLedger/Journals/Journal.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Journals/JournalCheckingStyleEnum.cs b/Source/NLedger/Journals/JournalCheckingStyleEnum.cs
index b3e33614..4c4cbe6c 100644
--- a/Source/NLedger/Journals/JournalCheckingStyleEnum.cs
+++ b/Source/NLedger/Journals/JournalCheckingStyleEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Journals/JournalExtensions.cs b/Source/NLedger/Journals/JournalExtensions.cs
index 1c402966..5abdba4a 100644
--- a/Source/NLedger/Journals/JournalExtensions.cs
+++ b/Source/NLedger/Journals/JournalExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Filters;
diff --git a/Source/NLedger/Journals/JournalFileInfo.cs b/Source/NLedger/Journals/JournalFileInfo.cs
index a7b7e0bb..6f7f355b 100644
--- a/Source/NLedger/Journals/JournalFileInfo.cs
+++ b/Source/NLedger/Journals/JournalFileInfo.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/LogicError.cs b/Source/NLedger/LogicError.cs
index 0f8236cc..e72bbef3 100644
--- a/Source/NLedger/LogicError.cs
+++ b/Source/NLedger/LogicError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Lookup.cs b/Source/NLedger/Lookup.cs
index cf3a4275..3658c4e1 100644
--- a/Source/NLedger/Lookup.cs
+++ b/Source/NLedger/Lookup.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Main.cs b/Source/NLedger/Main.cs
index 221428df..02614250 100644
--- a/Source/NLedger/Main.cs
+++ b/Source/NLedger/Main.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Scopus;
diff --git a/Source/NLedger/MainApplicationContext.cs b/Source/NLedger/MainApplicationContext.cs
index b702ca7d..0e4a951a 100644
--- a/Source/NLedger/MainApplicationContext.cs
+++ b/Source/NLedger/MainApplicationContext.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts;
@@ -162,7 +162,7 @@ public void SetApplicationServiceProvider(IApplicationServiceProvider applicatio
             _ApplicationServiceProvider = applicationServiceProvider;
         }
 
-        // Request an excluse access to the current thread
+        // Request an exclusive access to the current thread
         public ThreadAcquirer AcquireCurrentThread()
         {
             return new ThreadAcquirer(this);
diff --git a/Source/NLedger/Mask.cs b/Source/NLedger/Mask.cs
index c775418b..dab097bb 100644
--- a/Source/NLedger/Mask.cs
+++ b/Source/NLedger/Mask.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utils;
diff --git a/Source/NLedger/NLedger.csproj b/Source/NLedger/NLedger.csproj
index d991c84e..70c3c404 100644
--- a/Source/NLedger/NLedger.csproj
+++ b/Source/NLedger/NLedger.csproj
@@ -1,13 +1,13 @@
 
   
-    net45;netstandard2.0
-    netstandard2.0
+    netstandard2.0;net6.0;net8.0
+    $(LocalLibraryTargetFrameworks)
     NLedger
     Dmitry Merzlyakov
     NLedger, the double-entry accounting tool
     NLedger, a .Net port of Ledger accounting system (www.ledger-cli.org)
-    Copyright © 2015-2021, Dmitry Merzlyakov
-    0.8.4
+    Copyright © 2015-2023, Dmitry Merzlyakov
+    0.8.5
     beta
     dev-environment
     bin\$(Configuration)\
diff --git a/Source/NLedger/Output/FormatAccounts.cs b/Source/NLedger/Output/FormatAccounts.cs
index 13e9c2be..20f89e54 100644
--- a/Source/NLedger/Output/FormatAccounts.cs
+++ b/Source/NLedger/Output/FormatAccounts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Output/FormatPosts.cs b/Source/NLedger/Output/FormatPosts.cs
index 6e54156e..bf691f9e 100644
--- a/Source/NLedger/Output/FormatPosts.cs
+++ b/Source/NLedger/Output/FormatPosts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Output/ReportAccounts.cs b/Source/NLedger/Output/ReportAccounts.cs
index 4ed8fa4c..19329252 100644
--- a/Source/NLedger/Output/ReportAccounts.cs
+++ b/Source/NLedger/Output/ReportAccounts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Output/ReportCommodities.cs b/Source/NLedger/Output/ReportCommodities.cs
index 90083dac..07a5f6ba 100644
--- a/Source/NLedger/Output/ReportCommodities.cs
+++ b/Source/NLedger/Output/ReportCommodities.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Output/ReportPayees.cs b/Source/NLedger/Output/ReportPayees.cs
index 5fefeb03..45773490 100644
--- a/Source/NLedger/Output/ReportPayees.cs
+++ b/Source/NLedger/Output/ReportPayees.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Output/ReportTags.cs b/Source/NLedger/Output/ReportTags.cs
index b0eeaae6..9cf0ae07 100644
--- a/Source/NLedger/Output/ReportTags.cs
+++ b/Source/NLedger/Output/ReportTags.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Post.cs b/Source/NLedger/Post.cs
index 4ff036f5..84114a70 100644
--- a/Source/NLedger/Post.cs
+++ b/Source/NLedger/Post.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/PostXData.cs b/Source/NLedger/PostXData.cs
index 3a3d56b2..4579e070 100644
--- a/Source/NLedger/PostXData.cs
+++ b/Source/NLedger/PostXData.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/PreCmd.cs b/Source/NLedger/PreCmd.cs
index d0e381e7..2284bffa 100644
--- a/Source/NLedger/PreCmd.cs
+++ b/Source/NLedger/PreCmd.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Predicate.cs b/Source/NLedger/Predicate.cs
index 45f66b65..52eb0199 100644
--- a/Source/NLedger/Predicate.cs
+++ b/Source/NLedger/Predicate.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Print/PrintCommon.cs b/Source/NLedger/Print/PrintCommon.cs
index 08afec7c..228f1a27 100644
--- a/Source/NLedger/Print/PrintCommon.cs
+++ b/Source/NLedger/Print/PrintCommon.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
@@ -74,6 +74,9 @@ public static string PrintNote(string note, bool noteOnNextLine, int columns, in
             bool needSeparator = false;
             foreach(char c in note)
             {
+                if (c == '\r')      // [DM] Correction for Windows platform: skip \r char added by AppendNote as part of Environment.NewLine
+                    continue;
+
                 if (c == '\n')
                 {
                     needSeparator = true;
diff --git a/Source/NLedger/Print/PrintXacts.cs b/Source/NLedger/Print/PrintXacts.cs
index a98a345e..46656c92 100644
--- a/Source/NLedger/Print/PrintXacts.cs
+++ b/Source/NLedger/Print/PrintXacts.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Chain;
diff --git a/Source/NLedger/Querying/Query.cs b/Source/NLedger/Querying/Query.cs
index 6bb6e661..71f29ea6 100644
--- a/Source/NLedger/Querying/Query.cs
+++ b/Source/NLedger/Querying/Query.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Annotate;
diff --git a/Source/NLedger/Querying/QueryKindEnum.cs b/Source/NLedger/Querying/QueryKindEnum.cs
index 27763d6f..5f20cc3b 100644
--- a/Source/NLedger/Querying/QueryKindEnum.cs
+++ b/Source/NLedger/Querying/QueryKindEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Querying/QueryLexer.cs b/Source/NLedger/Querying/QueryLexer.cs
index 3b06c70f..cf5d63fc 100644
--- a/Source/NLedger/Querying/QueryLexer.cs
+++ b/Source/NLedger/Querying/QueryLexer.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Textual;
diff --git a/Source/NLedger/Querying/QueryLexerToken.cs b/Source/NLedger/Querying/QueryLexerToken.cs
index 79a42807..06db77b9 100644
--- a/Source/NLedger/Querying/QueryLexerToken.cs
+++ b/Source/NLedger/Querying/QueryLexerToken.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Textual;
diff --git a/Source/NLedger/Querying/QueryLexerTokenKind.cs b/Source/NLedger/Querying/QueryLexerTokenKind.cs
index c510a46e..88131bd6 100644
--- a/Source/NLedger/Querying/QueryLexerTokenKind.cs
+++ b/Source/NLedger/Querying/QueryLexerTokenKind.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Querying/QueryParser.cs b/Source/NLedger/Querying/QueryParser.cs
index 1fbf1971..01b8e17a 100644
--- a/Source/NLedger/Querying/QueryParser.cs
+++ b/Source/NLedger/Querying/QueryParser.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Annotate;
diff --git a/Source/NLedger/RuntimeError.cs b/Source/NLedger/RuntimeError.cs
index 2befa202..2c31d910 100644
--- a/Source/NLedger/RuntimeError.cs
+++ b/Source/NLedger/RuntimeError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Scopus/BindScope.cs b/Source/NLedger/Scopus/BindScope.cs
index 9dc8a6ba..3ccadf8f 100644
--- a/Source/NLedger/Scopus/BindScope.cs
+++ b/Source/NLedger/Scopus/BindScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/CallScope.cs b/Source/NLedger/Scopus/CallScope.cs
index 039c95ac..823c8b15 100644
--- a/Source/NLedger/Scopus/CallScope.cs
+++ b/Source/NLedger/Scopus/CallScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/ChildScope.cs b/Source/NLedger/Scopus/ChildScope.cs
index 9faab28c..5ac7b394 100644
--- a/Source/NLedger/Scopus/ChildScope.cs
+++ b/Source/NLedger/Scopus/ChildScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/ContextScope.cs b/Source/NLedger/Scopus/ContextScope.cs
index b138956d..e0a2b639 100644
--- a/Source/NLedger/Scopus/ContextScope.cs
+++ b/Source/NLedger/Scopus/ContextScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Values;
diff --git a/Source/NLedger/Scopus/EmptyScope.cs b/Source/NLedger/Scopus/EmptyScope.cs
index 3336e3cf..6f09b784 100644
--- a/Source/NLedger/Scopus/EmptyScope.cs
+++ b/Source/NLedger/Scopus/EmptyScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/GlobalScope.cs b/Source/NLedger/Scopus/GlobalScope.cs
index 0c6a5b8c..a8f23e21 100644
--- a/Source/NLedger/Scopus/GlobalScope.cs
+++ b/Source/NLedger/Scopus/GlobalScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/Option.cs b/Source/NLedger/Scopus/Option.cs
index ba9895a4..4ba2679c 100644
--- a/Source/NLedger/Scopus/Option.cs
+++ b/Source/NLedger/Scopus/Option.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/OptionCollection.cs b/Source/NLedger/Scopus/OptionCollection.cs
index ab99d36a..3c584130 100644
--- a/Source/NLedger/Scopus/OptionCollection.cs
+++ b/Source/NLedger/Scopus/OptionCollection.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Scopus/OptionError.cs b/Source/NLedger/Scopus/OptionError.cs
index 8e679796..74be76aa 100644
--- a/Source/NLedger/Scopus/OptionError.cs
+++ b/Source/NLedger/Scopus/OptionError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Scopus/Report.cs b/Source/NLedger/Scopus/Report.cs
index 1eabef67..0625b45e 100644
--- a/Source/NLedger/Scopus/Report.cs
+++ b/Source/NLedger/Scopus/Report.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
@@ -686,7 +686,7 @@ public void AccountsReport(AccountHandler handler)
             if (!GroupByHandler.Handled)
                 new AccountsFlusher(handler, this).Handle(Value.Empty);
 
-            // [DM] Disposing handlers at the moment when they go out of scope (like invoking a descructor in c++ code)
+            // [DM] Disposing handlers at the moment when they go out of scope (like invoking a destructor in c++ code)
             chain?.Dispose();
         }
 
@@ -1349,7 +1349,7 @@ public static Value ReportStatistics(CallScope args)
 
             AccountXDataDetails statistics = report.Session.Journal.Master.FamilyDetails(true);
 
-            if (statistics.EarliestPost == null || statistics.LatestPost == null)
+            if (!statistics.EarliestPost.IsValid() && !statistics.LatestPost.IsValid())
                 return Value.Empty;
 
             sb.AppendFormat("Time period: {0} to {1} ({2} days)",
diff --git a/Source/NLedger/Scopus/ReportBudgetFlags.cs b/Source/NLedger/Scopus/ReportBudgetFlags.cs
index df36ca7f..d81f5774 100644
--- a/Source/NLedger/Scopus/ReportBudgetFlags.cs
+++ b/Source/NLedger/Scopus/ReportBudgetFlags.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Scopus/Scope.cs b/Source/NLedger/Scopus/Scope.cs
index 1c91c9d1..702dd0fa 100644
--- a/Source/NLedger/Scopus/Scope.cs
+++ b/Source/NLedger/Scopus/Scope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/ScopeExtensions.cs b/Source/NLedger/Scopus/ScopeExtensions.cs
index 8d59574e..eae305d8 100644
--- a/Source/NLedger/Scopus/ScopeExtensions.cs
+++ b/Source/NLedger/Scopus/ScopeExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utils;
diff --git a/Source/NLedger/Scopus/Session.cs b/Source/NLedger/Scopus/Session.cs
index f294f244..d8920def 100644
--- a/Source/NLedger/Scopus/Session.cs
+++ b/Source/NLedger/Scopus/Session.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Scopus/Symbol.cs b/Source/NLedger/Scopus/Symbol.cs
index 6dcf1707..bf0d84a3 100644
--- a/Source/NLedger/Scopus/Symbol.cs
+++ b/Source/NLedger/Scopus/Symbol.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/SymbolKindEnum.cs b/Source/NLedger/Scopus/SymbolKindEnum.cs
index 0ebcc9d4..203f88c8 100644
--- a/Source/NLedger/Scopus/SymbolKindEnum.cs
+++ b/Source/NLedger/Scopus/SymbolKindEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Scopus/SymbolScope.cs b/Source/NLedger/Scopus/SymbolScope.cs
index 19b82a68..1fa230f8 100644
--- a/Source/NLedger/Scopus/SymbolScope.cs
+++ b/Source/NLedger/Scopus/SymbolScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Scopus/ValueScope.cs b/Source/NLedger/Scopus/ValueScope.cs
index 03c9bba5..446d7c20 100644
--- a/Source/NLedger/Scopus/ValueScope.cs
+++ b/Source/NLedger/Scopus/ValueScope.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Select.cs b/Source/NLedger/Select.cs
index 89313871..46b45d7f 100644
--- a/Source/NLedger/Select.cs
+++ b/Source/NLedger/Select.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
@@ -440,6 +440,6 @@ private static void PrintColumn(Value column, StringBuilder formatter)
 
         private const string SelectRe =
             @"(select|from|where|display|collect|group\s+by|style)\s+(.+?)(?=(\s+(from|where|display|collect|group\s+by|style)\s+|$))";
-        private const string FromAccountsRe = @"from\s+accounts\b"; 
+        private const string FromAccountsRe = @"from\s+accounts\b";
     }
 }
diff --git a/Source/NLedger/SupportsFlagsEnum.cs b/Source/NLedger/SupportsFlagsEnum.cs
index 8a4caf81..2c49e984 100644
--- a/Source/NLedger/SupportsFlagsEnum.cs
+++ b/Source/NLedger/SupportsFlagsEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Temporaries.cs b/Source/NLedger/Temporaries.cs
index 679d6abd..718063fd 100644
--- a/Source/NLedger/Temporaries.cs
+++ b/Source/NLedger/Temporaries.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Textual/ApplyStack.cs b/Source/NLedger/Textual/ApplyStack.cs
index 1111a480..d4e72934 100644
--- a/Source/NLedger/Textual/ApplyStack.cs
+++ b/Source/NLedger/Textual/ApplyStack.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Textual/ParseContext.cs b/Source/NLedger/Textual/ParseContext.cs
index 486a4d41..060b2ada 100644
--- a/Source/NLedger/Textual/ParseContext.cs
+++ b/Source/NLedger/Textual/ParseContext.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Textual/ParseContextStack.cs b/Source/NLedger/Textual/ParseContextStack.cs
index bfd3a563..79c0d84d 100644
--- a/Source/NLedger/Textual/ParseContextStack.cs
+++ b/Source/NLedger/Textual/ParseContextStack.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Textual/ParseError.cs b/Source/NLedger/Textual/ParseError.cs
index 519fa135..f53c541d 100644
--- a/Source/NLedger/Textual/ParseError.cs
+++ b/Source/NLedger/Textual/ParseError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Textual/TextualParser.cs b/Source/NLedger/Textual/TextualParser.cs
index 134443c5..220e1489 100644
--- a/Source/NLedger/Textual/TextualParser.cs
+++ b/Source/NLedger/Textual/TextualParser.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -1279,7 +1279,7 @@ private void ReadApplyYearDirective(string line)
                 ApplyStack.PushFront("year", TimesCommon.Current.Epoch);
                 Logger.Current.Debug(DebugTimesEpoch, () => String.Format("Setting current year to {0}", year));
                 // This must be set to the last day of the year, otherwise partial
-                // dates like "11/01" will refer to last year's november, not the
+                // dates like "11/01" will refer to last year's November, not the
                 // current year.
                 TimesCommon.Current.Epoch = new DateTime(year, 12, 31);
             }
diff --git a/Source/NLedger/TextualReader.cs b/Source/NLedger/TextualReader.cs
index 248353f1..dc399526 100644
--- a/Source/NLedger/TextualReader.cs
+++ b/Source/NLedger/TextualReader.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/TimeLogging/TimeLog.cs b/Source/NLedger/TimeLogging/TimeLog.cs
index f6a1f074..80282a92 100644
--- a/Source/NLedger/TimeLogging/TimeLog.cs
+++ b/Source/NLedger/TimeLogging/TimeLog.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/TimeLogging/TimeXact.cs b/Source/NLedger/TimeLogging/TimeXact.cs
index a9f3249e..6aa65e6d 100644
--- a/Source/NLedger/TimeLogging/TimeXact.cs
+++ b/Source/NLedger/TimeLogging/TimeXact.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Times/CTimeToNetFormatConverter.cs b/Source/NLedger/Times/CTimeToNetFormatConverter.cs
index 81c31810..d15a3c2e 100644
--- a/Source/NLedger/Times/CTimeToNetFormatConverter.cs
+++ b/Source/NLedger/Times/CTimeToNetFormatConverter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/DateDuration.cs b/Source/NLedger/Times/DateDuration.cs
index a4b776f2..1ae429d3 100644
--- a/Source/NLedger/Times/DateDuration.cs
+++ b/Source/NLedger/Times/DateDuration.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Times/DateError.cs b/Source/NLedger/Times/DateError.cs
index 285b175b..806504cd 100644
--- a/Source/NLedger/Times/DateError.cs
+++ b/Source/NLedger/Times/DateError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/DateIO.cs b/Source/NLedger/Times/DateIO.cs
index 07de4a1f..00edf149 100644
--- a/Source/NLedger/Times/DateIO.cs
+++ b/Source/NLedger/Times/DateIO.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/DateInterval.cs b/Source/NLedger/Times/DateInterval.cs
index e7be73fc..654119d1 100644
--- a/Source/NLedger/Times/DateInterval.cs
+++ b/Source/NLedger/Times/DateInterval.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Times/DateParser.cs b/Source/NLedger/Times/DateParser.cs
index 571cff84..0b4a80fd 100644
--- a/Source/NLedger/Times/DateParser.cs
+++ b/Source/NLedger/Times/DateParser.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Times/DateParserLexer.cs b/Source/NLedger/Times/DateParserLexer.cs
index f0a7ec5b..fab31872 100644
--- a/Source/NLedger/Times/DateParserLexer.cs
+++ b/Source/NLedger/Times/DateParserLexer.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Times/DateRange.cs b/Source/NLedger/Times/DateRange.cs
index d89133fd..0135c16f 100644
--- a/Source/NLedger/Times/DateRange.cs
+++ b/Source/NLedger/Times/DateRange.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/DateSpecifier.cs b/Source/NLedger/Times/DateSpecifier.cs
index 3da559fd..74ea2370 100644
--- a/Source/NLedger/Times/DateSpecifier.cs
+++ b/Source/NLedger/Times/DateSpecifier.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Times/DateSpecifierOrRange.cs b/Source/NLedger/Times/DateSpecifierOrRange.cs
index 7af6f335..64a42b09 100644
--- a/Source/NLedger/Times/DateSpecifierOrRange.cs
+++ b/Source/NLedger/Times/DateSpecifierOrRange.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Times/DateTimeIO.cs b/Source/NLedger/Times/DateTimeIO.cs
index cff55164..977612cb 100644
--- a/Source/NLedger/Times/DateTimeIO.cs
+++ b/Source/NLedger/Times/DateTimeIO.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utils;
diff --git a/Source/NLedger/Times/DateTraits.cs b/Source/NLedger/Times/DateTraits.cs
index d0f8d157..eea57d46 100644
--- a/Source/NLedger/Times/DateTraits.cs
+++ b/Source/NLedger/Times/DateTraits.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/FormatTypeEnum.cs b/Source/NLedger/Times/FormatTypeEnum.cs
index 49084b62..b552d790 100644
--- a/Source/NLedger/Times/FormatTypeEnum.cs
+++ b/Source/NLedger/Times/FormatTypeEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/LexerToken.cs b/Source/NLedger/Times/LexerToken.cs
index c0058056..67383f56 100644
--- a/Source/NLedger/Times/LexerToken.cs
+++ b/Source/NLedger/Times/LexerToken.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Times/LexerTokenKindEnum.cs b/Source/NLedger/Times/LexerTokenKindEnum.cs
index 1576f039..dd9f9e11 100644
--- a/Source/NLedger/Times/LexerTokenKindEnum.cs
+++ b/Source/NLedger/Times/LexerTokenKindEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/MonthEnum.cs b/Source/NLedger/Times/MonthEnum.cs
index 629f3e66..6e6e1d57 100644
--- a/Source/NLedger/Times/MonthEnum.cs
+++ b/Source/NLedger/Times/MonthEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/SkipQuantumEnum.cs b/Source/NLedger/Times/SkipQuantumEnum.cs
index 83cf72f5..4f1d2f2d 100644
--- a/Source/NLedger/Times/SkipQuantumEnum.cs
+++ b/Source/NLedger/Times/SkipQuantumEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/TemporalIO.cs b/Source/NLedger/Times/TemporalIO.cs
index 88bbc21a..e79c7e72 100644
--- a/Source/NLedger/Times/TemporalIO.cs
+++ b/Source/NLedger/Times/TemporalIO.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Times/TimesCommon.cs b/Source/NLedger/Times/TimesCommon.cs
index 333bcd4e..332eb1f8 100644
--- a/Source/NLedger/Times/TimesCommon.cs
+++ b/Source/NLedger/Times/TimesCommon.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/AnsiTextWriter.cs b/Source/NLedger/Utility/AnsiTextWriter.cs
index 07ebcee7..289e49d5 100644
--- a/Source/NLedger/Utility/AnsiTextWriter.cs
+++ b/Source/NLedger/Utility/AnsiTextWriter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -261,7 +261,7 @@ public void AddAction(AnsiCsiAction ansiCsiAction)
                     node = childNode;
 
                     if (node.IsLeaf)
-                        throw new InvalidOperationException("Unbalanced sequence lengthes");
+                        throw new InvalidOperationException("Unbalanced sequence lengths");
                 }
                 node.Action = ansiCsiAction;
             }
diff --git a/Source/NLedger/Utility/BigValues/BigDecimal.cs b/Source/NLedger/Utility/BigValues/BigDecimal.cs
index cf2bd3d4..3ddc64da 100644
--- a/Source/NLedger/Utility/BigValues/BigDecimal.cs
+++ b/Source/NLedger/Utility/BigValues/BigDecimal.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/BigValues/BigRational.cs b/Source/NLedger/Utility/BigValues/BigRational.cs
index eb4c28a5..96e2736d 100644
--- a/Source/NLedger/Utility/BigValues/BigRational.cs
+++ b/Source/NLedger/Utility/BigValues/BigRational.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -367,7 +367,7 @@ public string ToString(string format, IFormatProvider formatProvider)
             string fractionalFormat = pos >= 0 && format.Length > pos + 1 ? format.Substring(pos + 1) : String.Empty;
             int prec = pos >= 0 ? format.Length - pos - 1 : 0;
 
-            // Round value and get integral and fractional parts of this valud
+            // Round value and get integral and fractional parts of this value
             BigRational value;
             Round(out value, prec);
             var integral = value.GetWholePart();
diff --git a/Source/NLedger/Utility/BigValues/BigValueExtensions.cs b/Source/NLedger/Utility/BigValues/BigValueExtensions.cs
index 4905803f..e0420d7e 100644
--- a/Source/NLedger/Utility/BigValues/BigValueExtensions.cs
+++ b/Source/NLedger/Utility/BigValues/BigValueExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/BigValues/IBigValue.cs b/Source/NLedger/Utility/BigValues/IBigValue.cs
index 6be453ee..6b79020b 100644
--- a/Source/NLedger/Utility/BigValues/IBigValue.cs
+++ b/Source/NLedger/Utility/BigValues/IBigValue.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/BoostIterator.cs b/Source/NLedger/Utility/BoostIterator.cs
index b0e35236..9f8186ed 100644
--- a/Source/NLedger/Utility/BoostIterator.cs
+++ b/Source/NLedger/Utility/BoostIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/BoostVariant.cs b/Source/NLedger/Utility/BoostVariant.cs
index 3e14920d..7c442b81 100644
--- a/Source/NLedger/Utility/BoostVariant.cs
+++ b/Source/NLedger/Utility/BoostVariant.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/CharExtensions.cs b/Source/NLedger/Utility/CharExtensions.cs
index dfc5608b..dfdaa1b6 100644
--- a/Source/NLedger/Utility/CharExtensions.cs
+++ b/Source/NLedger/Utility/CharExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/CollectionIterator.cs b/Source/NLedger/Utility/CollectionIterator.cs
index 09b30ee0..6cad7fb8 100644
--- a/Source/NLedger/Utility/CollectionIterator.cs
+++ b/Source/NLedger/Utility/CollectionIterator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/CommandLine.cs b/Source/NLedger/Utility/CommandLine.cs
index 07dffac6..ad3889a1 100644
--- a/Source/NLedger/Utility/CommandLine.cs
+++ b/Source/NLedger/Utility/CommandLine.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Date.cs b/Source/NLedger/Utility/Date.cs
index 32d1d79e..436ad724 100644
--- a/Source/NLedger/Utility/Date.cs
+++ b/Source/NLedger/Utility/Date.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/DateExtension.cs b/Source/NLedger/Utility/DateExtension.cs
index 9b7c2493..24bda2cc 100644
--- a/Source/NLedger/Utility/DateExtension.cs
+++ b/Source/NLedger/Utility/DateExtension.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/EncodingStringWriter.cs b/Source/NLedger/Utility/EncodingStringWriter.cs
index 47b1969f..372d7fda 100644
--- a/Source/NLedger/Utility/EncodingStringWriter.cs
+++ b/Source/NLedger/Utility/EncodingStringWriter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/ErrorContext.cs b/Source/NLedger/Utility/ErrorContext.cs
index 8edf54a7..28ebb2a7 100644
--- a/Source/NLedger/Utility/ErrorContext.cs
+++ b/Source/NLedger/Utility/ErrorContext.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Utility/FileNameComparer.cs b/Source/NLedger/Utility/FileNameComparer.cs
index eb52e924..0f8807cb 100644
--- a/Source/NLedger/Utility/FileNameComparer.cs
+++ b/Source/NLedger/Utility/FileNameComparer.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/FileSystem.cs b/Source/NLedger/Utility/FileSystem.cs
index 2d3350e1..951a2b7e 100644
--- a/Source/NLedger/Utility/FileSystem.cs
+++ b/Source/NLedger/Utility/FileSystem.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts;
diff --git a/Source/NLedger/Utility/Graph/AdjacencyList.cs b/Source/NLedger/Utility/Graph/AdjacencyList.cs
index b7f192ce..077d975f 100644
--- a/Source/NLedger/Utility/Graph/AdjacencyList.cs
+++ b/Source/NLedger/Utility/Graph/AdjacencyList.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Graph/EdgeDescriptor.cs b/Source/NLedger/Utility/Graph/EdgeDescriptor.cs
index 74f9f74c..e00cc340 100644
--- a/Source/NLedger/Utility/Graph/EdgeDescriptor.cs
+++ b/Source/NLedger/Utility/Graph/EdgeDescriptor.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Graph/Extensions.cs b/Source/NLedger/Utility/Graph/Extensions.cs
index 19e7995b..3feb15ba 100644
--- a/Source/NLedger/Utility/Graph/Extensions.cs
+++ b/Source/NLedger/Utility/Graph/Extensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Graph/IGraph.cs b/Source/NLedger/Utility/Graph/IGraph.cs
index 954e9287..28af599c 100644
--- a/Source/NLedger/Utility/Graph/IGraph.cs
+++ b/Source/NLedger/Utility/Graph/IGraph.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Graph/ReadOnlyGraph.cs b/Source/NLedger/Utility/Graph/ReadOnlyGraph.cs
index 8497ebf6..7e651a99 100644
--- a/Source/NLedger/Utility/Graph/ReadOnlyGraph.cs
+++ b/Source/NLedger/Utility/Graph/ReadOnlyGraph.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Graph/ShortestPathSearcher.cs b/Source/NLedger/Utility/Graph/ShortestPathSearcher.cs
index 5300e8d2..57ce56aa 100644
--- a/Source/NLedger/Utility/Graph/ShortestPathSearcher.cs
+++ b/Source/NLedger/Utility/Graph/ShortestPathSearcher.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Graph/VertexDescriptor.cs b/Source/NLedger/Utility/Graph/VertexDescriptor.cs
index 0dddb812..43b34b58 100644
--- a/Source/NLedger/Utility/Graph/VertexDescriptor.cs
+++ b/Source/NLedger/Utility/Graph/VertexDescriptor.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/IMultiMap.cs b/Source/NLedger/Utility/IMultiMap.cs
index 9e67643d..bff393ce 100644
--- a/Source/NLedger/Utility/IMultiMap.cs
+++ b/Source/NLedger/Utility/IMultiMap.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/InputTextStream.cs b/Source/NLedger/Utility/InputTextStream.cs
index e11dc6b9..5dfeae46 100644
--- a/Source/NLedger/Utility/InputTextStream.cs
+++ b/Source/NLedger/Utility/InputTextStream.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/InputTextStreamWrapper.cs b/Source/NLedger/Utility/InputTextStreamWrapper.cs
index be64eb5c..40210724 100644
--- a/Source/NLedger/Utility/InputTextStreamWrapper.cs
+++ b/Source/NLedger/Utility/InputTextStreamWrapper.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/MultiMap.cs b/Source/NLedger/Utility/MultiMap.cs
index 1573dd3f..cb83d6a6 100644
--- a/Source/NLedger/Utility/MultiMap.cs
+++ b/Source/NLedger/Utility/MultiMap.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/ObjectExtensions.cs b/Source/NLedger/Utility/ObjectExtensions.cs
index 1e6f9391..a96569f8 100644
--- a/Source/NLedger/Utility/ObjectExtensions.cs
+++ b/Source/NLedger/Utility/ObjectExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/PlatformHelper.cs b/Source/NLedger/Utility/PlatformHelper.cs
index 5ab41000..50e2de3d 100644
--- a/Source/NLedger/Utility/PlatformHelper.cs
+++ b/Source/NLedger/Utility/PlatformHelper.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/PrintHelper.cs b/Source/NLedger/Utility/PrintHelper.cs
index 42bf80a3..6c8c1b46 100644
--- a/Source/NLedger/Utility/PrintHelper.cs
+++ b/Source/NLedger/Utility/PrintHelper.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Rnd/BoolGenerator.cs b/Source/NLedger/Utility/Rnd/BoolGenerator.cs
index 49342259..8547ff63 100644
--- a/Source/NLedger/Utility/Rnd/BoolGenerator.cs
+++ b/Source/NLedger/Utility/Rnd/BoolGenerator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Rnd/CharGenerator.cs b/Source/NLedger/Utility/Rnd/CharGenerator.cs
index 07aef7f2..5b38891d 100644
--- a/Source/NLedger/Utility/Rnd/CharGenerator.cs
+++ b/Source/NLedger/Utility/Rnd/CharGenerator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Rnd/DoubleGenerator.cs b/Source/NLedger/Utility/Rnd/DoubleGenerator.cs
index 2bbd76bd..1e0fe351 100644
--- a/Source/NLedger/Utility/Rnd/DoubleGenerator.cs
+++ b/Source/NLedger/Utility/Rnd/DoubleGenerator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Rnd/IntegerGenerator.cs b/Source/NLedger/Utility/Rnd/IntegerGenerator.cs
index 0687ad58..2002fc47 100644
--- a/Source/NLedger/Utility/Rnd/IntegerGenerator.cs
+++ b/Source/NLedger/Utility/Rnd/IntegerGenerator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/SHA1.cs b/Source/NLedger/Utility/SHA1.cs
index 3752c905..d81371a7 100644
--- a/Source/NLedger/Utility/SHA1.cs
+++ b/Source/NLedger/Utility/SHA1.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -20,7 +20,7 @@ public static class SHA1
         public static string GetHash(string input)
         {
             // see here - http://stackoverflow.com/questions/17292366/hashing-with-sha1-algorithm-in-c-sharp
-            using (SHA1Managed sha1 = new SHA1Managed())
+            using (var sha1 = System.Security.Cryptography.SHA1.Create())
             {
                 var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(input));
                 return BitConverter.ToString(hash).Replace("-", "").ToLower();
diff --git a/Source/NLedger/Utility/ScopeTimeTracker.cs b/Source/NLedger/Utility/ScopeTimeTracker.cs
index 16a34d82..4943cce2 100644
--- a/Source/NLedger/Utility/ScopeTimeTracker.cs
+++ b/Source/NLedger/Utility/ScopeTimeTracker.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/ServiceAPI/BaseServiceResponse.cs b/Source/NLedger/Utility/ServiceAPI/BaseServiceResponse.cs
index 52aba8c0..fc56d1d3 100644
--- a/Source/NLedger/Utility/ServiceAPI/BaseServiceResponse.cs
+++ b/Source/NLedger/Utility/ServiceAPI/BaseServiceResponse.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utils;
diff --git a/Source/NLedger/Utility/ServiceAPI/MemoryAnsiTextWriter.cs b/Source/NLedger/Utility/ServiceAPI/MemoryAnsiTextWriter.cs
index 3f81705e..856118d2 100644
--- a/Source/NLedger/Utility/ServiceAPI/MemoryAnsiTextWriter.cs
+++ b/Source/NLedger/Utility/ServiceAPI/MemoryAnsiTextWriter.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/ServiceAPI/MemoryFileSystemProvider.cs b/Source/NLedger/Utility/ServiceAPI/MemoryFileSystemProvider.cs
index 1f73bbc8..9f725ca8 100644
--- a/Source/NLedger/Utility/ServiceAPI/MemoryFileSystemProvider.cs
+++ b/Source/NLedger/Utility/ServiceAPI/MemoryFileSystemProvider.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts;
diff --git a/Source/NLedger/Utility/ServiceAPI/MemoryStreamManager.cs b/Source/NLedger/Utility/ServiceAPI/MemoryStreamManager.cs
index 12268848..cd0d9d3d 100644
--- a/Source/NLedger/Utility/ServiceAPI/MemoryStreamManager.cs
+++ b/Source/NLedger/Utility/ServiceAPI/MemoryStreamManager.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/ServiceAPI/ServiceEngine.cs b/Source/NLedger/Utility/ServiceAPI/ServiceEngine.cs
index c59b02a2..a8de6f19 100644
--- a/Source/NLedger/Utility/ServiceAPI/ServiceEngine.cs
+++ b/Source/NLedger/Utility/ServiceAPI/ServiceEngine.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
diff --git a/Source/NLedger/Utility/ServiceAPI/ServiceQueryResult.cs b/Source/NLedger/Utility/ServiceAPI/ServiceQueryResult.cs
index a874f1d7..74d266fb 100644
--- a/Source/NLedger/Utility/ServiceAPI/ServiceQueryResult.cs
+++ b/Source/NLedger/Utility/ServiceAPI/ServiceQueryResult.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/ServiceAPI/ServiceResponse.cs b/Source/NLedger/Utility/ServiceAPI/ServiceResponse.cs
index 030c942d..71ec8394 100644
--- a/Source/NLedger/Utility/ServiceAPI/ServiceResponse.cs
+++ b/Source/NLedger/Utility/ServiceAPI/ServiceResponse.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
diff --git a/Source/NLedger/Utility/ServiceAPI/ServiceSession.cs b/Source/NLedger/Utility/ServiceAPI/ServiceSession.cs
index f88e101c..8f0c398c 100644
--- a/Source/NLedger/Utility/ServiceAPI/ServiceSession.cs
+++ b/Source/NLedger/Utility/ServiceAPI/ServiceSession.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/CascadeSettingsContainer.cs b/Source/NLedger/Utility/Settings/CascadeSettings/CascadeSettingsContainer.cs
index b8dadc49..69504465 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/CascadeSettingsContainer.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/CascadeSettingsContainer.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/BaseSettingDefinition.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/BaseSettingDefinition.cs
index 0552118e..07a3cf4d 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/BaseSettingDefinition.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/BaseSettingDefinition.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/BoolSettingDefinition.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/BoolSettingDefinition.cs
index a9dd0af8..a4bf1ad1 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/BoolSettingDefinition.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/BoolSettingDefinition.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/EncodingSettingDefinition.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/EncodingSettingDefinition.cs
index 7fc4d746..3130408d 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/EncodingSettingDefinition.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/EncodingSettingDefinition.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/IntegerSettingDefinition.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/IntegerSettingDefinition.cs
index 224c2118..929915d7 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/IntegerSettingDefinition.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/IntegerSettingDefinition.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/StringSettingDefinition.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/StringSettingDefinition.cs
index 473e103d..332a1fdd 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/StringSettingDefinition.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/StringSettingDefinition.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/TimeZoneSettingDefinition.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/TimeZoneSettingDefinition.cs
index 3bed752c..63f3806c 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/TimeZoneSettingDefinition.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Definitions/TimeZoneSettingDefinition.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/ISettingDefinition.cs b/Source/NLedger/Utility/Settings/CascadeSettings/ISettingDefinition.cs
index f0dd3a1f..f54bd473 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/ISettingDefinition.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/ISettingDefinition.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/ISettingsSource.cs b/Source/NLedger/Utility/Settings/CascadeSettings/ISettingsSource.cs
index 673732be..b2f76456 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/ISettingsSource.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/ISettingsSource.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/SettingScopeEnum.cs b/Source/NLedger/Utility/Settings/CascadeSettings/SettingScopeEnum.cs
index 36a9e5ed..af14c1af 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/SettingScopeEnum.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/SettingScopeEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/SettingValue.cs b/Source/NLedger/Utility/Settings/CascadeSettings/SettingValue.cs
index 2cd5a738..9acc071b 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/SettingValue.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/SettingValue.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings.Definitions;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/ConfigurationFileSettingsSource.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/ConfigurationFileSettingsSource.cs
index af2d1143..b725d475 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/ConfigurationFileSettingsSource.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/ConfigurationFileSettingsSource.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/CustomDataSource.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/CustomDataSource.cs
index 4e9eb1b8..36aa4bd4 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/CustomDataSource.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/CustomDataSource.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/DefaultSettingsSource.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/DefaultSettingsSource.cs
index 7cfe70b6..883c2c9a 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/DefaultSettingsSource.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/DefaultSettingsSource.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/EnvironmentVariablesSettingsSource.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/EnvironmentVariablesSettingsSource.cs
index 5a7c8f39..d7f6cb33 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/EnvironmentVariablesSettingsSource.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/EnvironmentVariablesSettingsSource.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
@@ -23,7 +23,7 @@ public sealed class EnvironmentVariablesSettingsSource : ISettingsSource
         /// 
         /// Creates an instance of the source.
         /// 
-        /// Optinal filtering prefix for setting names
+        /// Optimal filtering prefix for setting names
         public EnvironmentVariablesSettingsSource(string namePrefix = null)
         {
             NamePrefix = namePrefix;
diff --git a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/SystemConfigurationSettingsSource.cs b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/SystemConfigurationSettingsSource.cs
index a4384c59..6dd3f65f 100644
--- a/Source/NLedger/Utility/Settings/CascadeSettings/Sources/SystemConfigurationSettingsSource.cs
+++ b/Source/NLedger/Utility/Settings/CascadeSettings/Sources/SystemConfigurationSettingsSource.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/Settings/NLedgerConfiguration.cs b/Source/NLedger/Utility/Settings/NLedgerConfiguration.cs
index cf18eaf1..34b4e118 100644
--- a/Source/NLedger/Utility/Settings/NLedgerConfiguration.cs
+++ b/Source/NLedger/Utility/Settings/NLedgerConfiguration.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts.Impl;
diff --git a/Source/NLedger/Utility/Settings/NLedgerSettingsContainer.cs b/Source/NLedger/Utility/Settings/NLedgerSettingsContainer.cs
index c685c0e5..18c0d4dc 100644
--- a/Source/NLedger/Utility/Settings/NLedgerSettingsContainer.cs
+++ b/Source/NLedger/Utility/Settings/NLedgerSettingsContainer.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility.Settings.CascadeSettings;
diff --git a/Source/NLedger/Utility/StreamReaderExtensions.cs b/Source/NLedger/Utility/StreamReaderExtensions.cs
index 067bbaca..5e192b3b 100644
--- a/Source/NLedger/Utility/StreamReaderExtensions.cs
+++ b/Source/NLedger/Utility/StreamReaderExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/StringExtensions.cs b/Source/NLedger/Utility/StringExtensions.cs
index d1cd2790..be6d80d9 100644
--- a/Source/NLedger/Utility/StringExtensions.cs
+++ b/Source/NLedger/Utility/StringExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/UniString.cs b/Source/NLedger/Utility/UniString.cs
index 4472156a..bd850c03 100644
--- a/Source/NLedger/Utility/UniString.cs
+++ b/Source/NLedger/Utility/UniString.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/VersionInfo.cs b/Source/NLedger/Utility/VersionInfo.cs
index ebcdeacc..b2475fd2 100644
--- a/Source/NLedger/Utility/VersionInfo.cs
+++ b/Source/NLedger/Utility/VersionInfo.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/VirtualConsole.cs b/Source/NLedger/Utility/VirtualConsole.cs
index f81e867d..c19f05f0 100644
--- a/Source/NLedger/Utility/VirtualConsole.cs
+++ b/Source/NLedger/Utility/VirtualConsole.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/VirtualEnvironment.cs b/Source/NLedger/Utility/VirtualEnvironment.cs
index a956fe4e..de63b935 100644
--- a/Source/NLedger/Utility/VirtualEnvironment.cs
+++ b/Source/NLedger/Utility/VirtualEnvironment.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utility/VirtualPager.cs b/Source/NLedger/Utility/VirtualPager.cs
index 28737a97..f0ee719c 100644
--- a/Source/NLedger/Utility/VirtualPager.cs
+++ b/Source/NLedger/Utility/VirtualPager.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Abstracts;
diff --git a/Source/NLedger/Utility/Xml/XmlExtensions.cs b/Source/NLedger/Utility/Xml/XmlExtensions.cs
index 530d24a8..8e05915d 100644
--- a/Source/NLedger/Utility/Xml/XmlExtensions.cs
+++ b/Source/NLedger/Utility/Xml/XmlExtensions.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utils/CancellationManager.cs b/Source/NLedger/Utils/CancellationManager.cs
index 090d7558..4e370a2f 100644
--- a/Source/NLedger/Utils/CancellationManager.cs
+++ b/Source/NLedger/Utils/CancellationManager.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utils/ILogger.cs b/Source/NLedger/Utils/ILogger.cs
index 7eda9bff..e73dbc2f 100644
--- a/Source/NLedger/Utils/ILogger.cs
+++ b/Source/NLedger/Utils/ILogger.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utils/ITimerContext.cs b/Source/NLedger/Utils/ITimerContext.cs
index faac559d..485f7ab9 100644
--- a/Source/NLedger/Utils/ITimerContext.cs
+++ b/Source/NLedger/Utils/ITimerContext.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utils/LogLevelEnum.cs b/Source/NLedger/Utils/LogLevelEnum.cs
index d3744e6c..4fca3d6b 100644
--- a/Source/NLedger/Utils/LogLevelEnum.cs
+++ b/Source/NLedger/Utils/LogLevelEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utils/Logger.cs b/Source/NLedger/Utils/Logger.cs
index a411ac05..0ba278cc 100644
--- a/Source/NLedger/Utils/Logger.cs
+++ b/Source/NLedger/Utils/Logger.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger/Utils/TimerContext.cs b/Source/NLedger/Utils/TimerContext.cs
index 7df32b7d..bb2fa6d7 100644
--- a/Source/NLedger/Utils/TimerContext.cs
+++ b/Source/NLedger/Utils/TimerContext.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utils/TimerName.cs b/Source/NLedger/Utils/TimerName.cs
index 3adc0fe4..610b2b1f 100644
--- a/Source/NLedger/Utils/TimerName.cs
+++ b/Source/NLedger/Utils/TimerName.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Utils/Validator.cs b/Source/NLedger/Utils/Validator.cs
index 04bbf359..e415f92b 100644
--- a/Source/NLedger/Utils/Validator.cs
+++ b/Source/NLedger/Utils/Validator.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Utility;
diff --git a/Source/NLedger/Values/DefaultValueComparer.cs b/Source/NLedger/Values/DefaultValueComparer.cs
index 9e65ec1f..2d185785 100644
--- a/Source/NLedger/Values/DefaultValueComparer.cs
+++ b/Source/NLedger/Values/DefaultValueComparer.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Values/Value.cs b/Source/NLedger/Values/Value.cs
index b62947d5..f803828f 100644
--- a/Source/NLedger/Values/Value.cs
+++ b/Source/NLedger/Values/Value.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Values/ValueError.cs b/Source/NLedger/Values/ValueError.cs
index 3322382c..2b22f567 100644
--- a/Source/NLedger/Values/ValueError.cs
+++ b/Source/NLedger/Values/ValueError.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Values/ValueStorage.cs b/Source/NLedger/Values/ValueStorage.cs
index c20b0b23..9e58fc8a 100644
--- a/Source/NLedger/Values/ValueStorage.cs
+++ b/Source/NLedger/Values/ValueStorage.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Values/ValueTypeEnum.cs b/Source/NLedger/Values/ValueTypeEnum.cs
index cbff62ea..b5c24f0a 100644
--- a/Source/NLedger/Values/ValueTypeEnum.cs
+++ b/Source/NLedger/Values/ValueTypeEnum.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using System;
diff --git a/Source/NLedger/Xacts/AddBalancingPost.cs b/Source/NLedger/Xacts/AddBalancingPost.cs
index 7efe9458..78102e34 100644
--- a/Source/NLedger/Xacts/AddBalancingPost.cs
+++ b/Source/NLedger/Xacts/AddBalancingPost.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/NLedger/Xacts/AutoXact.cs b/Source/NLedger/Xacts/AutoXact.cs
index 1e4321c1..473b1819 100644
--- a/Source/NLedger/Xacts/AutoXact.cs
+++ b/Source/NLedger/Xacts/AutoXact.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Accounts;
diff --git a/Source/NLedger/Xacts/PeriodXact.cs b/Source/NLedger/Xacts/PeriodXact.cs
index b22bc78d..730e8e4b 100644
--- a/Source/NLedger/Xacts/PeriodXact.cs
+++ b/Source/NLedger/Xacts/PeriodXact.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Times;
diff --git a/Source/NLedger/Xacts/Xact.cs b/Source/NLedger/Xacts/Xact.cs
index 11d9afd3..a7e0d31c 100644
--- a/Source/NLedger/Xacts/Xact.cs
+++ b/Source/NLedger/Xacts/Xact.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Expressions;
diff --git a/Source/NLedger/Xacts/XactBase.cs b/Source/NLedger/Xacts/XactBase.cs
index 0f656ec7..f79883a6 100644
--- a/Source/NLedger/Xacts/XactBase.cs
+++ b/Source/NLedger/Xacts/XactBase.cs
@@ -1,9 +1,9 @@
 // **********************************************************************************
-// Copyright (c) 2015-2021, Dmitry Merzlyakov.  All rights reserved.
+// Copyright (c) 2015-2023, Dmitry Merzlyakov.  All rights reserved.
 // Licensed under the FreeBSD Public License. See LICENSE file included with the distribution for details and disclaimer.
 // 
 // This file is part of NLedger that is a .Net port of C++ Ledger tool (ledger-cli.org). Original code is licensed under:
-// Copyright (c) 2003-2021, John Wiegley.  All rights reserved.
+// Copyright (c) 2003-2023, John Wiegley.  All rights reserved.
 // See LICENSE.LEDGER file included with the distribution for details and disclaimer.
 // **********************************************************************************
 using NLedger.Amounts;
diff --git a/Source/ProductInfo.xml b/Source/ProductInfo.xml
index 8895bbcc..e713520a 100644
--- a/Source/ProductInfo.xml
+++ b/Source/ProductInfo.xml
@@ -2,7 +2,7 @@
 
   
 	0.8
-	4
+	5
 	beta		
     
     
@@ -24,7 +24,7 @@
   
   
     
-    2020/01/01  
+    2023/01/01  
   
   
     
diff --git a/_CI.BuildLog.md b/_CI.BuildLog.md
index 4a08b612..971e0b48 100644
--- a/_CI.BuildLog.md
+++ b/_CI.BuildLog.md
@@ -18,6 +18,94 @@ the latest build status is:
 .
 
 
+***
+#### ![Succeeded](https://img.shields.io/badge/Build-Succeeded-green.svg) Build [95] 2023/12/26 17:15:49
+
+>Build #95; Status:Succeeded
+
+>Queued by Microsoft.VisualStudio.Services.TFS; Reason:IndividualCI
+
+>Requested for Microsoft.VisualStudio.Services.TFS (Email:\*)
+
+>Latest commit: 3480c60f3dded8669f456294f7a38e463f3905d8
+
+Build logs: [NLedger-BuildLogs-v0.8.zip](https://www.dropbox.com/scl/fi/qegm241asju8228vg29gn/NLedger-BuildLogs-v0.8.zip?rlkey=5bjyiy0jcl9ik1cpuxd0t7fpg&dl=0) MD5: 27E4B3B94151D6E55B7CB1BABC984227
+
+Install package: [NLedger-v0.8.zip](https://www.dropbox.com/scl/fi/kphhsn5rvl0ih24hnj7o4/NLedger-v0.8.zip?rlkey=lwxr7nffltdiwrp8cqtusykwo&dl=0) MD5: 243A1649741E76BBA4BEFCAD56D59472
+
+MSI package: [NLedger-v0.8.msi](https://www.dropbox.com/scl/fi/t1usdex2tumquegic3hk7/NLedger-v0.8.msi?rlkey=pj9nun8hsrjxhpojdp5rjdjvt&dl=0) MD5: 7F1E0BF6EE5514BBDDE83FE46586CF57
+
+Nuget package: [NLedger.0.8.5-beta.nupkg](https://www.dropbox.com/scl/fi/o6nk41yrr3yfey8n9kqhw/NLedger.0.8.5-beta.nupkg?rlkey=mdnjq96cfic8bupcoen8uhopb&dl=0) MD5: 661F383CCFB9FC63AC8C22249780B1F8
+
+Nuget Python package: [NLedger.Extensibility.Python.0.8.5-beta.nupkg](https://www.dropbox.com/scl/fi/ur8db9o4q9rbnms7jdhzx/NLedger.Extensibility.Python.0.8.5-beta.nupkg?rlkey=9e4kwf6309r7oaqys52qmri7c&dl=0) MD5: 0A960ABB04E5938355E098146AEC4DC1
+
+Wheel Python package: [ledger-0.8.5-py3-none-any.whl](https://www.dropbox.com/scl/fi/t9fdrxcds74f8d6891w5b/ledger-0.8.5-py3-none-any.whl?rlkey=4nz38q4flmoo7zk3vltbe14g1&dl=0) MD5: 0A15CC507A24F23A74E395A00491B498
+***
+#### ![Failed](https://img.shields.io/badge/Build-Failed-red.svg) Build [94] 2023/12/26 16:47:05
+
+>Build #94; Status:Failed
+
+>Queued by Dmitry Merzlyakov; Reason:Manual
+
+>Requested for Dmitry Merzlyakov (Email:dmitry_merzlyakov@hotmail.com)
+
+>Latest commit: c0ec85862233db3c022fb24404febc9b827361a0
+
+Build logs: [NLedger-BuildLogs-v0.8.zip](https://www.dropbox.com/scl/fi/8umlotpk586jsiwq33jp0/NLedger-BuildLogs-v0.8.zip?rlkey=s7oyy5ipeay5r44k16h9tou4y&dl=0) MD5: 561C9E504CCD83E47DFE3C8870479424
+
+Install package: Not created
+
+MSI package: Not created
+
+Nuget package: Not created
+
+Nuget Python package: Not created
+
+Wheel Python package: Not created
+***
+#### ![Failed](https://img.shields.io/badge/Build-Failed-red.svg) Build [93] 2023/12/26 16:13:24
+
+>Build #93; Status:Failed
+
+>Queued by Dmitry Merzlyakov; Reason:Manual
+
+>Requested for Dmitry Merzlyakov (Email:dmitry_merzlyakov@hotmail.com)
+
+>Latest commit: bf3e58c6f5560a817173d24f3260d058e97d7c85
+
+Build logs: [NLedger-BuildLogs-v0.8.zip](https://www.dropbox.com/scl/fi/nj1nud4j7e3fekf3xa8nt/NLedger-BuildLogs-v0.8.zip?rlkey=ac0y7vvv1dx6x5bvwy9vawgl3&dl=0) MD5: 6F4A0B2FA2235AB63F2C6DD5CD0DB4F1
+
+Install package: Not created
+
+MSI package: Not created
+
+Nuget package: Not created
+
+Nuget Python package: Not created
+
+Wheel Python package: Not created
+***
+#### ![Failed](https://img.shields.io/badge/Build-Failed-red.svg) Build [92] 2023/12/26 16:07:12
+
+>Build #92; Status:Failed
+
+>Queued by Dmitry Merzlyakov; Reason:Manual
+
+>Requested for Dmitry Merzlyakov (Email:dmitry_merzlyakov@hotmail.com)
+
+>Latest commit: 45c6464d3a2285b56dd6953a6f960b3cf0dd6290
+
+Build logs: [NLedger-BuildLogs-v0.8.zip](https://www.dropbox.com/scl/fi/e9qwb1p0i57xnjmqqp46e/NLedger-BuildLogs-v0.8.zip?rlkey=jknb7m3jteg03tgzdki3984l1&dl=0) MD5: B040D552F3BCE9FE3CF44D1273DCCF32
+
+Install package: Not created
+
+MSI package: Not created
+
+Nuget package: Not created
+
+Nuget Python package: Not created
+
+Wheel Python package: Not created
 ***
 #### ![Succeeded](https://img.shields.io/badge/Build-Succeeded-green.svg) Build [90] 2021/11/29 15:49:02
 
@@ -922,6 +1010,10 @@ Install package: [NLedger-v0.6.Build.38.zip](https://www.dropbox.com/s/jsxn0doey
 
 
 
+
+
+
+
 
 
 
diff --git a/build.md b/build.md
index 68f83127..d79b9c76 100644
--- a/build.md
+++ b/build.md
@@ -11,7 +11,7 @@ refer to its [Readme](https://github.com/dmitry-merzlyakov/nledger/blob/master/S
 .Net Ledger as a software product consists of library files that include data processing logic, and an executable file that users run as a console application.
 Library files are .Net assemblies that can be linked with your software to get Ledger functionality.
 
-Library files are distributed as NuGet packages. Package binaries are compiled for .Net Framework 4.7.2 and Standard 2.0, so they should match most target platforms.
+Library files are distributed as NuGet packages. Package binaries are compiled for .Net Framework 4.8, Standard 2.0, .Net 6.0 and .Net 8.0, so they should match most target platforms.
 These binaries are actually the same files that are distributed with the console application, which means they have been properly tested with all unit and integration tests.
 
 The packages are available for download in the [NuGet](https://www.nuget.org/packages/NLedger/) repository. 
@@ -525,8 +525,8 @@ You may need to troubleshoot NLedger or build it from source. This section descr
 Here is a complete list of recommended software components for NLedger development. 
 Some of them may not be available on your operating system or are not needed for your purposes. 
 
-- .Net Core SDK 3.1 or later
-- .Net Framework 4.7.2 or later (if you want to build NLedger for .Net Framework)
+- .Net 6.0 (or later) with SDK
+- .Net Framework 4.8 or later (if you want to build NLedger for .Net Framework)
 - Visual Studio 2017 or Visual Studio Code with c# extension
 - Powershell (7.0 is recommended though 5.0 can work properly on Windows)
 - Git command line tool (only if you prefer command line)
@@ -553,7 +553,7 @@ If you want to make changes in code and save them for further work, the better i
 
 ### Build NLedger source code
 
-This action implies a manual development build: compile binaries (.Net Framework and/or .Net Core) and run unit tests. Unit tests checks binaries for both platforms and include:
+This action implies a manual development build: compile binaries and run unit tests. Unit tests checks binaries for both platforms and include:
    - NLedger unit tests (NLedger.Tests);
    - ported Ledger unit tests (NLedger.IntegrationTests/unit);
    - Ledger testing framework files (TestSetBaseline.cs, TestSetManual.cs, TestSetRegress.cs) and NLedger additions (TestSetNLedger.cs).
@@ -578,7 +578,7 @@ If you want to enable Python connection:
 
 1. Go to *nledger/* folder
 2. Execute: 
-    - `pwsh -file ./get-nledger-tools.ps1 -pythonConnect`
+    - `pwsh -file ./Contrib/nledger-tools.ps1 python-connect`
     - On Windows, you might need to type: `powershell -ExecutionPolicy RemoteSigned` instead of `pwsh`
 
 If you have any issues, see more information in `Manage Python Integration` section [here](https://github.com/dmitry-merzlyakov/nledger/blob/master/nledger.md).
@@ -587,11 +587,12 @@ If you have any issues, see more information in `Manage Python Integration` sect
 
 1. Go to *nledger/Source/* folder
 2. Execute `dotnet build --configuration Release`
-    - If you want to build Core binaries only, the command is: `dotnet build --configuration Release /p:CoreOnly=True`
     - For OSX, you also need to add a switch `-r osx-x64`
+    - The default targets are .Net Framework 4.8, .Net 6.0, .Net 8.0.
+    If you want to create binaries for other targets, you should specify a comma-separated list of TFM codes in two environment variables: `LocalLibraryTargetFrameworks` and `LocalTargetFrameworks`.
 3. Execute `dotnet test --configuration Release`
-    - For Core binaries only: `dotnet test --configuration Release /p:CoreOnly=True`
     - For OSX, add a switch `-r osx-x64`
+    - If you want to create binaries for other targets - set environment variables as it was mentioned above.
 
 #### Running 'get-nledger-up.ps1' helper script
 
@@ -602,7 +603,12 @@ If you have any issues, see more information in `Manage Python Integration` sect
 
 > Note: the switch -noNLTests disables integration tests but you can run with them.
 
-#### Build with Visual Studio 2017 or later
+> The script creates binaries for .Net Framework 4.8, .Net 6.0 and .Net 8.0 targets.
+If some of them are not available on your computer, they will be skipped.
+You can specify other targets using `-targets` parameter: it takes a comma-separated list of TFM codes.
+
+
+#### Build with Visual Studio 2019 or later
 
 1. Open NLedger solution (*Source\NLedger.sln*)
 2. Build all sources (Build All)
@@ -628,19 +634,11 @@ NLedger contributes all the original Ledger tests and a special software compone
 
 1. Navigate to *nledger/* folder
 2. Execute: 
-    - `pwsh -file ./get-nledger-tools.ps1 -testConsole`
+    - `pwsh -file ./Contrib/nledger-tools.ps1 test`
     - Remember that you might need to type `powershell -ExecutionPolicy RemoteSigned` instead of `pwsh` on Windows
-3. Follow instructions
-
-On Windows, you can also just run the file *nledger\Contrib\NLTestToolkit\NLTest.cmd*; it opens the testing toolkit console as well.
 
-The main capabilities of the testing toolkit are:
-- Commands `run`/`xrun`/`all` search all test files in *nledger/Contrib/test/* folder and run all of them;
-- Adding a search criteria selects a subset of tests by matching file names. For example, *run opt* runs all tests with "opt" in the name;
-- Command `run` also creates an HTML report file and opens it (if GUI is available, it runs a default browser);
-    - Note: the result files are saved in the folder *MyDocuments/NLedger/* (Windows) or *~/NLedger/* (Linux, OSX)
-- The toolkit looks for all available NLedger binaries. If there are binaries for both platforms (Framework and Core), it prefers Framework.
-  You can change the target executable by the command `platform -core`.
+This command runs all available Ledger tests on the machine.
+Check other options for `test` command by means of `get-help test`.
 
 #### Adding new integration tests
 
@@ -672,18 +670,17 @@ You can perform these actions automatically by the following command:
 
 1. Navigate to *nledger/* folder
 2. Execute: 
-    - `pwsh -file ./get-nledger-tools.ps1 -install`
+    - `pwsh -file ./Contrib/nledger-tools.ps1 install -link`
     - Remember that you might need to type `powershell -ExecutionPolicy RemoteSigned` instead of `pwsh` on Windows
     
 Notes:
-- Switch `-installPreferCore` installs .Net Core binaries if you have files for both platforms (otherwise, it prefers .Net Framework)
-- Switch `-installConsole` opens a console where you can troubleshoot issues with installing
-- On Windows, you can also run the console by running the file *nledger\Contrib\Install\NLedger.Install.cmd*
+- Parameter `-tfmCode` can contain a target TFM code for a binary file you want to install
+- Parameter `-profile` specifies which profile you would like to select (Debug or Release)
+- Switch `-link` indicates that you also want to create `ledger` hard link
 
 > It is highly recommended to re-open the console after installing or uninstalling.
 
-For uninstalling (that means reverting the described changes), you run `get-nledger-tools.ps1` with `-uninstall` switch
-(or use the installation console or run *nledger\Contrib\Install\NLedger.Uninstall.cmd* on Windows).
+For uninstalling (that means reverting the changes described above), you can run `./Contrib/nledger-tools.ps1 uninstall` command.
 
 ### Packaging Build (Official Build)
 
@@ -766,4 +763,4 @@ observe changes and check in updated files when it finishes.
 if it detects any differences*. In such cases, you also need to execute *Build\ProductInfoUpdate.cmd*
 and commit updated files.
 
-(c) 2017-2021 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
+(c) 2017-2023 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
diff --git a/get-nledger-tools.ps1 b/get-nledger-tools.ps1
deleted file mode 100644
index 9b6962c5..00000000
--- a/get-nledger-tools.ps1
+++ /dev/null
@@ -1,159 +0,0 @@
-<#
-.SYNOPSIS
-    Gets access to NLedger toolkit on any platform (Windows, Linux, OSX).
-.DESCRIPTION
-    NLedger toolkit helps to manage NLedger deployments on the current environment.
-    It covers the following areas:
-        1) Installing and uninstalling NLedger (that means addiing to PATH variable, creating 'ledger' hard link and some other activities);
-        2) Executing tests from Ledger testing framework (that ensures that existing binaries behaves exactly as the original Ledger);
-        3) Managing NLedger settings;
-        4) Showing an interactive demo web application.
-    Every action has a corresponded switch that needs to be specified. 
-    If no switches are specified, this script just prints a help text.
-.PARAMETER install
-    Installs NLedger binaries on the current environment (adds to PATH variable and creates 'ledger' hard link).
-    If the current deployment coontains binaries for both platforms (.Net Framework and .Net Core) - installs .Net Framework binaries.
-    If you run the script with administrative privileges, it will also create NGen image for .Net Framework binaries.
-.PARAMETER installPreferCore
-    Installs NLedger binaries but prefers .Net Core binaries if there is a choice.
-.PARAMETER uninstall
-    Uninstalls NLedger (removes from PATH, deletes 'ledger' alias and deletes NGen image for .Net Framework).
-    If other NLedger installations are detected in PATH, they are removed as well.
-.PARAMETER installConsole
-    Runs NLedger Install console where you can install or uninstall NLedger by means of interactive commands.
-.PARAMETER testConsole
-    Runs NLedger Test Toolkit interactive console.
-.PARAMETER settings
-    Runs NLedger Setup interactive console that allows to manage settings on the local environment (app, user and common scope).
-.PARAMETER pythonConnect
-    Creates Python Extension settings file.
-.PARAMETER pythonTools
-    Runs Python Toolset console that allows to manage Python Extension settings on the local environment.
-.PARAMETER demo
-    Runs NLedger demo web application where you can observe documentation and interatively run described commands.
-    GUI is needed (since this demo runs a browser).
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -install
-    Installs NLedger binaries (prefers .Net Framework is there is choice).
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -installPreferCore
-    Installs NLedger binaries (prefers .Net Core is there is choice).
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -uninstall
-    Uninstalls NLedger from the system.
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -installConsole
-    Runs NLedger Install interactive console where you can check installation status and install or uninstall NLedger.
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -testConsole
-    Runs NLedger Test Toolkit interactive console where you can execute ledger tests for current binaries.
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -pythonConnect
-    Creates Python Extension settings file that specifies where local Python is installed.
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -pythonTools
-    Runs Python Toolset console where you can change or remove Python Extension settings.
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -settings
-    Runs NLedger Setup interactive console where you can manage local NLedger settings.
-.EXAMPLE
-    PS> ./get-nledger-tools.ps1 -demo
-    Runs NLedger demo application.
-.NOTES
-    Author: Dmitry Merzlyakov
-    Date:   September 09, 2020    
-    ==
-    Run the script on Windows: >powershell -ExecutionPolicy RemoteSigned -File ./get-nledger-tools.ps1
-    Run the script on other OS: >powershell -File ./get-nledger-tools.ps1
-#>    
-
-[CmdletBinding()]
-Param(
-    [Switch][bool]$install = $False,
-    [Switch][bool]$installPreferCore = $False,
-    [Switch][bool]$uninstall = $False,
-    [Switch][bool]$installConsole = $False,
-    [Switch][bool]$testConsole = $False,
-    [Switch][bool]$settings = $False,
-    [Switch][bool]$pythonConnect = $False,
-    [Switch][bool]$pythonTools = $False,
-    [Switch][bool]$demo = $False
-)
-
-trap 
-{ 
-  write-error $_ 
-  exit 1 
-} 
-
-[string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-[bool]$Script:isWindowsPlatform = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)
-[string]$Script:powershell = $(if($Script:isWindowsPlatform){"powershell"}else{"pwsh"})
-
-if ($install) {
-    & $Script:powershell -File $("$Script:ScriptPath/Contrib/Install/NLedger.Install.ps1") -install
-    return
-}
-
-if ($installPreferCore) {
-    & $Script:powershell -File $("$Script:ScriptPath/Contrib/Install/NLedger.Install.ps1") -installPreferCore
-    return
-}
-
-if ($uninstall) {
-    & $Script:powershell -File $("$Script:ScriptPath/Contrib/Install/NLedger.Install.ps1") -uninstall
-    return
-}
-
-if ($installConsole) {
-    & $Script:powershell -NoExit -File $("$Script:ScriptPath/Contrib/Install/NLedger.Install.ps1")
-    return
-}
-
-if ($testConsole) {
-    & $Script:powershell -NoExit -File $("$Script:ScriptPath/Contrib/NLTestToolkit/NLTest.Launcher.ps1")
-    return
-}
-
-if ($settings) {
-    & $Script:powershell -NoExit -File $("$Script:ScriptPath/Contrib/NLManagement/NLSetup.Console.ps1")
-    return
-}
-
-if ($pythonConnect) {
-    & $Script:powershell -File $("$Script:ScriptPath/Contrib/Python/GetPythonEnvironment.ps1") -command connect
-    return
-}
-
-if ($pythonTools) {
-    & $Script:powershell -NoExit -File $("$Script:ScriptPath/Contrib/Python/GetPythonEnvironment.ps1")
-    return
-}
-
-if ($demo) {
-    & $Script:powershell -File $("$Script:ScriptPath/Contrib/NLManagement/NLDoc.LiveDemo.WebConsole.ps1")
-    return
-}
-
-Write-Host -ForegroundColor White "*** NLedger toolkit launcher ***"
-Write-Host
-Write-Host "Use one of the following switches:"
-Write-Host
-Write-Host -NoNewline -ForegroundColor Yellow "-install           "
-Write-Host "Installs NLedger binaries. Prefers .Net Framework if it is available."
-Write-Host -NoNewline -ForegroundColor Yellow "-installPreferCore "
-Write-Host "Installs NLedger binaries. Prefers .Net Core."
-Write-Host -NoNewline -ForegroundColor Yellow "-uninstall         "
-Write-Host "Uninstalls NLedger binaries."
-Write-Host -NoNewline -ForegroundColor Yellow "-installConsole    "
-Write-Host "Runs interactive installer."
-Write-Host -NoNewline -ForegroundColor Yellow "-testConsole       "
-Write-Host "Runs NLedger Test Toolkit console."
-Write-Host -NoNewline -ForegroundColor Yellow "-settings          "
-Write-Host "Runs NLedger settings manager."
-Write-Host -NoNewline -ForegroundColor Yellow "-pythonConnect     "
-Write-Host "Creates Python Extension settings file."
-Write-Host -NoNewline -ForegroundColor Yellow "-pythonTools       "
-Write-Host "Runs Python Toolset console that manages Python Extension settings."
-Write-Host -NoNewline -ForegroundColor Yellow "-demo              "
-Write-Host "Runs NLedger interactive demo. Requires GUI."
diff --git a/get-nledger-up.ps1 b/get-nledger-up.ps1
index c850453d..ecaa2ffc 100644
--- a/get-nledger-up.ps1
+++ b/get-nledger-up.ps1
@@ -1,46 +1,64 @@
 <#
 .SYNOPSIS
-    Build, verify and optionally install NLedger from source code.
+Builds, verifies, and optionally installs NLedger from source code.
+
 .DESCRIPTION
-    This script helps  to get workable NLedger from source code
-    on their computer. It performs four basic steps: a) builds binaries;
-    b) runs unit tests; c) runs integration tests; d) optionally, installs created binaries
-    (adds to PATH and creates 'ledger' hard link). In case of any errors on any steps,
-    the script provides troubleshooting information to help people solve environmental
-    issues. Switches can regulate this process. The script works on any platform (Windows, Linux, OSX).
-.PARAMETER coreOnly
-    Orders to create .Net Core binaries only. By default, the script creates both Framework
-    and Core binaries. This switch is selected automatically on non-Windows platforms.
+This script will help you get a working NLedger from source on your computer.
+It performs five main steps:
+ a) creates binary files;
+ b) runs unit tests;
+ c) runs integration tests;
+ d) builds and tests the NLedger Python module;
+ d) optionally installs the generated binaries (adds them to PATH and creates a hard link to the "ledger").
+If errors occur at any stage, the script provides troubleshooting information 
+to help you build environment issues. Switches can regulate this process. 
+The script works on any platform (Windows, Linux, OSX).
+
+.PARAMETER targets
+An optional parameter that specifies one or more target framework versions for binary files.
+The targets should be provided as a semicolon-separated list of target framework moniker (TFM) codes.
+(See more about TFM here: https://learn.microsoft.com/en-us/dotnet/standard/frameworks)
+If this parameters is omitted, the script tries to build three targets: net48, net6.0 and net8.0.
+If any of these targets are not available on the machine, they are skipped.
+User-specified targets are used as is (so you may get a build error if the corresponding SDK is not available).
+
 .PARAMETER debugMode
-    Orders to create binaries in Debug mode (Release by default)
+Forces building binaries in Debug mode (default Release).
+
 .PARAMETER noUnitTests
-    Omits xUnit tests
+Skips xUnit tests
+
 .PARAMETER noNLTests
-    Omits NLTest integration tests
+Skips Ledger integration tests
+
 .PARAMETER noPython
-    Disables Python unit and integration tests; Python module build is skipped
+Skips building and testing the Python module.
+
 .PARAMETER install
-    If this switch is set, the script installs NLedger when binaries are built and verified.
+Installs NLedger and creates a hard link. If multiple targets are specified, it installs the latest one.
+
 .EXAMPLE
-    PS> ./get-nledger-up.ps1
-    Build, verify and install NLedger from source code.
+PS> ./get-nledger-up.ps1
+Build, verify and install NLedger from source code.
+
 .EXAMPLE
-    PS> ./get-nledger-up.ps1 -Verbose
-    Show detail diagnostic information to troubleshoot build issues.
+PS> ./get-nledger-up.ps1 -Verbose
+Show detail diagnostic information to troubleshoot build issues.
+
 .EXAMPLE
-    PS> ./get-nledger-up.ps1 -coreOnly
-    Create .Net Core binaries only.
-    Note: this switch is set automatically on non-windows platforms.
+PS> ./get-nledger-up.ps1 -targets net5.0;net7.0
+Create binaries for net5.0 and net 7.0 targets.
+
 .NOTES
-    Author: Dmitry Merzlyakov
-    Date:   October 19, 2021
-    ===
-    Run the script on Windows: >powershell -ExecutionPolicy RemoteSigned -File ./get-nledger-up.ps1
-    Run the script on other OS: >powershell -File ./get-nledger-up.ps1
+Author: Dmitry Merzlyakov
+Date:   December 20, 2023
+
+Run the script on Windows: >powershell -ExecutionPolicy RemoteSigned -File ./get-nledger-up.ps1
+Run the script on other OS: >pwsh -File ./get-nledger-up.ps1
 #>
 [CmdletBinding()]
 Param(
-    [Switch][bool]$coreOnly = $False,
+    [string]$targets = "",
     [Switch][bool]$debugMode = $False,
     [Switch][bool]$noUnitTests = $False,
     [Switch][bool]$noNLTests = $False,
@@ -55,53 +73,59 @@ trap
 } 
 
 [string]$Script:ScriptPath = Split-Path $MyInvocation.MyCommand.Path
-[Version]$minDotnetVersion = "3.1"
+
+[string]$defaultTargets = "net48;net6.0;net8.0"
 
 Write-Progress -Activity "Building, testing and installing NLedger" -Status "Initialization"
 
-# Check environmental information
+function Assert-FileExists {
+    [CmdletBinding()]
+    Param([Parameter(Mandatory=$True)][string]$fileName)
 
-[bool]$isWindowsPlatform = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::Windows)
-[bool]$isOsxPlatform = [System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform([System.Runtime.InteropServices.OSPlatform]::OSX)
-Write-Verbose "Detected: is windows platform=$isWindowsPlatform; is OSX platform: $isOsxPlatform"
+    $fileName = [System.IO.Path]::GetFullPath($fileName)
+    if (!(Test-Path -LiteralPath $fileName -PathType Leaf)) { throw "File '$fileName' does not exist. Check that source code base is in valid state." }
+    return $fileName
+}
 
-[bool]$isDotNetInstalled = -not(-not($(get-command dotnet -ErrorAction SilentlyContinue)))
-if (!$isDotNetInstalled) { throw "DotNet Core is not installed (command 'dotnet' is not available)" }
+Import-Module (Assert-FileExists "$Script:ScriptPath/Contrib/Common/SysCommon.psm1")
+Import-Module (Assert-FileExists "$Script:ScriptPath/Contrib/Common/SysPlatform.psm1")
+Import-Module (Assert-FileExists "$Script:ScriptPath/Contrib/Common/SysDotnet.psm1")
+Import-Module (Assert-FileExists "$Script:ScriptPath/Contrib/Common/NLedgerEnvironment.psm1")
+Import-Module (Assert-FileExists "$Script:ScriptPath/Contrib/Python/NLedgerPyEnvironment.psm1")
 
-[Version]$dotnetVersion = $(dotnet --version)
-Write-Verbose "Detected: dotnet version=$dotnetVersion"
-if ($dotnetVersion -lt $minDotnetVersion) { throw "Detected dotnet version is $dotnetVersion but minimal required is $minDotnetVersion" }
+# Check environmental information
+
+Write-Verbose "Detected: is windows platform=$(Test-IsWindows); is OSX platform: $(Test-IsOSX)"
+if (!(Test-IsDotnetInstalled)) { throw "DotNet Core is not installed (command 'dotnet' is not available)" }
 
 # Validate switchers
 
-if (!$isWindowsPlatform -and !$coreOnly) {
-    $coreOnly = $true
-    Write-Verbose "Since it is not windows platform, switch 'coreOnly' is changed to 'True'."
+if (!$targets) { 
+    Write-Verbose "Getting default build targets"
+    $targets = ($defaultTargets -split ";" | Where-Object { Test-HasCompatibleSdk $_ }) -join ";"
+    if (!$targets) { throw "Appropriate build targets not found on the local machine. Specify 'target' parameter explicitely." }
 }
+Write-Verbose "Build targets: $targets"
+
+$libraryTargets = "netstandard2.0;$(($targets -split ";" | Where-Object { !(Expand-TfmCode $_).IsFramework }) -join ";")"
+
+Write-Verbose "Library build targets: $libraryTargets"
 
 # Check codebase structure
 
-[string]$solutionPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath/Source/NLedger.sln")
-Write-Verbose "Expected solution path: $solutionPath"
-if (!(Test-Path -LiteralPath $solutionPath -PathType Leaf)) { "File '$solutionPath' does not exist. Check that source code base is in valid state." }
+[string]$solutionPath = Assert-FileExists "$Script:ScriptPath/Source/NLedger.sln"
+Write-Verbose "Solution path: $solutionPath"
 
-[string]$nlTestPath = [System.IO.Path]::GetFullPath("$Script:ScriptPath/Contrib/NLTestToolkit/NLTest.ps1")
-Write-Verbose "Expected NLTest path: $nlTestPath"
-if (!(Test-Path -LiteralPath $nlTestPath -PathType Leaf)) { "File '$nlTestPath' does not exist. Check that source code base is in valid state." }
+[string]$nlTestPath = Assert-FileExists "$Script:ScriptPath/Contrib/test/NLTest.ps1"
+Write-Verbose "NLTest path: $nlTestPath"
 
 # Check Python connection availability
 
-[string]$powershell = $(if($Script:isWindowsPlatform){"powershell"}else{"pwsh"})
-
 if (!$noPython) {
     Write-Verbose "Checking NLedger Python extension settings..."
-    
-    [string]$testConnectionOutput = & $powershell -File $("$Script:ScriptPath/Contrib/Python/GetPythonEnvironment.ps1") -command "test-connection"
-    Write-Verbose "GetPythonEnvironment's test-connection returned: $testConnectionOutput"
-    $pythonConnectionStatus = $(if($testConnectionOutput){[System.Management.Automation.PSSerializer]::Deserialize($testConnectionOutput)}else{$null})
-    
+    $pythonConnectionStatus = Get-PythonConnectionInfo
     if (!($pythonConnectionStatus.IsConnectionValid)){
-        Write-Warning "NLedger Python Extension settings are not configured or not valid. This does not prevent the build from completing, but unit and integration tests that require Python will be skipped. Building Ledger module will be skipped. Use './get-nledger-tools.ps1 -pythonTools' command to configure settings or disable this warning by adding a switch './get-nledger-up.ps1 -noPython'."
+        Write-Warning "NLedger Python Extension settings are not configured or not valid. This does not prevent the build from completing, but unit and integration tests that require Python will be skipped. Building Ledger module will be skipped. Use './Contrib/nledger-tools.ps1 python-connect' command to configure settings or disable this warning by adding a switch './get-nledger-up.ps1 -noPython'."
         $noPython = $True
     }
 }
@@ -109,13 +133,20 @@ if ($noPython){$env:NLedgerPythonConnectionStatus = "Disabled"}
 
 # First step: build sources
 
-Write-Progress -Activity "Building, testing and installing NLedger" -Status "Building source code [$(if($coreOnly){".Net Core"}else{".Net Framework,.Net Core"})] [$(if($debugMode){"Debug"}else{"Release"})]"
+Write-Progress -Activity "Building, testing and installing NLedger" -Status "Building source code [$targets] [$(if($debugMode){"Debug"}else{"Release"})]"
+
+function Get-DotnetBuildCommandLine {
+    [CmdletBinding()]
+    Param([Parameter(Mandatory=$True)][string]$command)
 
-[string]$buildCommandLine = "dotnet build '$solutionPath'"
-if ($coreOnly) { $buildCommandLine += " /p:CoreOnly=True"}
-if ($debugMode) { $buildCommandLine += " --configuration Debug"} else { $buildCommandLine += " --configuration Release" }
-if ($isOsxPlatform) { $buildCommandLine += " -r osx-x64"}
-Write-Verbose "Build sources command line: $buildCommandLine"
+    # Due to a msbuild issue, use env variable instead of parameter -p:LocalTargetFrameworks='$targets'. See https://github.com/dotnet/msbuild/issues/2999
+    $env:LocalLibraryTargetFrameworks = $libraryTargets 
+    $env:LocalTargetFrameworks = $targets 
+    [string]"dotnet $command '$solutionPath' --configuration $(if($debugMode){"Debug"}else{"Release"}) $(if($isOsxPlatform){" -r osx-x64"})"
+}
+
+[string]$buildCommandLine = Get-DotnetBuildCommandLine "build"
+Write-Verbose "Build sources command line: $buildCommandLine; Env variables LocalTargetFrameworks: $env:LocalTargetFrameworks; LocalLibraryTargetFrameworks: $env:LocalLibraryTargetFrameworks"
 
 $null = (Invoke-Expression $buildCommandLine | Write-Verbose)
 if ($LASTEXITCODE -ne 0) { throw "Build failed for some reason. Run this script again with '-Verbose' to get more information about the cause." }
@@ -123,13 +154,10 @@ if ($LASTEXITCODE -ne 0) { throw "Build failed for some reason. Run this script
 # Second step: run unit tests
 
 if(!$noUnitTests) {
-    Write-Progress -Activity "Building, testing and installing NLedger" -Status "Running unit tests [$(if($coreOnly){".Net Core"}else{".Net Framework,.Net Core"})] [$(if($debugMode){"Debug"}else{"Release"})]"
+    Write-Progress -Activity "Building, testing and installing NLedger" -Status "Running unit tests [$targets] [$(if($debugMode){"Debug"}else{"Release"})]"
 
-    [string]$unittestCommandLine = "dotnet test '$solutionPath'"
-    if ($coreOnly) { $unittestCommandLine += " /p:CoreOnly=True"}
-    if ($debugMode) { $unittestCommandLine += " --configuration Debug"} else { $buildCommandLine += " --configuration Release" }
-    if ($isOsxPlatform) { $buildCommandLine += " -r osx-x64"}
-    Write-Verbose "Run unit tests command line: $unittestCommandLine"
+    [string]$unittestCommandLine = Get-DotnetBuildCommandLine "test"
+    Write-Verbose "Run unit tests command line: $unittestCommandLine; Environment variable LocalTargetFrameworks: $env:LocalTargetFrameworks"
 
     $null = (Invoke-Expression $unittestCommandLine | Write-Verbose)
     if ($LASTEXITCODE -ne 0) { throw "Unit tests failed for some reason. Run this script again with '-Verbose' to get more information about the cause." }
@@ -137,39 +165,17 @@ if(!$noUnitTests) {
 
 # Third step: run integration tests
 
-function composeNLedgerExePath {
-    Param([Parameter(Mandatory=$True)][bool]$core)
-    [string]$private:config = $(if($debugMode){"Debug"}else{"Release"})
-    [string]$private:framework = $(if($core){"netcoreapp3.1"}else{"net472"})
-    [string]$private:osxBin = $(if($isOsxPlatform){"/osx-x64"})
-    [string]$private:extension = $(if($isWindowsPlatform){".exe"}else{""})
-    return [System.IO.Path]::GetFullPath("$Script:ScriptPath/Source/NLedger.CLI/bin/$private:config/$private:framework$($private:osxBin)/NLedger-cli$private:extension")
-}    
-
 if (!$noNLTests)
 {
     [string]$ignoreCategories = $(if($noPython){"python"}else{""})
 
-    if (!$coreOnly){
-        Write-Progress -Activity "Building, testing and installing NLedger" -Status "Running integration tests [.Net Framework] [$(if($debugMode){"Debug"}else{"Release"})]"
-
-        [string]$nledgerFrameworkExeFile = composeNLedgerExePath -core $false
-        if (!(Test-Path -LiteralPath $nledgerFrameworkExeFile -PathType Leaf)) { throw "Cannot find $nledgerFrameworkExeFile" }
-
-        Import-Module "$Script:ScriptPath/Contrib/Install/SysNGen.psm1"
-        if (Test-CanCallNGen) {$null = Add-NGenImage $nledgerFrameworkExeFile}
-
-        $null = (& $nlTestPath -nledgerExePath $nledgerFrameworkExeFile -noconsole -showProgress -ignoreCategories $ignoreCategories | Write-Verbose)
+    $targetBins = Select-NLedgerDeploymentInfos (Get-NLedgerDeploymentInfo) $targets $debugMode
+    foreach ($binInfo in $targetBins) {
+        Write-Progress -Activity "Building, testing and installing NLedger" -Status "Running integration tests [$(Out-TfmProfile $binInfo.TfmCode $debugMode)]"
+        if ((Test-IsFrameworkTfmCode $binInfo.TfmCode) -and (Test-CanCallNGen)) { $null = Add-NGenImage $binInfo.NLedgerExecutable }
+        $null = (& $nlTestPath -nledgerExePath $binInfo.NLedgerExecutable -noconsole -showProgress -ignoreCategories $ignoreCategories | Write-Verbose)
         if ($LASTEXITCODE -ne 0) { throw "Integration tests failed for some reason. Run this script again with '-Verbose' to get more information about the cause." }
     }
-
-    Write-Progress -Activity "Building, testing and installing NLedger" -Status "Running integration tests [.Net Core] [$(if($debugMode){"Debug"}else{"Release"})]"
-
-    [string]$nledgerCoreExeFile = composeNLedgerExePath -core $true
-    if (!(Test-Path -LiteralPath $nledgerCoreExeFile -PathType Leaf)) { throw "Cannot find $nledgerCoreExeFile" }
-
-    $null = (& $nlTestPath -nledgerExePath $nledgerCoreExeFile -noconsole -showProgress -ignoreCategories $ignoreCategories | Write-Verbose)
-    if ($LASTEXITCODE -ne 0) { throw "Integration tests failed for some reason. Run this script again with '-Verbose' to get more information about the cause." }
 }
 
 # Fourth step: build Python module
@@ -194,46 +200,27 @@ if (!$noPython){
 
 if ($install) {    
     Write-Progress -Activity "Building, testing and installing NLedger" -Status "Installing NLeger binaries"
-    $null = (& $powershell -File $("$Script:ScriptPath/Contrib/Install/NLedger.Install.ps1") -install | Write-Verbose)
-    if ($LASTEXITCODE -ne 0) { throw "Installation failed for some reason. Run this script again with '-Verbose' to get more information about the cause." }
+
+    $deploymentInfo = Get-NLedgerDeploymentInfo
+    $installInfo = Select-NLedgerDeploymentInfos $deploymentInfo $targets $debugMode | Select-Object -Last 1 | Assert-IsNotEmpty "Unrecoverable issue: cannot find files for installation"
+    if ($deploymentInfo.EffectiveInstalled) { $null = Uninstall-NLedgerExecutable }
+    $installResponse = Install-NLedgerExecutable $installInfo.TfmCode $installInfo.IsDebug -link
+    if (!$installResponse.NLedgerExecutable) { throw "Installation failed for some reason. Run this script again with '-Verbose' to get more information about the cause." }
 }
 
 Write-Progress -Activity "Building, testing and installing NLedger" -Status "Completed" -Completed
 
 # Print summary
 
-Write-Host "*** NLedger Build succeeded ***"
-Write-Host
+Write-Output "*** NLedger build completed successfully ***`n"
 
-Write-Host "Build source code: OK [$(if($coreOnly){".Net Core"}else{".Net Framework,.Net Core"})] [$(if($debugMode){"Debug"}else{"Release"})]"
-if (!($coreOnly)) {Write-Host "   .Net Framework binary: $(composeNLedgerExePath -core $false)"}
-Write-Host "   .Net Core binary: $(composeNLedgerExePath -core $true)"
-Write-Host
+Write-Output "Build source code: OK [$targets]"
+Select-NLedgerDeploymentInfos (Get-NLedgerDeploymentInfo) $targets $debugMode | ForEach-Object { Write-Output " > $($_.NLedgerExecutable)"}
 
-if (!($noUnitTests)) {
-    Write-Host "Unit tests: OK [$(if($coreOnly){".Net Core"}else{".Net Framework,.Net Core"})] [$(if($debugMode){"Debug"}else{"Release"})]"
-} else {
-    Write-Host "Unit tests: IGNORED"
-}
-Write-Host
+Write-Output "Unit tests: $(if(!$noUnitTests){ "OK" }else{ "SKIPPED" })"
+Write-Output "Ledger tests: $(if(!$noNLTests){ "OK" }else{ "SKIPPED" })"
+Write-Output "Python module: $(if($pythonModuleBuilt){ "BUILT (see ./Contrib/Python)" }else{ "SKIPPED" })"
 
-if (!($noNLTests)) {
-    Write-Host "NLedger tests: OK [$(if($coreOnly){".Net Core"}else{".Net Framework,.Net Core"})] [$(if($debugMode){"Debug"}else{"Release"})]"
-} else {
-    Write-Host "NLedger tests: IGNORED"
-}
-Write-Host
-
-if ($pythonModuleBuilt) {
-    Write-Host "Python module: BUILT (see /Contrib/Python)"
-} else {
-    Write-Host "Python module: IGNORED"
-}
-Write-Host
-
-if ($install) {
-    Write-Host "NLedger install: OK (Note: run a new console session to get effect of changes in environment variables)"
-} else {
-    Write-Host "NLedger is ready to be installed (use ./get-nledger-tools -install)"
-}
-Write-Host
+if ($install) { Write-Output "NLedger install: OK (Installed $($installResponse.NLedgerExecutable))`nNote: run a new console session to get effect of changes in environment variables" }
+else { Write-Output "NLedger is ready to be installed (use ./Contrib/nledger-tools.ps1 install)" }
+Write-Output ""
diff --git a/nledger.md b/nledger.md
index 845adcaf..9b40827f 100644
--- a/nledger.md
+++ b/nledger.md
@@ -13,15 +13,14 @@ it describes the installation process, specific configuration options and how to
 
 ### Basic Requirements
 
-NLedger is a .Net console application, so basic requirements are minimal; you have to have either .Net Framework or .Net Core installed on your machine:
+NLedger is a .Net console application, so basic requirements are minimal: you must have any currently supported version of .Net installed on your computer.
 
-- [.Net Framework 4.7.2 or later](https://dotnet.microsoft.com/download/dotnet-framework) (for .Net Framework version of NLedger)
-- [.Net Core SDK or Runtime 3.1](https://dotnet.microsoft.com/download/dotnet-core/3.1) (for .Net Core version)
+- [.Net Framework 4.7.2 and later versions](https://dotnet.microsoft.com/download/dotnet-framework) (for .Net Framework version of NLedger)
+- [.Net 5 (and .Net Core) and later versions](https://dotnet.microsoft.com/en-us/download) (for .Net version of NLedger)
 
-Your choice depends on which host operation system you have. For Linux ans OSX, you should have .Net Core SDK. For Windows,
-.Net Framework is preferable if you want to install an MSI package; the ZIP package can work with both frameworks.
+Your choice depends on what operating system you have. For Linux and OSX, you must have .Net with SDK to run NLedger. For Windows, .Net Framework is acceptable if you want to install an MSI or ZIP package without installing additional components, although you can also run NLedger on other .Net implementations.
 
-NLedger deployment includes a set of Powershell helper scripts for configuring the product, testing, running a demo and managing environment settings.
+NLedger deployment includes a set of Powershell helper scripts (`.Net Ledger Tools`) for configuring the product, testing, running a demo and managing environment settings.
 They are not required but are generally recommended. Therefore:
 
 - [Optionally] Powershell (you can find a latest version available for your host operation system [here](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7))
@@ -33,7 +32,7 @@ They are not required but are generally recommended. Therefore:
 - Python 3.6 (64-bit) or later (you can find the latest version for Windows [here](https://www.python.org/downloads/windows/) or follow Python installation recommendations for your OS)
   - The requirement for 64-bit Python stems from the assumption that the .Net Ledger is running as a 64-bit process. This is the correct assumption for the vast majority of modern environments. However, if your .Net Ledger is running as a 32-bit process for some reason, you should have 32-bit Python.
 
-If you are going to use Python Toolset script (this is the recommended approach for setting up Python integration), you should also have the following Python modules installed:
+If you are going to use `.Net Ledger Tools` (this is the recommended approach for setting up Python integration), you should also have the following Python modules installed:
 - `Pip` is the [package installer](https://pypi.org/project/pip/) for Python. You can find installation instruction [here](https://pip.pypa.io/en/stable/installation/). I personally prefer using [get-pip-py](https://pip.pypa.io/en/stable/installation/#get-pip-py)
    - Use the command `python -m pip --version` to check whether Pip is installed
 - `find-libpython` module is needed for Python ToolSet to find LibPython location. It will be installed automatically.
@@ -43,7 +42,7 @@ If you are going to build .Net Ledger from source code with enabled Python featu
 - `PythonNet` module is needed for testing .Net Ledger Python module after build
   - If you have issues with installing PythonNet, please check Troubleshooting section in the module [Readme](https://github.com/dmitry-merzlyakov/nledger/blob/master/Source/NLedger.Extensibility.Python.Module/README.md) file.
 
-> Windows users can relay on the *Python ToolSet* helper script; it may automatically install and configure the embedded version of Python for the .Net Ledger.
+> Windows users can relay on the `.Net Ledger Tools` helper script; it can automatically install and configure the embedded version of Python for the .Net Ledger.
 
 ### Build from source code
 
@@ -65,7 +64,7 @@ This option works on Windows, Linux and OSX. It includes:
 - Passing unit and integration tests
 - Installing binaries (adding to PATH variable and creating 'ledger' alias)
 
-Prerequisites: .Net Core SDK 3.1, Powershell, Python 3.6, Git command line tool
+Prerequisites: .Net with SDK, Powershell, Python 3.6, Git command line tool
 
 #### Installing (Windows, Linux and OSX)
 
@@ -76,22 +75,22 @@ Prerequisites: .Net Core SDK 3.1, Powershell, Python 3.6, Git command line tool
 ```
 git clone https://github.com/dmitry-merzlyakov/nledger
 cd nledger
-pwsh -file ./nledger/get-nledger-tools.ps1 -pythonConnect
-pwsh -file ./nledger/get-nledger-up.ps1 -install
+pwsh -file ./Contrib/nledger-tools.ps1 python-connect
+pwsh -file ./get-nledger-up.ps1 -install
 ```
 
 On Windows, depending on your Powershell version, the last commands might be:
 
 ```
-PowerShell -ExecutionPolicy RemoteSigned -File ./get-nledger-tools.ps1 -pythonConnect
+PowerShell -ExecutionPolicy RemoteSigned -File ./Contrib/nledger-tools.ps1 python-connect
 powershell -ExecutionPolicy RemoteSigned -File ./get-nledger-up.ps1 -install
 ```
 
 Remarks:
-- Setting up the Python connection (the command *./get-nledger-tools.ps1 -pythonConnect*) enables Python-related unit and integration tests, and also triggers the creation of .Net Ledger Python module. If you are not interested in Python integration, you can skip this step
+- Setting up the Python connection (the command *./Contrib/nledger-tools.ps1 python-connect*) enables Python-related unit and integration tests, and also triggers the creation of .Net Ledger Python module. If you are not interested in Python integration, you can skip this step
 - If Python connection is not configured, build warnings will be displayed indicating skipped steps. You can suppress them by running the build with `noPython` flag:
 ```
-pwsh -file ./nledger/get-nledger-up.ps1 -install -noPython
+pwsh -file ./get-nledger-up.ps1 -install -noPython
 ```
 - Building Python Module requires "pip", "wheel" and, optionally, "pythonnet" modules to be installed in Python. See more information in `Manage Python Integration` section
 
@@ -101,7 +100,7 @@ Uninstalling includes removing NLedger from PATH variable and deleting a short a
 
 Open a terminal window, navigate to the folder containing NLedger and execute:
 ```
-pwsh -file ./get-nledger-tools.ps1 -uninstall
+pwsh -file ./Contib/nledger-tools.ps1 uninstall
 ```
 Remember that you might need to type `powershell -ExecutionPolicy RemoteSigned` instead of `pwsh` for old Powershell versions on Windows.
 
@@ -134,8 +133,8 @@ NLedger installer is a regular Microsoft Windows MSI package. It does:
 
 Installing NLedger from an installation package is pretty easy; your steps are:
 
-- Check prerequisites. You must have .Net Framework 4.7.2 or later; it is absolutely required.
-  If you want to use any component that requires Powershell, check, please, that you have Powershell 4.5 or higher:
+- Check prerequisites. You must have .Net Framework 4.7.2 or later.
+  If you want to use any component that requires Powershell, check, please, that you have Powershell 5.0 or higher:
 
   - In command line window, type *powershell* and once it shows its prompt, type *$PSVersionTable*. The field *PSVersion* contains its version;
 
@@ -154,13 +153,12 @@ You can get the latest ZIP package by this [link](https://github.com/dmitry-merz
 
 If you do not want to run NLedger Installer (MSI package) for some reason, you can get binaries from a ZIP package. The package contains binary files for Windows, so this option works on this operation system only.
 
-Prerequisites: .Net Framework 4.7.2 or .Net Core SDK 3.1 (the package contains binaries for both frameworks)
+Prerequisites: .Net Framework 4.7.2 or .Net 6.0 (or later) runtime (the package contains binaries for .Net Framework, .Net 6.0 and .Net 8.0).
 
 Basically, NLedger binaries are immediately ready for using once they are unpacked.
 However, there are three additional recommended steps that make your work with NLedger more comfortable:
 
-1. It is recommended to create native images for NLedger binaries by calling NGen. 
-   Native images contain very efficient code that speeds up NLedger several times;
+1. For .Net Framework binaries, it is recommended to create native images by calling NGen. Native images contain very efficient code that speeds up NLedger several times;
 2. It is recommended to add the path to NLedger binaries to PATH environment variable.
    It allows you omit path to NLedger in the command line;
 3. You might find it useful to create an short alias to NLedger command line utility.
@@ -179,24 +177,25 @@ The steps to install NLedger are:
 
 1. Download and unpack NLedger zip package;
 2. Open unpacked files; move *NLedger* folder to any appropriate place (e.g. *"C:\Program Files"*);
-3. Open *NLedger\Install* folder;
-4. Execute *NLedger.Install.cmd* command file; confirm requested elevated permissions;
+3. Open *\Contrib* folder in the package;
+4. Execute *nledger-tools.cmd* command file (you may run it as an administrator if elevated privileges are needed);
 5. In the console window:
-    - Type `install` if you want to install .Net Framework version of NLedger
-    - Type `install -core` if you want to install .Net Core version of NLedger
-5. Observe the log of installation actions in the console and close it.
+    - Type `install -link` if you want to install the most appropraite binaries. The script will try to install either .Net 8 or .Net 6 or .Net Framework binaries - depending on which runtime is available on the local machine
+    - Type `install [TFM] -link` if you want to install binaries for a specific .Net implementation. Parameter TFM represent a corresponded TFM code (net6.0, net8.0, net48)
+5. Check the output messages in the console and close it (type `exit`).
 
-Now NLedger is ready for using. For example, open new Windows Command Prompt and type *ledger*:
-the standard prompt should appear. 
+> Note: use `status` command in the console to check the deployment status.
+
+Now NLedger is ready for using. For example, open new Windows Command Prompt and type *ledger*: the standard prompt should appear. 
 
 #### Uninstalling NLedger
 
 If you decide to remove NLedger from the system, perform the steps:
 
-1. Open *NLedger\Install* folder;
-2. Execute *NLedger.Uninstall.cmd* command file; confirm requested elevated permissions;
-3. Observe the log of uninstalling actions in the console and close it;
-4. Delete the folder *NLedger* (of course, make sure that you do not have your own files in this folder).
+1. Open *\Contrib* folder;
+2. Execute *nledger-tools.cmd* command file and execute `uninstall` command;
+3. Check the output messages in the console and close it;
+4. Delete the folder with ZIP package files (of course, make sure that you do not have your own files in this folder).
 
 ## Using NLedger
 
@@ -209,22 +208,22 @@ huge amount of good examples, best practices and recommendations how to deal wit
 accounting systems.
 
 *Note: the example journal file (drewr3.dat) and some other example files that are mentioned in 
-the documentation are available in the folder with Ledger tests (nledger/test/input).*
+the documentation are available in the folder with Ledger tests (/test/input).*
 
 ### Enable Python Integration
 
 Python integration is disabled by default, so you will get error messages like *Error: 'python' directive seen, but Python support is missing* if you try to use this feature.
 
-In order to enable the integration, you should run the Python ToolSet console and execute `enable` command:
+In order to enable the integration, you should run the .Net Ledger ToolSet console and execute `python-enable` command:
 
-1. Click on the '.Net Ledger Python Toolkit' menu shortcut or run the file [Install Folder]/Contrib/Python/GetPythonEnvironment.Console.cmd
+1. Click on the '.Net Ledger Tools' menu shortcut or run the file [Install Folder]/Contrib/nledger-tools.ps1
    - Similar command for Linux and OSX users is:
 
 ```console
-$pwsh -file ./get-nledger-tools.ps1 -pythonTools
+$pwsh -file ./Contrib/nledger-tools.ps1
 ```
 
-2. Type `enable` in the console
+2. Type `python-enable` in the console
 
 This is basically enough; the integration becomes available once that command finishes successfully. Corresponding commands in data files are now processed correctly:
 
@@ -236,7 +235,7 @@ C:\NLedger>NLedger-cli.exe -f feat-value_py3.test reg
 ```
 You can find more information about Python integration settings (including troubleshooting recommendations) in `Manage Python Integration` section.
 
-In order to disable integration, you should run the same console and execute `disable` command.
+In order to disable integration, you should run the same console and execute `python-disable` command.
 
 > Hint: refer to Ledger documentation to find more examples how to use Python in Ledger data files. You can also check integration tests with "py" in names.
 
@@ -245,7 +244,7 @@ In order to disable integration, you should run the same console and execute `di
 Similarly to Python integration, .Net Ledger also supports integration with .Net code.
 When .Net Integration is enabled, you can specify which assembly to load and which function to use in data files.
 
-The example below illustrates how to call .Net function File.Exists() from a data file. You can find more examples in the folder with NLedger tests (nledger/test/nledger; files nl-baseline-net-*.test).
+The example below illustrates how to call .Net function File.Exists() from a data file. You can find more examples in the folder with NLedger tests (/test/nledger; files nl-baseline-net-*.test).
 
 ```
 import assemblies
@@ -270,22 +269,29 @@ There are three logical steps to make .Net Integration work:
 NLedger configuration setting ExtensionProvider specifies which extension will be used. If it is empty, all related directives in data files are inactive; 
 attempts to use them will lead to errors like *directive seen, but ... support is missing*. 
 
-For .Net integration, you should set this setting to `dotnet`. The simplest way to do so is to use Setup Console:
-- Run [Install Folder]/Contrib/NLManagement/NLSetup.Console.cmd (or corresponded menu shortcut if you installed MSI)
-- Type *set-setting ExtensionProvider dotnet -user*
+For .Net integration, you should set this setting to `dotnet`. The simplest way to do so is to use .Net Ledger Tools console:
+- Run [Install Folder]/Contrib/nledger-tools.cmd (or corresponded menu shortcut if you installed MSI)
+- Type *set-config ExtensionProvider dotnet*
 
 ```console
-NLedger Setup>set-setting ExtensionProvider dotnet -user
-[OK] Setting 'ExtensionProvider' is set to 'dotnet' (Scope 'user')
+PS>set-config ExtensionProvider dotnet
+
+Status  : Updated
+Setting : ExtensionProvider
+Value   : dotnet
+Scope   : user
 ```
 
-> Hint: you can use the command *show-details ExtensionProvider -allValues* to check whether the setting is properly set
+> Hint: you can use the command *show-config ExtensionProvider* to check whether the setting is properly set
 
 If you want to disable .Net integration, set an empty value to this setting:
 
 ```console
-NLedger Setup>remove-setting ExtensionProvider
-[OK] Setting 'ExtensionProvider' is removed (Scope 'user')
+PS>remove-config ExtensionProvider
+
+Status  : Removed
+Setting : ExtensionProvider
+Scope   : user
 ```
 
 #### Import .Net Assembly
@@ -349,28 +355,29 @@ namespace Sample
 ```
 > More information about how to develop with NLedger domain model you can find in [Development Notes](https://github.com/dmitry-merzlyakov/nledger/blob/master/build.md).
 
-### Setup Console
+### NLedger Configuration Management
 
 Basically, NLedger settings are available in its configuration file (NLedger-cli.exe.config for .Net Framework or NLedger-cli.dll.config for .Net Core); you can manually change them anytime. However, this approach is not generally recommended by two reasons:
 
 - If you make changes manually, you need strictly know the syntax of settings and available values;
-- For Windows, if is not a good approach to make any manual changes in *Program Files* folder.
+- For Windows, if NLedger is installed in Program Files, it is not a good approach to make any manual changes in that location.
 
-NLedger provides an alternative way to specify user settings on a machine without changing Program Files content:
+NLedger provides another way to manage user settings on a machine without changing configuration files manually. It includes:
 
-- It can read user settings from extra optional files that represent Common (for any user) and User (for an individual user) settings. 
-  They have the same format as the main config file;
-- It provides a helping test console that allows you to manage NLedger settings on your machine:
+- Reading settings from configuration files that represent Common scope (for any user on this machine), User scope (for a current user) and Application scope (application configuration file). Note: all these files have the same format as the app config file;
+- Managing NLedger settings on your machine:
 
-  - It shows help instructions;
   - It shows current options and their effective values (having in mind that the options might be overridden);
   - It allows to set an option value for both Common and User scope (and even for the app config).
 
-On Windows, you can run the tool by executing *NLedger/Contrib/NLManagement/NLSetup.Console.cmd*. Type "help" in the console for further information. Typically, you will use *show*, *set-setting*.
+All these actions are presented as `show-config`, `set-config` and `remove-config` commands in .Net Ledger Tools console.
+
+> .Net Ledger Tools console provides help for every command. Use `get-help [command]` for getting detail information.
+
+If you installed NLedger from MSI, .Net Ledger Tools console is available in the main menu. Otherwise, you can run the console directly:
 
-If you build NLedger from the sources, you can run the tool by the command:
 ```
-pwsh -file ./get-nledger-tools.ps1 -settings
+pwsh -file ./Contrib/nledger-tools.ps1 -noexit
 ```
 
 *Note: this tool requires Powershell*
@@ -382,17 +389,18 @@ but also allows to run all its examples in an interactive manner. You just selec
 so that you see the result in a command line console popup.
 
 You can also repeat the command, change command line arguments to see the result, change the file and run the command again. If you did something wrong in the file, 
-you can revert your changes and continue experimenting with it. So, it is some kind of a playground that let you learn NLedger features in easy and efficiemt way.
+you can revert your changes and continue experimenting with it. So, it is some kind of a playground that let you learn NLedger features in easy and efficient way.
 
-On Windows, you can run the console by executing *NLedger\Contrib\NLManagement\NLDoc.LiveDemo.WebConsole.cmd*.
-
-If you build NLedger from the sources, you can run the tool by the command:
+You can run the demo by means of .Net Ledger Tools console (`live-demo` command).
+You can also do it directly from the command line:
 ```
-pwsh -file ./get-nledger-tools.ps1 -demo
+pwsh -file ./Contrib/nledger-tools.ps1 live-demo
 ```
 
 Technically, it will run a powershell tool that starts http listener and runs your default browser.
-If you have any troubles with default HTTP settings (e.g. port number for HTTP listener) or you want to use another editor or browser - use Setup Console to customize Live Demo settings.
+If you have any troubles with default HTTP settings (e.g. port number for HTTP listener) or you want to use another editor or browser - check and customize Live Demo settings in .Net Ledger Tools console (use `show-config Demo` command).
+
+> For the demo, you need to install NLedger with `ledger` hard link
 
 *Note: this tool requires Powershell*
 
@@ -420,8 +428,8 @@ at all to get rid of artifacts in the output text.*
 
 Like the original application, NLedger has a special testing framework that executes Ledger-style test files
 and verifies that they pass well. It consists of two parts:
-- the folder *NLTestToolkit* has the testing runtime (PowerShell scripts that run tests);
-- the folder *test* that contain the original set of Ledger test files (baseline, input, manual and regress).
+- root files in the folder *test* have the testing runtime (PowerShell scripts that run tests);
+- subfolders in the folder *test* that contain the original set of Ledger test files (baseline, input, manual and regress).
  
 Main testing toolkit features are:
 
@@ -441,18 +449,11 @@ Main testing toolkit features are:
 
 ### Running Tests
 
-On Windows, you can open NLedger Testing Framework console by clicking on *NLTestToolkit\NLTest.cmd*. 
-
-If you build NLedger from the sources, you can run the tool by the command:
-```
-pwsh -file ./get-nledger-tools.ps1 -testConsole
-```
-
-The prompt will show you available commands and other recommendations. For example, simply type *run* and click *Enter* to execute 
-all test files that you have in *test* folder.
-
-*Note: typical time to execute all tests is about 1 minute in case you created native images and about 5 minutes
-otherwise.*
+Run .Net Ledger Tools console and use the command `test`. Basic capabilities are:
+- Run all tests (`test` command without parameters)
+- Run tests filtered by name (`test py` command will run tests that have `py` in the name)
+- Run tests and create an html report (`test -report` command)
+- Run tests using a specific binary file (`test -tfmCode net6.0` will run tests for `net6.0` binaries even if another target is currently installed)
 
 ### Creating Tests
 
@@ -556,11 +557,11 @@ in order to speed up Python runtime: it can cache parsed code in `__pycache__` s
 > If the file NLedger.Extensibility.Python.settings.xml does not exist by the expected path, the integration is considered to be disabled even though `ExtensionProvider` setting contains `python` value.
 
 Changing the configuration settings manually is possible, but not recommended due to the complexity and potential for error. 
-You may consider using Python ToolSet script that can make these changes automatically (see the next section).
+You may consider using .Net Ledger Tools console and `python-*`commands to make these changes automatically (see the next section).
 
-### Python ToolSet helper script
+### Python Management Commands
 
-The Python ToolSet is a Powershell script that was designed to simplify setting up a local environment for .Net Ledger Python integration.
+.Net Ledger Tools console provides a collection of `python-*` commands designed to simplify setting up a local environment for .Net Ledger Python integration.
 It basically covers the following activities:
 - Quick environment setup for .Net Ledger Python integration or .Net Ledger build
 - Discovering local environment settings (primarily local Python deployments) 
@@ -569,25 +570,9 @@ It basically covers the following activities:
 - Installing and managing required Python modules
 - Installing and testing .Net Ledger Python module
 
-The script is basically designed to work in [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) mode in an interactive console, 
-but you can also call commands from the command line.
-
-You can run the script by means of the following commands (Windows):
-```console
->PowerShell -ExecutionPolicy RemoteSigned -File ./get-nledger-tools.ps1 -pythonTools
-```
-or Linux:
-```console
-$pwsh ./get-nledger-tools.ps1 -pythonTools
-```
-Another way is to run /Contrib/Python/GetPythonEnvironment.ps1 file. Windows users can execute (/Contrib/Python/GetPythonEnvironment.Console.cmd).
-People who installed MSI, can simply run the corresponded menu shortcut.
-
-> The the script runs, it shows a list of available commands. You can get a quick help for every command by typing `get-help [command]`
+The console provides the following features:
 
-The script provides the following features:
-
-- `discover` shows you local Python deployments. It checks PATH variable, the folder with embedded Python deployments and checks what is installed by the path specified in 
+- `python-discover` shows you local Python deployments. It checks PATH variable, the folder with embedded Python deployments and checks what is installed by the path specified in 
   NLedger.Extensibility.Python.settings.xml. If you have a local Python in another location, you can check it by adding `-path [PATH]` argument.
 
   What you can check in the output: Python version (it should be in the expected range), Python platform (`x64` is mainly expected), 
@@ -595,40 +580,39 @@ The script provides the following features:
   `wheel` version (you should install it if you want to build .Net Ledger Python module: connect this Python and use `install-wheel`),
   `pythonnet` version (you should install it if you want to test .Net Ledger Python module: connect this Python and use `install-pythonnet`. Refer to the module's Readme if you have issues with this step).
 
-- `status` shows you your current integration status. It basically checks whether the file NLedger.Extensibility.Python.settings.xml exists and has valid content.
+- `python-status` shows you your current integration status. It basically checks whether the file NLedger.Extensibility.Python.settings.xml exists and has valid content.
   Also, it checks that the Python extension provider is enabled. If you see both checks passed, then your Python integration should work as expected.
 
   Another use of this command is to check the expected location of the configuration file, path to connected Python deployment and
   whether PythonNet and Ledger modules are installed on that deployment.
 
-- `connect` creates or updates the connection file NLedger.Extensibility.Python.settings.xml.
+- `python-connect` creates or updates the connection file NLedger.Extensibility.Python.settings.xml.
   If you run this command with no parameters, it will search for Python deployment by PATH and use it if successful.
   Otherwise, on Windows, it will download and install the embedded Python 3.8.1. Eventually, it will create or update the connection configuration file.
 
   If you want to connect to a specific local Python deployment, add `-path [PATH]` argument. 
   If you want to connect to a specific version of the embedded Python, add `-embed [N.N.N]` argument where the numbers are a three-digit Python version. 
-  Notice that if the connection file already exists, it will try to use the specified there deployment. Execute `disconnect` before this command to make it work by default sequence.
+  Notice that if the connection file already exists, it will try to use the specified there deployment. Execute `python-disconnect` before this command to make it work by default sequence.
 
-  You can execute `status` after this command to check that the connection is created as expected.
+  You can execute `python-status` after this command to check that the connection is created as expected.
 
-- `enable` turns on the Python extension provider in .Net Ledger settings. Basically, it sets `python` value to `ExtensionProvider` parameter.
-  An important feature of this command is that it also runs the `connect` command before it, so you can get a fully configured environment by simply executing `enable`. 
+- `python-enable` turns on the Python extension provider in .Net Ledger settings. Basically, it sets `python` value to `ExtensionProvider` parameter.
+  An important feature of this command is that it also runs the `python-connect` command before it, so you can get a fully configured environment by simply executing `python-enable`. 
 
-  Notice that it changes `ExtensionProvider` setting on user level that implies it updates `\NLedger\user.config` file. Settings on the application level can override it.
-  Use NLManagement/NLSetup.Console.ps1 console (command "show-details ExtensionProvider -allValues") to check this point in case of issues.
+  Notice that it changes `ExtensionProvider` setting on user level that implies it updates `\NLedger\user.config` file. Settings on the application level can override it. Use `show-config ExtensionProvider` command to check this point in case of any issues.
 
-  You can execute `status` after this command to check that the provider is enabled as expected.
+  You can execute `python-status` after this command to check that the provider is enabled as expected.
 
-- `disable` turns off the Python extension provider by placing an empty value in the `ExtensionProvider` parameter.
+- `python-disable` turns off the Python extension provider by placing an empty value in the `ExtensionProvider` parameter.
 
-- `disconnect` removes the current connection file NLedger.Extensibility.Python.settings.xml.
+- `python-disconnect` removes the current connection file NLedger.Extensibility.Python.settings.xml.
 
 There are additional auxiliary commands that help to manage the local environment:
 
-- `install-python` and `uninstall-python` install and remove embedded Python deployments. 
+- `python-install` and `python-uninstall` install and remove embedded Python deployments. 
   You may specify `-version [N.N.N]` argument to specify a three-digit version of Python that you want to install or remove.
 
-- `install-pythonnet` and `uninstall-pythonnet` install and remove PythonNet module on the connected Python. 
+- `python-install-pythonnet` and `python-uninstall-pythonnet` install and remove PythonNet module on the connected Python. 
   By default, it installs the public release from PyPi (PythonNet 2.5.2). 
   If it does not work (for example, for Python 3.9 or later), you may try to install pre-release version of PythonNet 3. In this case, add `-pre` switch to the command.
   This command re-installs PythonNet, so that it will uninstall a previous version if it installed.
@@ -636,116 +620,116 @@ There are additional auxiliary commands that help to manage the local environmen
   Note: Installing PythonNet might require additional steps on some environments. Please, refer to Troubleshooting section in 
   the Ledger module's [Readme](https://github.com/dmitry-merzlyakov/nledger/blob/master/Source/NLedger.Extensibility.Python.Module/README.md) to get more information.
 
-- `install-ledger` and `uninstall-ledger` install and remove .Net Ledger Python module on the connected Python. 
+- `python-install-ledger` and `python-uninstall-ledger` install and remove .Net Ledger Python module on the connected Python. 
   The module should exists in /Contrib/Python/ folder (it is important if you build .Net Ledger from source code, so finish the build first). 
   Installing Ledger module requires PythonNet, so try to install it before if you have problems with this command.
   
-- `test-ledger` runs Python unit tests for the installed .Net Ledger Python module.
+- `python-test-ledger` runs Python unit tests for the installed .Net Ledger Python module.
 
-- `test-wheel` installs "wheel" module on the connected Python if it has not been installed yet. No changes otherwise.
+- `python-install-wheel` installs "wheel" module on the connected Python if it has not been installed yet. No changes otherwise.
 
 ### Best Practices
 
 Here is a list of best practices for setting up your environment for specific cases. You can find your case in the list and follow recommendations.
 
 - I installed .Net Ledger from MSI (or pre-built binaries) and now I want to enable Python integration:
-  - Open Python ToolSet console
-  - Execute `enable`
-  - In case of any errors - execute `connect` and troubleshoot the issue. On Windows, you can try `connect -embed 3.8.1` to force installing the isolated embedded Python.
-  - Execute `status` and see that both checks are Green now
+  - Open .Net Ledger Tools console
+  - Execute `python-enable`
+  - In case of any errors - execute `python-connect` and troubleshoot the issue. On Windows, you can try `connect -embed 3.8.1` to force installing the isolated embedded Python.
+  - Execute `python-status` and see that both checks are Green now
 
 - I downloaded .Net Ledger sources and I want to build it from source code:
   - Open Python ToolSet console
-  - Execute `connect`
-  - In case of any errors - troubleshoot the issue. On Windows, you can try `connect -embed 3.8.1` to force installing the isolated embedded Python.
-  - Execute `status` and see that `Python Connection` check is Green (the second one is expectable Red)
-  - Execute `install-wheel`
+  - Execute `python-connect`
+  - In case of any errors - troubleshoot the issue. On Windows, you can try `python-connect -embed 3.8.1` to force installing the isolated embedded Python.
+  - Execute `python-status` and see that `Python Connection` check is Green (the second one is expectable Red)
+  - Execute `python-install-wheel`
   - Run build. Note: .Net Ledger Python module will not be tested
 
 - I downloaded .Net Ledger sources and I want to build it from source code including proper testing of .Net Ledger Python module:
   - Open Python ToolSet console
-  - Execute `connect`
-  - In case of any errors - troubleshoot the issue. On Windows, you can try `connect -embed 3.8.1` to force installing the isolated embedded Python.
-  - Execute `status` and see that `Python Connection` check is Green (the second one is expectable Red)
-  - Execute `install-wheel`
-  - Execute `install-pythonnet`. In case of issues, try `install-pythonnet -pre` or troubleshoot and install PythonNet manually.
+  - Execute `python-connect`
+  - In case of any errors - troubleshoot the issue. On Windows, you can try `python-connect -embed 3.8.1` to force installing the isolated embedded Python.
+  - Execute `python-status` and see that `Python Connection` check is Green (the second one is expectable Red)
+  - Execute `python-install-wheel`
+  - Execute `python-install-pythonnet`. In case of issues, try `python-install-pythonnet -pre` or troubleshoot and install PythonNet manually.
   - Run build. No errors and no warnings expected.
 
 - I have a local Python but I want to connect to an isolated embedded Python with a specific version:
   - Open Python ToolSet console
-  - Execute `connect -embed [N.N.N]` where `[N.N.N]` is a three-digit Python version
-  - Execute `enable`
-  - Execute `status` and see that both checks are Green
+  - Execute `python-connect -embed [N.N.N]` where `[N.N.N]` is a three-digit Python version
+  - Execute `python-enable`
+  - Execute `python-status` and see that both checks are Green
 
 - I have a local Python but its folder is not listed in PATH. I want to use it.
   - Open Python ToolSet console
-  - Execute `discover -path [PATH]` where `[PATH]` is a full path to your Python executable file. Example:
+  - Execute `python-discover -path [PATH]` where `[PATH]` is a full path to your Python executable file. Example:
     - *discover -path C:\Users\dmitry\AppData\Local\NLedger\python-3.9.2-embed-amd64\python.exe*
   - Verify that your Python matches integration requirements (3.6.1 or later, x64, pip is installed)
-  - Execute `connect -path [PATH]`
-  - Execute `enable`
-  - Execute `status` and see that both checks are Green
+  - Execute `python-connect -path [PATH]`
+  - Execute `python-enable`
+  - Execute `python-status` and see that both checks are Green
 
 - My connection is configured but I want to use another Python
   - Open Python ToolSet console
-  - Execute `disconnect`
-  - Execute `connect NNN` where NNN are your preferences (none or `path` or `embed`)
-  - Execute `status` and see that you are connected to preferred Python now
+  - Execute `python-disconnect`
+  - Execute `python-connect NNN` where NNN are your preferences (none or `path` or `embed`)
+  - Execute `python-status` and see that you are connected to preferred Python now
 
 - Python integration is enabled on my machine. I want to install and use .Net Ledger Python module
   - Make sure that the `ledger-0.8.N-py3-none-any.whl` file exists in `/Contrib/Python/` folder.
   - Open Python ToolSet console
-  - Execute `status` and make sure that `PythonNet Module` is installed. Execute `install-pythonnet` otherwise (additional actions might be required)
-  - Execute `install-ledger`
-  - Execute `status` and make sure that `Ledger Module` shows a valid version
-  - Execute `test-ledger` (no errors expected)
-  - Execute `status`, copy `Python Executable` value and run it in a command line
+  - Execute `python-status` and make sure that `PythonNet Module` is installed. Execute `python-install-pythonnet` otherwise (additional actions might be required)
+  - Execute `python-install-ledger`
+  - Execute `python-status` and make sure that `Ledger Module` shows a valid version
+  - Execute `python-test-ledger` (no errors expected)
+  - Execute `python-status`, copy `Python Executable` value and run it in a command line
   - Type `import ledger` in the Python console
 
 - I do not know whether I have a local Python
   - Open Python ToolSet console
-  - Execute `discover`
+  - Execute `python-discover`
   - See what you have in the output:
     - `[Local Python]` refers to a local Python available by PATH
     - `[Embed Python]` contains a list of embedded Pythons in NLedger folder (Windows only)
     - `[NLedger Settings]` shows what is currently specified in the connection file (if exists)
-  - If a local Python found, the command `connect` will use it. Otherwise, `connect` will install an embedded Python (Windows only).
+  - If a local Python found, the command `python-connect` will use it. Otherwise, `python-connect` will install an embedded Python (Windows only).
     On other OS, you should install Python and repeat.
 
 - I do not want to use Python integration anymore:
   - Open Python ToolSet console
-  - Execute `disable`. It will remove `ExtensionProvider` setting, so .Net Ledger will not use Python extension.
-  - Execute `disconnect`. It will disable Python feature for the build process (Python-related tests are ignored; Python module is not built) and for integration tests.
-  - Execute `status` and see that both checks are Red now
+  - Execute `python-disable`. It will remove `ExtensionProvider` setting, so .Net Ledger will not use Python extension.
+  - Execute `python-disconnect`. It will disable Python feature for the build process (Python-related tests are ignored; Python module is not built) and for integration tests.
+  - Execute `python-status` and see that both checks are Red now
   - Note: if you run the build with disabled Python integration, you will see warnings. Add `-noPython` flag to suppress them (*get-nledger-up.ps1 -noPython*)
 
 ### Troubleshooting
 
 Here is a list of guidelines that can be helpful in troubleshooting Python integration issues. Please, follow it if you have problems.
 
-1) Open Python ToolSet console, execute `status` and make sure that both checks (`Python Connection` and `Python Extension`) indicate that they are `[Enabled]`.
+1) Open Python ToolSet console, execute `python-status` and make sure that both checks (`Python Connection` and `Python Extension`) indicate that they are `[Enabled]`.
    Take corrective actions if one of them is not enabled.
-2) Make sure that .Net Ledger configuration setting returns a valid effective value `python`. Run `NLSetup.Console` and execute `show-details ExtensionProvider -allValues`.
+2) Make sure that .Net Ledger configuration setting returns a valid effective value `python`. Run .Net Ledger Tools and execute `show-config ExtensionProvider`.
    Check that `Effective Value` returns `python`. Take corrective actions otherwise.
 3) Check Python version and make sure that the connected Python is 64-bit (assuming that your .Net Ledger runs as 64-bit process as well).
    - Open Python ToolSet console
-   - Execute `status` and copy `Python Executable`
-   - Execute `discover -path [Python Executable]`
+   - Execute `python-status` and copy `Python Executable`
+   - Execute `python-discover -path [Python Executable]`
    - Check that you have a valid output (no error messages). Troubleshoot the issue otherwise
    - Check that `Python Version` is in valid range (3.6.1 or later)
    - Check that `Python Platform` is `x64`
    - Check that `Pip` is installed; install it otherwise
 4) Check that the connection file contains valid values
    - Open Python ToolSet console
-   - Execute `status` and note the path `Connection Settings`
+   - Execute `python-status` and note the path `Connection Settings`
    - Open this file in any text editor and check that both values (`py-executable` and `py-dll`) point at valid files. At least, they should physically exist
 5) If you use a local Python and cannot localize a problem, try to use an isolated embedded Python (Windows only):
    - Open Python ToolSet console
-   - Execute `connect -embed 3.8.1` (ot whatever Python version you prefer)
+   - Execute `python-connect -embed 3.8.1` (ot whatever Python version you prefer)
 
 You can request additional help by posting an issue on GitHub.
 
-## NLedger Configuration File
+## NLedger Configuration File Settings
 
 As a regular .Net application, NLedger command line utility has the own configuration file: *NLedger-cli.exe.config* (*NLedger-cli.dll.config* for Core application).
 It contains several options that are specific for .Net product and Windows environment.
@@ -782,4 +766,4 @@ Available configuration options are:
 by means of environment variables. It checks the variables with the same names and with the prefix "nledger":
 nledgerIsAtty, nledgerAnsiTerminalEmulation, nledgerOutputEncoding and nledgerTimeZoneId.*
 
-(c) 2017-2021 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
\ No newline at end of file
+(c) 2017-2023 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
\ No newline at end of file
diff --git a/roadmap.md b/roadmap.md
index 13284a52..dabf5a07 100644
--- a/roadmap.md
+++ b/roadmap.md
@@ -41,7 +41,7 @@ This is a roadmap for development of next NLedger releases.
   - migration from MSTest to xUnits;
   - generating and verification .Net Framework 4.5, .Net Standard 2.0 and .Net Core 3.1 binaries;
   - multi-platform capabilities: build, testing and functioning on Windows, Linux and OSX;
-- [Complete] Bug fixing (GH#2, GH#7);
+- [Complete] Bug fixing (GH #2, GH #7);
 
 ## NLedger 0.9
 
@@ -52,13 +52,14 @@ This is a roadmap for development of next NLedger releases.
 - [Complete] Create Python extension that allows to extend Ledger data files with Python functions
 - [Complete] Create .Net Ledger Python module that provides access to Ledger domain objects in a Python interpreter session
 - [Complete] Code completion: enable Ledger tests that require Python integration;
-- Create Powershell extension that allows to extend Ledger data files with Powershell functions
-- Bug fixing: solve issues with .Net date parser error messages; 
-  consider creating an own date parser; enable corresponded Ledger unit and integration tests;
-- Bug fixing: solve issues with file names in error messages (absolute vs relative); 
-  simplify corresponded Ledger integration tests;
-- Update the source code and tests to the latest Ledger version (branch NEXT);
-- Add a build profile that supports .Net 5
+- [Complete] Added support for multi-target deployment; migrating solution to LTS .Net versions (.Net Framework 4.8, .Net 6.0, .Net 8.0) GH #32
+- [Complete] Reorganizing Powershell helper scripts; created a common .Net Ledger Tools management console
+- [Complete] Bug fixing (GH #24 #25 #26 #29)
+- Update the source code and tests to the latest Ledger version (branch NEXT)
+- Update Python Extension to support PythonNet 3.0.3 (NLedger binary and Python module)
+- Code completion: cover Powershell scripts by Pester tests and include them into the Release build
+- Migrate NLedger Release build from Azure to GitHub Actions; upgrade WiX project
+- Reorganize NLedger documentation
 
 ## NLedger 1.0
 
@@ -69,6 +70,9 @@ This is a roadmap for development of next NLedger releases.
   verify and process Ledger methods *gettext_*, *throw_*;
 - Code optimization (analyze efficient of *lookup* implementation and other critical places);
 - General performance analyzing and optimization;
+- Code completion: solve issues with .Net date parser error messages; 
+  consider creating an own date parser; enable corresponded Ledger unit and integration tests;
+- Code completion: revisit and manage postponed improvements listed in ProductInfo.xml
 - Code stabilization and bug fixing;
 
 ## Further Enhancements
@@ -78,7 +82,8 @@ This is a roadmap for development of next NLedger releases.
 - Enhancement (Service API): add support of semantical tokenization for NLedger output;
 - Enhancement (Service API): add auxiliary classes that help to build textual Ledger commands programmatically;
 - Enhancement (Service API): add auxiliary classes that can render Ledger Journal from a Journal object instance
-- Code completion: add integrated pager; add complete support of external pagers;
-  solve issues with colorization; simulate "cat" pager and enable corresponded Ledger test;
+- Code completion: add integrated pager; add complete support of external pagers
+- Create Powershell extension that allows to extend Ledger data files with Powershell functions
+
 
-(c) 2017-2021 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)
+(c) 2017-2023 [Dmitry Merzlyakov](mailto:dmitry.merzlyakov@gmail.com)