summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Main.hs32
-rw-r--r--src/SlackBuilder/CommandLine.hs5
2 files changed, 0 insertions, 37 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 3e00f18..05013c4 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -17,7 +17,6 @@ import SlackBuilder.LatestVersionCheck
import SlackBuilder.Update
import qualified Toml
import Data.Text (Text)
-import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import Control.Monad.Trans.Reader (ReaderT(..), asks)
import SlackBuilder.Package (PackageDescription(..), renderTextWithVersion)
@@ -33,10 +32,6 @@ import System.Console.ANSI
)
import Data.Maybe (mapMaybe)
import qualified Text.URI as URI
-import System.Directory (listDirectory)
-import qualified Data.HashMap.Strict as HashMap
-import SlackBuilder.Info (PackageInfo(..), readInfoFile)
-import Control.Monad (unless)
autoUpdatable :: [PackageSettings] -> [PackageDescription]
autoUpdatable = mapMaybe go
@@ -102,32 +97,6 @@ check = SlackBuilderT (asks (getField @"packages"))
>>= mapM_ checkUpdateAvailability
>> liftIO (putStrLn "")
-installed :: SlackBuilderT ()
-installed = do
- listing <- listRepository
- database <- foldr createDataBase HashMap.empty . mapMaybe createEntry
- <$> liftIO (listDirectory "/var/lib/pkgtools/packages")
- traverse_ findInfo $ HashMap.intersectionWith (,) database listing
- where
- findInfo (installed'@Package.DataBaseEntry{ name, version }, fromRepository) = do
- packageInfo <- readInfoFile fromRepository name
- unless (version == getField @"version" packageInfo) $ liftIO $ putStrLn $
- show installed' <> " (available: " <> Text.unpack (getField @"version" packageInfo) <> ")"
- createDataBase entry@Package.DataBaseEntry{ name } =
- HashMap.insert name entry
- createEntry filename = createEntryFromChunks
- $ Text.split (== '-')
- $ Text.reverse
- $ Text.pack filename
- createEntryFromChunks (build : arch : version : name) = Just
- Package.DataBaseEntry
- { arch = Text.reverse arch
- , build = Text.reverse build
- , version = Text.reverse version
- , name = Text.reverse (Text.intercalate "-" name)
- }
- createEntryFromChunks _ = Nothing
-
main :: IO ()
main = execParser slackBuilderParser
>>= handleExceptions . withCommandLine
@@ -147,4 +116,3 @@ main = execParser slackBuilderParser
executeCommand = \case
CheckCommand -> check
Up2DateCommand packageName -> up2Date packageName
- InstalledCommand -> installed
diff --git a/src/SlackBuilder/CommandLine.hs b/src/SlackBuilder/CommandLine.hs
index ee81289..b098b3f 100644
--- a/src/SlackBuilder/CommandLine.hs
+++ b/src/SlackBuilder/CommandLine.hs
@@ -26,7 +26,6 @@ import Options.Applicative
data SlackBuilderCommand
= CheckCommand
| Up2DateCommand (Maybe Text)
- | InstalledCommand
slackBuilderParser :: ParserInfo SlackBuilderCommand
slackBuilderParser = info (helper <*> slackBuilderCommand) fullDesc
@@ -35,7 +34,6 @@ slackBuilderCommand :: Parser SlackBuilderCommand
slackBuilderCommand = subparser
$ command "check" checkCommand
<> command "up2date" up2DateCommand
- <> command "installed" installedCommand
where
checkCommand = info checkP $ progDesc "Check all configured slackbuilds for updates"
checkP = pure CheckCommand
@@ -43,6 +41,3 @@ slackBuilderCommand = subparser
<$> optional (argument str (metavar "PKGNAM"))
up2DateCommand = info up2DateP
$ progDesc "Update a single or multiple slackbuild in the configured repository"
- installedCommand = info installedP
- $ progDesc "Find local packages that can be updated using the configured repository"
- installedP = pure InstalledCommand