helic 0.3.0.0 → 0.3.1.0
raw patch · 7 files changed
+46/−6 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- helic.cabal +1/−1
- lib/Helic/Cli.hs +3/−1
- lib/Helic/Cli/Options.hs +13/−1
- lib/Helic/Effect/History.hs +25/−1
- lib/Helic/Interpreter/Agent.hs +2/−0
- lib/Helic/List.hs +1/−1
- test/Helic/Test/ListTest.hs +1/−1
helic.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: helic-version: 0.3.0.0+version: 0.3.1.0 synopsis: Clipboard Manager description: See <https://hackage.haskell.org/package/helic/docs/Helic.html> category: Clipboard
lib/Helic/Cli.hs view
@@ -25,7 +25,7 @@ import Polysemy.Time (MilliSeconds (MilliSeconds)) import System.IO (hLookAhead) -import Helic.Cli.Options (Command (List, Listen, Yank), Conf (Conf), parser)+import Helic.Cli.Options (Command (List, Listen, Load, Yank), Conf (Conf), parser) import Helic.Config.File (findFileConfig) import Helic.Data.Config (Config (Config)) import Helic.Data.Event (Event)@@ -153,6 +153,8 @@ yankApp config yankConf List showConf -> listApp config showConf+ Load loadConf ->+ loadApp config loadConf defaultCommand :: Sem IOStack Command defaultCommand = do
lib/Helic/Cli/Options.hs view
@@ -25,6 +25,7 @@ import Path (Abs, File, Path, parseAbsFile) import Helic.Data.ListConfig (ListConfig (ListConfig))+import Helic.Data.LoadConfig (LoadConfig (LoadConfig)) import Helic.Data.YankConfig (YankConfig (YankConfig)) data Conf =@@ -40,6 +41,8 @@ Yank YankConfig | List ListConfig+ |+ Load LoadConfig deriving stock (Eq, Show) filePathOption :: ReadM (Path Abs File)@@ -73,12 +76,21 @@ listCommand = command "list" (List <$> info listParser (progDesc "List clipboard events")) +loadParser :: Parser LoadConfig+loadParser =+ LoadConfig <$> argument auto (help "Index of the event")++loadCommand :: Mod CommandFields Command+loadCommand =+ command "load" (Load <$> info loadParser (progDesc "Load a history event"))+ commands :: [Mod CommandFields Command] commands = [ listenCommand, yankCommand,- listCommand+ listCommand,+ loadCommand ] parser :: Parser (Conf, Maybe Command)
lib/Helic/Effect/History.hs view
@@ -1,12 +1,36 @@ -- |History Effect, Internal module Helic.Effect.History where +import Polysemy (makeSem_) import Helic.Data.Event (Event) -- |The core actions of the 'Event' history. data History :: Effect where+ -- |Return the current history. Get :: History m [Event]+ -- |Process an 'Event' received from outside. Receive :: Event -> History m ()+ -- |Load the 'Event' at the given history index into the clipboards. Load :: Int -> History m (Maybe Event) -makeSem ''History+makeSem_ ''History++-- |Return the current history.+get ::+ ∀ r .+ Member History r =>+ Sem r [Event]++-- |Process an 'Event' received from outside.+receive ::+ ∀ r .+ Member History r =>+ Event ->+ Sem r ()++-- |Load the 'Event' at the given history index into the clipboards.+load ::+ ∀ r .+ Member History r =>+ Int ->+ Sem r (Maybe Event)
lib/Helic/Interpreter/Agent.hs view
@@ -1,3 +1,4 @@+-- |Simple Agent Interpreter, Internal module Helic.Interpreter.Agent where import Polysemy.Tagged (Tagged, untag)@@ -5,6 +6,7 @@ import Helic.Data.Event (Event) import Helic.Effect.Agent (Agent (Update)) +-- |Interpret 'Agent' with an action. interpretAgent :: ∀ id r . (Event -> Sem r ()) ->
lib/Helic/List.hs view
@@ -19,7 +19,7 @@ truncateLines :: Int -> Text -> Text truncateLines maxWidth a =- case Text.lines a of+ case Text.lines (Text.dropWhile (\ c -> '\n' == c || '\r' == c) a) of [] -> a [firstLine] ->
test/Helic/Test/ListTest.hs view
@@ -20,7 +20,7 @@ "extra", "extra", "single line",- "single line with newline\n",+ "\n\r\r\nsingle line with newline\n", "three lines 1\nthree lines 2\nthree lines 3" ]