Comments (6)
I'd be in favor of implementing something like that, but the design certainly needs polish.
Why not just use interfaces, i.e.
type ICustomParser = interface end
type ICustomParser<'T> =
inherit ICustomPrimitive
abstract Parse : string -> 'T
abstract UnParse : 'T -> string
Then just have the argparser take a list of the base interface. The UnParse
implementation is needed in order to fully support the PrintCommandLine method. Thoughts?
from argu.
I used string
for the unparse
in
let inline mkComplexParser< ^a when ^a:(static member Parse:string -> ^a)>() =
(typeof< ^a>, ParserInfo.Create< ^a> (typeof< ^a>.Name) (fun str ->
(^a:(static member Parse:string -> ^a) str)) string)
I used the static method for parse as it seemed like that was the common contract you were already using, and there are a bunch of other types (Guids, Uids, TimeSpans, IP Addresses, enums, etc) that share that signature.
If you've going to deviate from that I think you should go even further and make parser combinators. At the very least to support verbs and subparsers, they're the most important feature Argu is missing. Ideally the functionality of the combinators could extend into formatting transformations, different modes of execution, more nuanced help displays, color modulation, minor animation, etc. (or maybe I love FParsec a bit too much)
Are you open to supporting file formats besides XML for config files? It'd to be able to use Argu with Toml configs..
Just out of curiosity, do you think it'd be feasible to modify Argu so that it could generate a CLI for cmd as well as a posh (powershell) cmdlet with similar usage conventions? I'm not in love with posh, but I don't mind writing out cmdlets in F#, and it might be fun to use on some Nano Servers.
I'm down to help you take the implementation/functionality as far as you want to run with it.
from argu.
There are many features missing from Argu and the codebase is arguably stale. I'm currently not very motivated in contributing improvements to the library, so I'd be positive to someone else taking over development. Perhaps this would be facilitated by a move to fsprojects.
from argu.
probably, I've talked to a bunch of people who were interested in it, but wished it had a fuller feature set.
from argu.
@eiriktsarpalis have you decided whether you want to move it to fsprojects?
from argu.
Yeah, we're up for it. We just need to find a couple of maintainer outside of nessos and make the move.
from argu.
Related Issues (20)
- Case insensitivity of command options names HOT 1
- Seems like Argu not works on Fsi 11.0.0.0 for F# 5.0 (VS preview 16.8.0 Preview 3.2) HOT 2
- Consistent handling of numeric decimal separators using invariant culture
- Support union names without underscores HOT 2
- Integration with IConfiguration HOT 9
- feat: subcommand specific help header? HOT 3
- Subcommands without options HOT 4
- Feature idea - Helper function for subcommand field
- Release? HOT 2
- Query: Command line argument character (I.E. "--", "/") HOT 2
- Question: attribute or possibility to customize casing of commands? HOT 2
- How to add an optional boolean flag? HOT 5
- appsetting.json and NET5 HOT 9
- `-h` short option for `--help` HOT 2
- Empty usage prevents line breaks between options HOT 1
- Expose ArguParseException or similar for use within apps HOT 2
- [Query] Is .net7 support for trimmed binaries planned? HOT 3
- ChatGpt4 proposed Argu, but as an ocaml developer, it is really hard to understand the ParseResults<Args> part HOT 3
- Make a main command optional in subcommand
- Have a positional argument as optional with main command HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argu.