carpentry-org / carpentry-org/clig

Short flags throw error

Open
#1 1 comment 0 reactions 1 assignee Claimed by @scolsen View on GitHub
bug
Dominant language
No language data
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Tested with the following program pieced together from the README:

```clojure
(load "git@github.com:carpentry-org/clig@main")

(def p (Clig.new @"my-program" @"doesn't do anything interesting"))

(def my-bool-flag (Clig.bool-flag @"force"
(Maybe.Just @"b")
@"false"
@"abandon all safety"))
(def my-int-flag (Clig.int-flag @"count"
(Maybe.Nothing)
@"1"
@"repeat n times"))

(defn main []
(do (Clig.add-flag &p &my-bool-flag)
(Clig.add-flag &p &my-int-flag)
(match (Clig.parse &p true)
(Result.Error err) (IO.println &(str err))
(Result.Success _)
(IO.println "hi")
)))
```

Unfortunately, when trying to provide the program with the short flag `b`, I get the following output:
```
unknown flag force
```

This seems to only happen with short flags.

Cheers

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.