ipfs / ipfs/go-ipfs-cmds

Reliable argument handling

Open
#76 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
52
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Currently, we allow users to mix optional, variadic, and required arguments. In order of preference:

1. make this impossible (see below)
2. check at start
3. check when calling the command

We currently do *none* of these. Instead, we have some weird logic in CheckArguments where we stop filling in optional arguments once we realize we'll need the rest to fill in required arguments.

---

Preferred solution:

```go
type Command struct {
Arguments Arguments
// ...
}

type Arguments struct {
Required []Argument
Optional []Argument
Variadic Argument
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.