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

@ -70,6 +70,25 @@ autoUpdatable =
, requires = mempty
, reupload = False
}
, Package
{ latest =
let ghArguments = GhArguments
{ owner = "jitsi"
, name = "jitsi-meet-electron"
, transform = Nothing
}
latest' = latestGitHub ghArguments $ Text.stripPrefix "v"
template = Package.DownloadTemplate
$ Package.StaticPlaceholder "https://github.com/jitsi/jitsi-meet-electron/releases/download/v"
:| Package.VersionPlaceholder
: [Package.StaticPlaceholder "/jitsi-meet-x86_64.AppImage"]
in Package.Updater latest' template
, category = "network"
, name = "jitsi-meet-desktop"
, homepage = Just [uri|https://jitsi.org/|]
, requires = mempty
, reupload = False
}
]
up2Date :: SlackBuilderT ()
@ -134,8 +153,6 @@ main = do
Text.IO.putStrLn $ fromMaybe "" latestVersion
where
executeCommand = \case
PackagistCommand packagistArguments ->
latestPackagist packagistArguments
TextCommand textArguments -> latestText textArguments
GhCommand ghArguments@GhArguments{ transform }
-> latestGitHub ghArguments $ chooseTransformFunction transform

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)