mirror of
https://github.com/Yvee1/hascard.git
synced 2024-10-05 19:49:16 +03:00
Add snapcraft
This commit is contained in:
parent
e9c6f95135
commit
e251e7cb0b
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
.stack-work/
|
.stack-work/
|
||||||
hascard.cabal
|
hascard.cabal
|
||||||
*~
|
*~
|
||||||
|
*.snap
|
||||||
|
images/
|
43
snap/snapcraft.yaml
Normal file
43
snap/snapcraft.yaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: hascard # you probably want to 'snapcraft register <name>'
|
||||||
|
base: core18 # the base snap is the execution environment for this snap
|
||||||
|
# version: '0.1.0.0' # just for humans, typically '1.2+git' or '1.3.2'
|
||||||
|
adopt-info: hascard
|
||||||
|
summary: A TUI for reviewing notes using 'flashcards' written with markdown-like syntax # 79 char long summary
|
||||||
|
description: |
|
||||||
|
Hascard is a text-based user interface for reviewing notes using 'flashcards'.
|
||||||
|
Cards are written in markdown-like syntax. Please see the README file on
|
||||||
|
GitHub at <https://github.com/Yvee1/hascard#readme> for more information.
|
||||||
|
|
||||||
|
grade: stable # must be 'stable' to release into candidate/stable channels
|
||||||
|
confinement: strict # use 'strict' once you have the right plugs and slots
|
||||||
|
|
||||||
|
apps:
|
||||||
|
hascard:
|
||||||
|
command: bin/hascard
|
||||||
|
plugs:
|
||||||
|
- home
|
||||||
|
|
||||||
|
parts:
|
||||||
|
hascard:
|
||||||
|
# See 'snapcraft plugins'
|
||||||
|
plugin: nil
|
||||||
|
source: .
|
||||||
|
override-pull: |
|
||||||
|
snapcraftctl pull
|
||||||
|
snapcraftctl set-version "$(grep version package.yaml | awk '{ print $NF }')"
|
||||||
|
override-build: |
|
||||||
|
if [ ! -x "$(command -v stack)" ]; then
|
||||||
|
curl -sSL https://get.haskellstack.org/ | sh
|
||||||
|
fi
|
||||||
|
stack build --copy-bins
|
||||||
|
organize:
|
||||||
|
/root/.local/bin/hascard: bin/hascard
|
||||||
|
stage-packages:
|
||||||
|
- ncurses-term
|
||||||
|
- libncurses5-dev
|
||||||
|
- libncursesw5-dev
|
||||||
|
build-packages:
|
||||||
|
- curl
|
||||||
|
- ncurses-term
|
||||||
|
- libncurses5-dev
|
||||||
|
- libncursesw5-dev
|
@ -11,6 +11,7 @@ import Control.Monad.IO.Class
|
|||||||
import Data.Functor (($>))
|
import Data.Functor (($>))
|
||||||
import Lens.Micro.Platform
|
import Lens.Micro.Platform
|
||||||
import System.FilePath ((</>), takeBaseName)
|
import System.FilePath ((</>), takeBaseName)
|
||||||
|
import System.Environment (lookupEnv)
|
||||||
import Parser
|
import Parser
|
||||||
import UI.BrickHelpers
|
import UI.BrickHelpers
|
||||||
import UI.FileBrowser (runFileBrowserUI)
|
import UI.FileBrowser (runFileBrowserUI)
|
||||||
@ -151,9 +152,16 @@ addRecent s = do
|
|||||||
|
|
||||||
getRecentsFile :: IO FilePath
|
getRecentsFile :: IO FilePath
|
||||||
getRecentsFile = do
|
getRecentsFile = do
|
||||||
xdg <- D.getXdgDirectory D.XdgData "hascard"
|
maybeSnap <- lookupEnv "SNAP_USER_DATA"
|
||||||
D.createDirectoryIfMissing True xdg
|
xdg <- D.getXdgDirectory D.XdgConfig "hascard"
|
||||||
return (xdg </> "recents")
|
|
||||||
|
let dir = case maybeSnap of
|
||||||
|
Just path | not (null path) -> path
|
||||||
|
| otherwise -> xdg
|
||||||
|
Nothing -> xdg
|
||||||
|
D.createDirectoryIfMissing True dir
|
||||||
|
|
||||||
|
return (dir </> "recents")
|
||||||
|
|
||||||
runFileBrowser :: IO ()
|
runFileBrowser :: IO ()
|
||||||
runFileBrowser = do
|
runFileBrowser = do
|
||||||
|
@ -8,6 +8,7 @@ import Control.Monad (void)
|
|||||||
import Data.Functor (($>))
|
import Data.Functor (($>))
|
||||||
import Data.Map.Strict (Map, (!))
|
import Data.Map.Strict (Map, (!))
|
||||||
import System.FilePath ((</>))
|
import System.FilePath ((</>))
|
||||||
|
import System.Environment (lookupEnv)
|
||||||
import UI.BrickHelpers
|
import UI.BrickHelpers
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
import qualified Graphics.Vty as V
|
import qualified Graphics.Vty as V
|
||||||
@ -121,9 +122,15 @@ parseSettings = read
|
|||||||
|
|
||||||
getSettingsFile :: IO FilePath
|
getSettingsFile :: IO FilePath
|
||||||
getSettingsFile = do
|
getSettingsFile = do
|
||||||
|
maybeSnap <- lookupEnv "SNAP_USER_DATA"
|
||||||
xdg <- D.getXdgDirectory D.XdgConfig "hascard"
|
xdg <- D.getXdgDirectory D.XdgConfig "hascard"
|
||||||
D.createDirectoryIfMissing True xdg
|
|
||||||
return (xdg </> "settings")
|
let dir = case maybeSnap of
|
||||||
|
Just path | not (null path) -> path
|
||||||
|
| otherwise -> xdg
|
||||||
|
Nothing -> xdg
|
||||||
|
D.createDirectoryIfMissing True dir
|
||||||
|
return (dir </> "settings")
|
||||||
|
|
||||||
defaultSettings :: Settings
|
defaultSettings :: Settings
|
||||||
defaultSettings = M.fromList [(0, False), (1, True), (2, False)]
|
defaultSettings = M.fromList [(0, False), (1, True), (2, False)]
|
||||||
|
Loading…
Reference in New Issue
Block a user