Merge pull request #5192 from unisonweb/topic/numerals

This commit is contained in:
Arya Irani 2024-07-09 14:24:13 -04:00 committed by GitHub
commit 223df40237
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 2 deletions

View File

@ -64,9 +64,14 @@ extra-deps:
- recover-rtti-0.4.2@sha256:c179a303921126d8d782264e14f386c96e54a270df74be002e4c4ec3c8c7aebd,4529
- lsp-2.2.0.0@sha256:82fbf4b69d94d8d22543be71f89986b3e90050032d671fb3de3f8253ea1e5b6f,3550
- lsp-types-2.0.2.0@sha256:a9a51c3cea0726d91fe63fa0670935ee720f7b31bc3f3b33b2483fc538152677,29421
- numerals-0.4.1@sha256:f138b4a0efbde3b3c6cbccb788eff683cb8a5d046f449729712fd174c5ee8a78,11430
- row-types-1.0.1.2@sha256:4d4c7cb95d06a32b28ba977852d52a26b4c1f695ef083a6fd874ab6d79933b64,3071
- network-udp-0.0.0
allow-newer: true
allow-newer-deps:
- numerals
ghc-options:
# All packages
"$locals": -Wall -Werror -Wno-name-shadowing -Wno-missing-pattern-synonym-signatures -fprint-expanded-synonyms -fwrite-ide-info #-freverse-errors

View File

@ -75,6 +75,13 @@ packages:
size: 45527
original:
hackage: lsp-types-2.0.2.0@sha256:a9a51c3cea0726d91fe63fa0670935ee720f7b31bc3f3b33b2483fc538152677,29421
- completed:
hackage: numerals-0.4.1@sha256:f138b4a0efbde3b3c6cbccb788eff683cb8a5d046f449729712fd174c5ee8a78,11430
pantry-tree:
sha256: c616791b08f1792fd1d4ca03c6d2c773dedb25b24b66454c97864aefd85a5d0a
size: 13751
original:
hackage: numerals-0.4.1@sha256:f138b4a0efbde3b3c6cbccb788eff683cb8a5d046f449729712fd174c5ee8a78,11430
- completed:
hackage: row-types-1.0.1.2@sha256:4d4c7cb95d06a32b28ba977852d52a26b4c1f695ef083a6fd874ab6d79933b64,3071
pantry-tree:

View File

@ -54,6 +54,7 @@ dependencies:
- network-udp
- network-uri
- nonempty-containers
- numerals
- open-browser
- optparse-applicative >= 0.16.1.0
- pretty-simple

View File

@ -152,6 +152,8 @@ import System.Console.Haskeline.Completion (Completion (Completion))
import System.Console.Haskeline.Completion qualified as Haskeline
import System.Console.Haskeline.Completion qualified as Line
import Text.Megaparsec qualified as Megaparsec
import Text.Numeral (defaultInflection)
import Text.Numeral.Language.ENG qualified as Numeral
import U.Codebase.HashTags (CausalHash (..))
import U.Codebase.Sqlite.DbId (ProjectBranchId)
import U.Codebase.Sqlite.Project qualified as Sqlite
@ -342,7 +344,11 @@ wrongStructuredArgument expected actual =
wrongArgsLength :: Text -> [a] -> Either (P.Pretty CT.ColorText) b
wrongArgsLength expected args =
Left . P.text $ "I expected " <> expected <> ", but received " <> Text.pack (show $ length args) <> "."
let foundCount =
case length args of
0 -> "none"
n -> fromMaybe (tShow n) $ Numeral.us_cardinal defaultInflection n
in Left . P.text $ "I expected " <> expected <> ", but received " <> foundCount <> "."
patternName :: InputPattern -> P.Pretty P.ColorText
patternName = fromString . I.patternName

View File

@ -230,6 +230,7 @@ library
, network-udp
, network-uri
, nonempty-containers
, numerals
, open-browser
, optparse-applicative >=0.16.1.0
, pretty-simple
@ -371,6 +372,7 @@ executable transcripts
, network-udp
, network-uri
, nonempty-containers
, numerals
, open-browser
, optparse-applicative >=0.16.1.0
, pretty-simple
@ -519,6 +521,7 @@ test-suite cli-tests
, network-udp
, network-uri
, nonempty-containers
, numerals
, open-browser
, optparse-applicative >=0.16.1.0
, pretty-simple

View File

@ -68,7 +68,7 @@ scratch/main> update arg
Sorry, I wasnt sure how to process your request:
I expected no arguments, but received 1.
I expected no arguments, but received one.
You can run `help update` for more information on using
`update`.