foundry icon indicating copy to clipboard operation
foundry copied to clipboard

writeToml should keep original formatting

Open Thegaram opened this issue 9 months ago • 0 comments

Component

Forge

Describe the feature you would like

Current behavior

Toml file:

key1 = "1"

# this is key2
key2 = "2"

Script:

// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.8.24;

import {Script, console} from "forge-std/Script.sol";

contract TomlTest is Script {
    function run() public {
        vm.writeToml("abcd", "test.toml", ".key2");
    }
}

Resulting toml file, after running forge script scripts/foundry/TomlTest.s.sol:TomlTest:

key1 = "1"
key2 = "abcd"

Desired behavior

writeToml should maintain the original formatting (line breaks, comments):

key1 = "1"

# this is key2
key2 = "abcd"

Additional context

No response

Thegaram avatar Apr 27 '24 11:04 Thegaram