This commit is contained in:
voidlizard 2025-01-17 11:19:14 +03:00
parent 1e008e449c
commit a6f4a5a1fa
1 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import HBS2.Git3.Import
import System.Posix.Signals import System.Posix.Signals
import System.IO qualified as IO import System.IO qualified as IO
import System.Exit qualified as Exit import System.Exit qualified as Exit
import System.Environment (getArgs)
import Data.Config.Suckless.Script import Data.Config.Suckless.Script
@ -31,6 +32,12 @@ sendLine = liftIO . IO.putStrLn
die :: (MonadIO m, Pretty a) => a -> m b die :: (MonadIO m, Pretty a) => a -> m b
die s = liftIO $ Exit.die (show $ pretty s) die s = liftIO $ Exit.die (show $ pretty s)
parseCLI :: MonadIO m => m [Syntax C]
parseCLI = do
argz <- liftIO getArgs
parseTop (unlines $ unwords <$> splitForms argz)
& either (error.show) pure
-- parseURL :: String -> Maybe (LWWRefKey 'HBS2Basic) -- parseURL :: String -> Maybe (LWWRefKey 'HBS2Basic)
-- parseURL s = eitherToMaybe $ Atto.parseOnly p (BS8.pack s) -- parseURL s = eitherToMaybe $ Atto.parseOnly p (BS8.pack s)
-- where -- where
@ -109,6 +116,10 @@ main = flip runContT pure do
conf <- readLocalConf conf <- readLocalConf
cli <- parseCLI
notice $ pretty cli
void $ run dict conf void $ run dict conf
recover $ connectedDo do recover $ connectedDo do