docs
This commit is contained in:
parent
bbeb9e1540
commit
d5537d3448
6 changed files with 20 additions and 11 deletions
7
Makefile
7
Makefile
|
@ -5,3 +5,10 @@ test_reports:
|
|||
dotnet test --collect "XPlat Code Coverage" --results-directory /tmp/pentole_reports/
|
||||
mv /tmp/pentole_reports/*/coverage.cobertura.xml .
|
||||
reportgenerator -targetdir:coverlet/reports -reporttypes:HtmlInline_AzurePipelines -reports:coverage.cobertura.xml
|
||||
|
||||
|
||||
clean:
|
||||
rm Pentole/bin Pentole/obj tests/bin tests/obj -fr
|
||||
|
||||
docs: test
|
||||
fsdocs build --output pentole
|
||||
|
|
|
@ -4,12 +4,13 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageId>Pentole</PackageId>
|
||||
<Version>0.0.1</Version>
|
||||
<Version>0.0.3</Version>
|
||||
<Authors>Francesco Mecca</Authors>
|
||||
<Company>Bugless24</Company>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="logginghelpers.fs" />
|
||||
<Compile Include="binaryprefix.fs" />
|
||||
<Compile Include="pervasives.fs" />
|
||||
<Compile Include="string.fs" />
|
||||
|
@ -22,6 +23,9 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nunit" Version="4.2.1" />
|
||||
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -16,7 +16,7 @@ let realpath (path: string) =
|
|||
if ptr = IntPtr.Zero then
|
||||
let errno = Marshal.GetLastWin32Error()
|
||||
let error = Marshal.PtrToStringAuto(_strerror errno)
|
||||
Error $"realpath failed: {error} ({errno})"
|
||||
Error $"realpath failed: {error} ({errno}), path={path}"
|
||||
else
|
||||
let result = Marshal.PtrToStringAuto ptr
|
||||
Marshal.FreeHGlobal ptr
|
||||
|
|
|
@ -110,9 +110,9 @@ let is_normalized (path_: Path) =
|
|||
|
||||
// impure functions
|
||||
// https://docs.python.org/3.8/library/pathlib.html
|
||||
|
||||
let resolve = function
|
||||
| Absolute path ->
|
||||
Native.realpath path |> Result.map Path.of_string
|
||||
| Relative path ->
|
||||
Native.realpath path |> Result.map Path.of_string
|
||||
module FileSystem =
|
||||
let resolve = function
|
||||
| Absolute path ->
|
||||
Native.realpath path |> Result.bind Path.of_string
|
||||
| Relative path ->
|
||||
Native.realpath path |> Result.bind Path.of_string
|
||||
|
|
|
@ -3,14 +3,12 @@ module Pentole.Pervasives
|
|||
/// <summary>
|
||||
/// The identity function.
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
let identity = id
|
||||
|
||||
/// <summary>
|
||||
/// Pass the object to a function and return the object unchanged.
|
||||
/// Useful in the middle of pipelines to see what values are being passed or log
|
||||
/// </summary>
|
||||
/// <xparam name="x"></param>
|
||||
let tee fun_ obj =
|
||||
fun_ obj
|
||||
obj
|
||||
|
|
|
@ -41,7 +41,7 @@ let resolve_test () =
|
|||
let test (s:string) =
|
||||
s
|
||||
|> Path.of_string
|
||||
|> Result.bind resolve
|
||||
|> Result.map FileSystem.resolve
|
||||
|> Result.get
|
||||
let p (n: string ) = Path.of_string n |> Result.get
|
||||
|
||||
|
|
Loading…
Reference in a new issue