use brick

This commit is contained in:
Jonathan Lamothe 2024-09-07 15:00:17 -04:00
parent 4b057272d3
commit 11870423ed
4 changed files with 67 additions and 2 deletions

View File

@ -22,7 +22,12 @@ License along with this program. If not, see
module Main (main) where
import Brick (defaultMain)
import Control.Monad (void)
import Password.App
main :: IO ()
main = return ()
main = void $ defaultMain passmanApp ()
--jl

View File

@ -28,6 +28,7 @@ dependencies:
- microlens >= 0.4.11.2 && < 0.5
- microlens-th >= 0.4.3.6 && < 0.5
- random >=1.2.1.1 && < 1.3
- brick >= 2.1.1 && < 2.2
ghc-options:
- -Wall

View File

@ -4,7 +4,7 @@ cabal-version: 2.2
--
-- see: https://github.com/sol/hpack
--
-- hash: dc89d8fb08ca638ec275e4cc1d9c22d400b1aeabd2825e4419fdd64d4a5e6334
-- hash: 235d7c20ee589946f5e0cd199cca106191a300f9f24b023a6ef074c197c9861b
name: passman
version: 0.3.1.1
@ -26,6 +26,7 @@ extra-source-files:
library
exposed-modules:
Password
Password.App
other-modules:
Paths_passman
autogen-modules:
@ -39,6 +40,7 @@ library
, base >=4.7 && <5
, base16-bytestring >=1.0.2.0 && <1.1
, base64-bytestring >=1.2.1.0 && <1.3
, brick >=2.1.1 && <2.2
, bytestring >=0.11.4.0 && <0.12
, containers >=0.6.2.1 && <0.7
, microlens >=0.4.11.2 && <0.5
@ -59,6 +61,7 @@ executable passman
build-depends:
aeson >=2.1.2.1 && <2.2
, base >=4.7 && <5
, brick >=2.1.1 && <2.2
, bytestring >=0.11.4.0 && <0.12
, containers >=0.6.2.1 && <0.7
, microlens >=0.4.11.2 && <0.5
@ -95,6 +98,7 @@ test-suite passman-test
HUnit
, aeson >=2.1.2.1 && <2.2
, base >=4.7 && <5
, brick >=2.1.1 && <2.2
, bytestring >=0.11.4.0 && <0.12
, containers >=0.6.2.1 && <0.7
, microlens >=0.4.11.2 && <0.5

55
src/Password/App.hs Normal file
View File

@ -0,0 +1,55 @@
{-|
Module: Password.App
Description: the application frontend
Copyright: (C) Jonathan Lamothe
License: LGPLv3 (or later)
Maintainer: jonathan@jlamothe.net
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see
<https://www.gnu.org/licenses/>.
-}
module Password.App (passmanApp) where
import Brick
( App (..)
, BrickEvent
, EventM
, Widget
, attrMap
, emptyWidget
, halt
, neverShowCursor
, style
)
-- | The main application
passmanApp :: App () () ()
passmanApp = App
{ appDraw = drawFunc
, appChooseCursor = neverShowCursor
, appHandleEvent = eventHandler
, appStartEvent = return ()
, appAttrMap = const $ attrMap (style 0) []
}
drawFunc :: () -> [Widget ()]
drawFunc = const [emptyWidget]
eventHandler :: BrickEvent () () -> EventM () () ()
eventHandler = const halt
--jl