Handle arguments
This commit is contained in:
parent
c7a625a090
commit
a20a3adffc
17
src/Main.hs
17
src/Main.hs
@ -84,10 +84,23 @@ main :: IO ()
|
|||||||
main = interface >>= (`runApp` search)
|
main = interface >>= (`runApp` search)
|
||||||
|
|
||||||
|
|
||||||
|
-- Program --
|
||||||
|
|
||||||
search :: ProgArgs -> IO ()
|
search :: ProgArgs -> IO ()
|
||||||
search ProgArgs {..} = do
|
search ProgArgs {..} = do
|
||||||
res <- fuzzy "gog.com" <$> getKeychain
|
paths <- if null keychain
|
||||||
pprint res
|
then keychainList
|
||||||
|
else return [keychain]
|
||||||
|
items <- getKeychain paths
|
||||||
|
let select = if resultsLimit == 0
|
||||||
|
then id
|
||||||
|
else take resultsLimit
|
||||||
|
let res = if null exactMatches
|
||||||
|
then select (fuzzy searchTerm items)
|
||||||
|
else select (byAttrib (Left exactMatches, Str searchTerm) items)
|
||||||
|
if contentOnly
|
||||||
|
then mapM_ print (map content res)
|
||||||
|
else pprint res
|
||||||
when (not noClipboard) (sendClipboard (content $ head res))
|
when (not noClipboard) (sendClipboard (content $ head res))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user