From 505ae1c65bae537f386a3dc4f8d5d1c154c8f5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 19 Mar 2025 21:33:11 +0100 Subject: Add --storage command line option --- src/Command.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Command.hs') diff --git a/src/Command.hs b/src/Command.hs index aaaaca1..0d333e8 100644 --- a/src/Command.hs +++ b/src/Command.hs @@ -14,6 +14,7 @@ module Command ( getRepo, getDefaultRepo, tryGetDefaultRepo, getEvalInput, getTerminalOutput, + getStorageDir, ) where import Control.Monad.Catch @@ -27,6 +28,7 @@ import Data.Text.IO qualified as T import System.Console.GetOpt import System.Exit +import System.FilePath import System.IO import Config @@ -103,6 +105,7 @@ data CommandInput = CommandInput , ciContainingRepo :: Maybe Repo , ciOtherRepos :: [ ( RepoName, Repo ) ] , ciTerminalOutput :: TerminalOutput + , ciStorageDir :: Maybe FilePath } getCommonOptions :: CommandExec CommonOptions @@ -143,3 +146,8 @@ getEvalInput = CommandExec $ do getTerminalOutput :: CommandExec TerminalOutput getTerminalOutput = CommandExec (asks ciTerminalOutput) + +getStorageDir :: CommandExec FilePath +getStorageDir = CommandExec (asks ciStorageDir) >>= \case + Just dir -> return dir + Nothing -> (( ".minici") . takeDirectory) <$> getConfigPath -- cgit v1.2.3