rdiff-backup: Migrated
This commit is contained in:
34
app/Main.hs
34
app/Main.hs
@ -93,7 +93,8 @@ autoUpdatable =
|
||||
, transform = Nothing
|
||||
}
|
||||
checkVersion x
|
||||
| Text.isPrefixOf "php-8.2." x = Text.stripPrefix "php-" x
|
||||
| not $ Text.isInfixOf "RC" x
|
||||
, Text.isPrefixOf "php-8.2." x = Text.stripPrefix "php-" x
|
||||
| otherwise = Nothing
|
||||
latest' = latestGitHub ghArguments checkVersion
|
||||
template = Package.DownloadTemplate
|
||||
@ -127,6 +128,25 @@ autoUpdatable =
|
||||
, name = "kitty"
|
||||
, reupload = Just [RawCommand "go" ["mod", "vendor"]]
|
||||
}
|
||||
, Package
|
||||
{ latest =
|
||||
let ghArguments = GhArguments
|
||||
{ owner = "rdiff-backup"
|
||||
, name = "rdiff-backup"
|
||||
, transform = Nothing
|
||||
}
|
||||
latest' = latestGitHub ghArguments $ Text.stripPrefix "v"
|
||||
template = Package.DownloadTemplate
|
||||
$ Package.StaticPlaceholder "https://github.com/rdiff-backup/rdiff-backup/releases/download/v"
|
||||
:| Package.VersionPlaceholder
|
||||
: Package.StaticPlaceholder "/rdiff-backup-"
|
||||
: Package.VersionPlaceholder
|
||||
: [Package.StaticPlaceholder ".tar.gz"]
|
||||
in Package.Updater latest' template
|
||||
, category = "system"
|
||||
, name = "rdiff-backup"
|
||||
, reupload = Just mempty
|
||||
}
|
||||
]
|
||||
|
||||
up2Date :: SlackBuilderT ()
|
||||
@ -227,8 +247,6 @@ main = do
|
||||
where
|
||||
executeCommand = \case
|
||||
TextCommand textArguments -> latestText textArguments
|
||||
GhCommand ghArguments@GhArguments{ transform }
|
||||
-> latestGitHub ghArguments $ chooseTransformFunction transform
|
||||
SlackBuildCommand packagePath version ->
|
||||
updateSlackBuildVersion packagePath version >> pure Nothing
|
||||
CommitCommand packagePath version ->
|
||||
@ -246,13 +264,3 @@ main = do
|
||||
DownloadAndDeployCommand uri' tarball -> fmap (Text.pack . show)
|
||||
<$> downloadAndDeploy uri' tarball
|
||||
Up2DateCommand -> up2Date >> pure Nothing
|
||||
chooseTransformFunction (Just "php") = phpTransform
|
||||
chooseTransformFunction (Just "rdiff-backup") = Text.stripPrefix "v"
|
||||
chooseTransformFunction _ = stripPrefix "v"
|
||||
stripPrefix prefix string = Just
|
||||
$ fromMaybe string
|
||||
$ Text.stripPrefix prefix string
|
||||
phpTransform version
|
||||
| (majorPrefix, _patchVersion) <- Text.breakOnEnd "." version
|
||||
, majorPrefix == "php-8.2." = Just $ Text.drop (Text.length "php-") version
|
||||
| otherwise = Nothing
|
||||
|
@ -16,12 +16,11 @@ import Options.Applicative
|
||||
, info
|
||||
, fullDesc
|
||||
, subparser
|
||||
, command, optional
|
||||
, command,
|
||||
)
|
||||
|
||||
data SlackBuilderCommand
|
||||
= TextCommand TextArguments
|
||||
| GhCommand GhArguments
|
||||
| SlackBuildCommand Text Text
|
||||
| CommitCommand Text Text
|
||||
| ExistsCommand Text
|
||||
@ -49,19 +48,12 @@ newtype TextArguments = TextArguments Text
|
||||
textArguments :: Parser TextArguments
|
||||
textArguments = TextArguments <$> argument str (metavar "URL")
|
||||
|
||||
ghArguments :: Parser GhArguments
|
||||
ghArguments = GhArguments
|
||||
<$> argument str (metavar "OWNER")
|
||||
<*> argument str (metavar "NAME")
|
||||
<*> optional (argument str (metavar "TRANSFORM"))
|
||||
|
||||
slackBuilderParser :: ParserInfo SlackBuilderCommand
|
||||
slackBuilderParser = info slackBuilderCommand fullDesc
|
||||
|
||||
slackBuilderCommand :: Parser SlackBuilderCommand
|
||||
slackBuilderCommand = subparser
|
||||
$ command "text" (info (TextCommand <$> textArguments) mempty)
|
||||
<> command "github" (info (GhCommand <$> ghArguments) mempty)
|
||||
<> command "slackbuild" (info slackBuildCommand mempty)
|
||||
<> command "commit" (info commitCommand mempty)
|
||||
<> command "exists" (info existsCommand mempty)
|
||||
|
Reference in New Issue
Block a user