pgdl 10.3 → 10.4
raw patch · 3 files changed
+27/−4 lines, 3 filesdep ~brick
Dependency ranges changed: brick
Files
- README.md +4/−0
- pgdl.cabal +4/−3
- src/Main.hs +19/−1
README.md view
@@ -22,6 +22,10 @@ ```shell nix-env -iA nixos.haskellPackages.pgdl ```+Or,+```shell+nix-env -i -f pgdl.nix+``` ## example usage
pgdl.cabal view
@@ -1,6 +1,6 @@ name: pgdl-version: 10.3+version: 10.4 license: PublicDomain license-file: LICENSE author: mingchuan@@ -28,7 +28,8 @@ main-is: Main.hs other-modules: Cache, DownloadInterface Networking, Utils, Configure,- EntryAttrViewer, Types, DList+ EntryAttrViewer, Types, DList,+ Paths_pgdl build-depends: base == 4.*, vector, containers, text, bytestring,@@ -38,7 +39,7 @@ data-default, tagsoup, directory-listing-webpage-parser >= 0.1.1.0,- brick >= 0.13 && < 0.14, vty, microlens,+ brick >= 0.13 && < 0.15, vty, microlens, conduit, conduit-extra, http-conduit, http-types, resourcet, configurator >= 0.3,
src/Main.hs view
@@ -1,10 +1,14 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE LambdaCase #-} {-# OPTIONS_GHC -fno-warn-unused-do-bind #-}+{-# LANGUAGE CPP #-} module Main where +import Paths_pgdl (version)+import Data.Version (showVersion)+ import qualified Data.Text as T import Data.Text (Text) import Data.Maybe@@ -40,7 +44,14 @@ | SearchState DList (E.Editor String String) main :: IO ()-main = do+main =+ getArgs >>= \case+ ["-v"] -> putStrLn $ "pgdl " ++ showVersion version+ ["--version"] -> putStrLn $ "pgdl " ++ showVersion version+ _ -> mainUI++mainUI :: IO ()+mainUI = do (dNodes, nr) <- initializeResource let initialState :: MainState@@ -154,6 +165,9 @@ listDrawElement :: Bool -> DNode -> [Widget String] listDrawElement sel dn = [ color (not sel) attrName . vLimit 3 . hLimit 1 $ fill ' ' , color sel attrName text+#if MIN_VERSION_brick(0, 14, 0)+ , color (not sel) attrName . vLimit 3 . hLimit 1 $ fill ' '+#endif ] where attrName = case dn of@@ -163,7 +177,11 @@ name = case dn of Directory a _ -> a File a _ _ -> a+#if MIN_VERSION_brick(0, 14, 0)+ text = txt . placeTextIntoRectangle 3 (U.terminalWidth-2) . stripWidth $ decodedName name+#else text = txt . placeTextIntoRectangle 3 (U.terminalWidth-1) . stripWidth $ decodedName name+#endif color True attr = withAttr attr color False _ = id stripWidth :: Text -> Text