trycmd icon indicating copy to clipboard operation
trycmd copied to clipboard

Code fence parser misses indentation

Open jayvdb opened this issue 2 years ago • 4 comments

In https://github.com/Electron100/butane/commit/c5761ccd9b1e5716a867e746b95d59a7e4f8ddd7 I attempted to set up trycmd on some existing .md files. I only got "ignored", so I added "debug" feature (not mentioned in this projects README.md), and still there is no reason given. I guess it is something path related, and I'll be able to figure it out, but this should be in the debug logs at least, and IMO if a .case(..) is explicitly specified in the .rs, and trycmd couldnt find anything runnable in the file(s) mentioned, then it is an error.

     Running tests/cli_tests.rs (/home/jayvdb/rust/butane/target/debug/deps/cli_tests-41b60687d15705c6)

running 1 test
[              trycmd::runner] 	Case: Ok(
    Output {
        path: "../examples/getting_started/README.md",
        id: None,
        spawn: Spawn {
            exit: None,
            status: Skipped,
        },
        stdout: None,
        stderr: None,
        fs: Filesystem {
            context: [],
        },
    },
)
Testing ../examples/getting_started/README.md ... ignored
[              trycmd::runner] 	Case: Ok(
    Output {
        path: "../example/README.md",
        id: None,
        spawn: Spawn {
            exit: None,
            status: Skipped,
        },
        stdout: None,
        stderr: None,
        fs: Filesystem {
            context: [],
        },
    },
)
Testing ../example/README.md ... ignored
test cli_tests ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

jayvdb avatar Jul 29 '23 03:07 jayvdb

this doesnt appear to be https://github.com/assert-rs/trycmd/issues/105 , as the bin="xxx" not found is missing from my output

jayvdb avatar Jul 29 '23 03:07 jayvdb

It looks like the problem is the .md parser doesnt like indented blocks.

jayvdb avatar Jul 29 '23 04:07 jayvdb

Yes, our code fence parser is very minimal

epage avatar Jul 31 '23 22:07 epage

Indentation parsing gets complicated because it means we have to handle correctly indenting / de-indenting the contents too, especially with TRYCMD=overwrite.

For that reason, I'm tempted to not support indented code fences but I think we should at least report the code fences exist in a way so people know whats happening

epage avatar Jul 31 '23 22:07 epage