Skip to content

Commit ca71c64

Browse files
committed
[feat:Main] fetch version on subcommand version
1 parent a641b4b commit ca71c64

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

axolotl.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ executable axl
2121
, Analyser.Util
2222
, Evaluator.Evaluator
2323
, Evaluator.NativeFns
24+
, Paths_axolotl
2425

2526
build-depends: base ^>=4.14.2.0
2627
, unordered-containers

src/Main.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@ import Control.Monad (void)
1212
import Data.Bifunctor (Bifunctor (second))
1313
import Data.HashMap.Strict as H (empty, fromList, union)
1414
import Data.Text (Text, pack, unpack)
15+
import Data.Version (showVersion)
1516
import Evaluator.Evaluator (evaluateExpression)
1617
import Parser.Ast (VDataType (Float, Int, NilType, String))
1718
import Parser.Parser (exprs, root)
19+
import Paths_axolotl (version)
1820
import System.Console.Pretty
19-
( Color (Green, Red, Yellow),
21+
( Color (Red),
2022
Pretty (color, style),
2123
Style (Bold),
2224
)
2325
import System.Environment.Blank (getArgs)
2426
import System.IO (hPutStr, hPutStrLn, stderr, stdout)
2527
import Text.Megaparsec (errorBundlePretty, parse)
26-
import Text.Pretty.Simple (pPrint)
2728

2829
makeForeignFunction :: VDataType -> Def
2930
makeForeignFunction ret = AU.Function ret [] [] True
@@ -77,6 +78,7 @@ main = do
7778
1 -> case head args of
7879
"run" -> main' "index.axl"
7980
"transpile" -> logError "transpilation is still wip"
81+
"version" -> putStrLn $ showVersion version
8082
_ -> logError $ "unknown action '" <> head args <> "'"
8183
2 -> case head args of
8284
"run" -> main' $ last args

0 commit comments

Comments
 (0)