From 6f3ad80b9c13c079c8ea6cb368d1a30ba93eb495 Mon Sep 17 00:00:00 2001 From: flupe Date: Tue, 1 Oct 2024 11:15:57 +0200 Subject: [PATCH] [ fix #370 ] add locate command, data-files in cabal config --- agda2hs.cabal | 5 ++++- src/Main.hs | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/agda2hs.cabal b/agda2hs.cabal index 93ac52bd..7e177075 100644 --- a/agda2hs.cabal +++ b/agda2hs.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.2 +cabal-version: 2.4 name: agda2hs version: 1.3 license: BSD-3-Clause @@ -18,6 +18,9 @@ description: extra-doc-files: CHANGELOG.md README.md +data-files: agda2hs.agda-lib + lib/**/*.agda + source-repository head type: git location: https://github.com/agda/agda2hs.git diff --git a/src/Main.hs b/src/Main.hs index c8642aec..6c85ef9a 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -21,7 +21,7 @@ import Agda2Hs.Config ( checkConfig ) import Agda2Hs.Compile.Types import Agda2Hs.Render -import Paths_agda2hs ( version ) +import Paths_agda2hs ( version, getDataFileName ) -- | Agda2Hs default config @@ -87,8 +87,15 @@ isInteractive = do return $ not $ null i main = do - -- Issue #201: disable backend when run in interactive mode - isInt <- isInteractive - if isInt - then runAgda [Backend backend{isEnabled = const False}] - else runAgda [Backend backend] + args <- getArgs + + -- Issue #370: `agda2hs locate` will print out the path to the prelude agda-lib file + if args == ["locate"] then + getDataFileName "agda2hs.agda-lib" >>= putStrLn + else do + -- Issue #201: disable backend when run in interactive mode + isInt <- isInteractive + + if isInt + then runAgda [Backend backend{isEnabled = const False}] + else runAgda [Backend backend]