New project, limit passwords

This commit is contained in:
Martin Potier 2021-04-14 12:33:09 +03:00
parent 8cdfff9901
commit 1b3f67199e
No known key found for this signature in database
GPG key ID: D4DD957DBA4AD89E
2 changed files with 2 additions and 1 deletions

View file

@ -40,7 +40,7 @@ mkPassPrompt label f conf = do
-- I'm just sorting here, but could use some kind of fuzzy matching instead, but it requires a bit more effort -- I'm just sorting here, but could use some kind of fuzzy matching instead, but it requires a bit more effort
passwords <- sort <$> liftIO getPasswords passwords <- sort <$> liftIO getPasswords
-- Other change, use infixof instead of prefixof -- Other change, use infixof instead of prefixof
mkXPrompt (Pass label) conf (\input -> pure (sortBy (compare `on` levenshtein input) . filter (consumes input) $ passwords)) f mkXPrompt (Pass label) conf (\input -> pure (sortBy (compare `on` levenshtein input) . take 5 . filter (consumes input) $ passwords)) f
where where
consumes [] _ = True -- everything consumed consumes [] _ = True -- everything consumed
consumes (_:_) [] = False -- all not consumed consumes (_:_) [] = False -- all not consumed

View file

@ -37,6 +37,7 @@ projects = [ adminProject "wrk-config"
, adminProject "cdc-config" , adminProject "cdc-config"
, adminProject "overlays-personal" , adminProject "overlays-personal"
, candyProject "dhall-packages" , candyProject "dhall-packages"
, candyProject "hfdb"
, spinChat "element" , spinChat "element"
, spinChat "wire" , spinChat "wire"
, spinChat "signal" , spinChat "signal"