Add module with an info file parser

This commit is contained in:
2023-10-03 18:53:41 +02:00
parent f4b7883cf2
commit d5df676df7
7 changed files with 325 additions and 87 deletions

View File

@ -20,8 +20,7 @@ import Options.Applicative
)
data SlackBuilderCommand
= PackagistCommand PackagistArguments
| TextCommand TextArguments
= TextCommand TextArguments
| GhCommand GhArguments
| SlackBuildCommand Text Text
| CommitCommand Text Text
@ -47,11 +46,6 @@ data GhArguments = GhArguments
newtype TextArguments = TextArguments Text
deriving (Eq, Show)
packagistArguments :: Parser PackagistArguments
packagistArguments = PackagistArguments
<$> argument str (metavar "VENDOR")
<*> argument str (metavar"NAME")
textArguments :: Parser TextArguments
textArguments = TextArguments <$> argument str (metavar "URL")
@ -66,8 +60,7 @@ slackBuilderParser = info slackBuilderCommand fullDesc
slackBuilderCommand :: Parser SlackBuilderCommand
slackBuilderCommand = subparser
$ command "packagist" (info (PackagistCommand <$> packagistArguments) mempty)
<> command "text" (info (TextCommand <$> textArguments) mempty)
$ command "text" (info (TextCommand <$> textArguments) mempty)
<> command "github" (info (GhCommand <$> ghArguments) mempty)
<> command "slackbuild" (info slackBuildCommand mempty)
<> command "commit" (info commitCommand mempty)