-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I created a little project to showcase my problem, I wanted to use your package to check if some flags are being sent and ignored by the tool I was making and got an unexpected result
package main
import (
"fmt"
"os"
"log"
"github.com/fred1268/go-clap/clap"
)
type exampleStruct struct{
ExampleValue string `clap:"--sad"`
}
func main(){
args := os.Args[1:]
fmt.Println(args)
app := new(exampleStruct)
results, err := clap.Parse(args, app)
if err != nil {
// results contains a list of arguments in error
// can be used for user friendly error handling
log.Fatal(err)
}
fmt.Println("has warnings ", results.HasWarnings())
fmt.Println("has errors ", results.HasErrors())
fmt.Printf("ignored fields: %v\n", results.Ignored)
fmt.Printf("missing fields: %v\n", results.Missing)
fmt.Printf("unex fields: %v\n", results.Unexpected)
fmt.Printf("duped fields: %v\n", results.Duplicated)
fmt.Printf("manda fields: %v\n", results.Mandatory)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels