F# projects here:
showperms
– a simple CLI utility, using F# for maximum readabiiltyshowpermsOld
– more complicated and irregular (but it’s shorter! and less readable!)DiffResults
– test results rendered as a diff
Usage looks like this:
Z% showperms notFound testDir
Error: notFound – No such file or directory
drwxr-xr-x testDir/
drwxr-xr-x testDir/1d/
drwxr-xr-x testDir/2d/
-rw-r--r-- testDir/2d/1f
drwxr-xr-x testDir/2d/2d/
-rwxr-xr-x testDir/2d/3f
---------- testDir/2d/4f
dr-------- testDir/3d/
testDir/3d/1d
testDir/3d/2f
d--------- ! testDir/4d/
A shebang form is provided: showperms.fsx
Rider IDE files included.
Run createTestData.bash
to create a testDir/
folder hierarchy.
Depends on NuGet packages:
I have tried publishing a self-containd binary for osx-x64. It runs but not if copied to /usr/local/bin/. See stackoverflow.
Earlier version, not taking full advantage of F#. Shorter but more complicated and irregular.
Instead of an assert for each fact, where you see only the first error, using the DiffResults library, you see a line for each fact, shown as a diff of expected vs actual, like the first column of this table:
diff expected actual
–––––– –––––––– ––––––
x not what not
what where what
√ where why but
x but when why
why [newline after when] [no newline after why]
√ when
√
Key:
x = wrong: found in expected; is not in actual
√ = right: not found in expected; is in actual
Depends on the DiffPlex
NuGet package