diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-01-23 19:29:26 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-01-23 19:29:26 +0100 |
commit | 9c31e8cbf9708922e5a080dff28f102dfa58eeec (patch) | |
tree | f6a00d9eebdf3177be79423d59151875cdc7a9b3 /src/Command | |
parent | aa113848a5884f95d543c2acecb55321db23b3ba (diff) |
Look for repo in directory containing config file
Diffstat (limited to 'src/Command')
-rw-r--r-- | src/Command/Run.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Command/Run.hs b/src/Command/Run.hs index 52b70f3..b998a60 100644 --- a/src/Command/Run.hs +++ b/src/Command/Run.hs @@ -14,7 +14,9 @@ import Data.Text qualified as T import Data.Text.IO qualified as T import System.Console.GetOpt +import System.Directory import System.Exit +import System.FilePath import System.IO import System.Process @@ -138,9 +140,17 @@ cmdRun :: RunCommand -> CommandExec () cmdRun (RunCommand RunOptions {..} args) = do CommonOptions {..} <- getCommonOptions tout <- getTerminalOutput + configPath <- getConfigPath + let baseDir = takeDirectory configPath liftIO $ do - Just repo <- openRepo "." + repo <- openRepo baseDir >>= \case + Just repo -> return repo + Nothing -> do + absPath <- makeAbsolute baseDir + T.hPutStrLn stderr $ "No repository found at `" <> T.pack absPath <> "'" + exitFailure + ranges <- forM (args ++ roRanges) $ \changeset -> do ( base, tip ) <- case T.splitOn ".." changeset of base : tip : _ -> return ( base, tip ) @@ -156,7 +166,7 @@ cmdRun (RunCommand RunOptions {..} args) = do branches <- mapM (watchBranchSource repo) roNewCommitsOn - mngr <- newJobManager "./.minici" optJobs + mngr <- newJobManager (baseDir </> ".minici") optJobs source <- mergeSources $ concat [ ranges, branches ] headerLine <- newLine tout "" |