fsprojects / Argu

A declarative CLI argument parser for F#
https://fsprojects.github.io/Argu
MIT License
453 stars 75 forks source link

ChatGpt4 proposed Argu, but as an ocaml developer, it is really hard to understand the ParseResults<Args> part #182

Closed mattiasw2 closed 1 year ago

mattiasw2 commented 1 year ago

Description

The following code doesn't compile at "Ok args", and when I look at the test cases or documentation, I cannot find the definition of the union type, plz help.

ChatGpt4 proposed Argu, but as an ocaml developer, it is really hard to understand the f# code for ParseResults :-)

let main argv =
    let parser = ArgumentParser.Create<Args>(programName = "merge_cs_files")
    let result = parser.ParseCommandLine argv
    match result with
    | Ok args ->
        match args with
        | Args.Main (dirPath, output, ignorePattern) ->
            let pattern = Regex(ignorePattern)
            let files = collectFiles dirPath pattern |> Seq.toList
            mergeFiles files output
            0
        | _ -> printfn "%s" (parser.Usage()); 1
    | Error err -> printfn "%A" err; 1
eiriktsarpalis commented 1 year ago

Seriously? I would recommend filing an issue with OpenAI, they might know :laughing:

mattiasw2 commented 1 year ago

I was semi-serious. I looked at the docs, and at the code, and I cannot find any information on what I should do instead of matching on Ok and Error, since it seems the implementation changed since the code was written. I see a lot of samples of ParseCommandLine, but I do not see an example how to get the args.

However, since chatgpt4 selected your package as a first choice, maybe you should use this as a chance for some promotion of your work. Like, you could write something like " chatgpt proposes this, and plz change it to this and it will work."

eiriktsarpalis commented 1 year ago

Docs are not very extensive, but this section should give you a rough idea on how parse results are meant to be consumed.

However, since chatgpt4 selected your package as a first choice, maybe you should use this as a chance for some promotion of your work. Like, you could write something like " chatgpt proposes this, and plz change it to this and it will work."

I'm sure the training set goes beyond just the official documentation. You could try writing down the actual code that worked for you here, I'm sure it would be used in future training sets.