mirror of
https://github.com/github/semantic.git
synced 2024-12-23 06:41:45 +03:00
Extract symbolFieldsReader to the top level.
This commit is contained in:
parent
8bb2793804
commit
89e5168e65
@ -121,9 +121,11 @@ arguments = info (version <*> helper <*> ((,) <$> optionsParser <*> argumentsPar
|
|||||||
options options fields = option (optionsReader options) (fields <> showDefaultWith (findOption options) <> metavar (intercalate "|" (fmap fst options)))
|
options options fields = option (optionsReader options) (fields <> showDefaultWith (findOption options) <> metavar (intercalate "|" (fmap fst options)))
|
||||||
findOption options value = maybe "" fst (find ((== value) . snd) options)
|
findOption options value = maybe "" fst (find ((== value) . snd) options)
|
||||||
|
|
||||||
-- Example: semantic parse --symbols --fields=symbol,path,language,kind,line,span
|
|
||||||
symbolFieldsReader = eitherReader parseSymbolFields
|
-- Example: semantic parse --symbols --fields=symbol,path,language,kind,line,span
|
||||||
parseSymbolFields arg = let fields = splitWhen (== ',') arg in
|
symbolFieldsReader :: ReadM SymbolFields
|
||||||
|
symbolFieldsReader = eitherReader parseSymbolFields
|
||||||
|
where parseSymbolFields arg = let fields = splitWhen (== ',') arg in
|
||||||
Right SymbolFields
|
Right SymbolFields
|
||||||
{ symbolFieldsName = "symbol" `elem` fields
|
{ symbolFieldsName = "symbol" `elem` fields
|
||||||
, symbolFieldsPath = "path" `elem` fields
|
, symbolFieldsPath = "path" `elem` fields
|
||||||
|
Loading…
Reference in New Issue
Block a user