Conversation
|
I see your intent, but IMO, I think this is easier to understand: option<DirectoryInfo> "directory"
|> desc description
|> aliases aliases
|> editOption (fun o ->
tryGetDefaultValue "section1:directory"
|> Option.iter (fun dir -> o.DefaultValueFactory <- fun _ -> dir)
)
|> validateDirectoryExistsBut if you're doing a lot of those operations, I can see how the helper function would be useful. Also, I know it's just an example, but one other small note: |
|
I'll follow your advice and create a library holding extensions to With regard to
So, it looks like |
|
Interesting, and good to know! The S.CL XML docs do not go into that much detail about the behavior. Perhaps I should add that to the |
I typically use both
argvandappsettings.json(this provides default values). If the value is not found inargvI then look atappsettings.jsonand use the default (if it exists). Based on existing code, I've createddefaultValueMaybethat will apply a default value if one exists.Please note that I've removed additional code that is not relevant.