mirror of
https://github.com/anoma/juvix.git
synced 2024-12-11 08:25:46 +03:00
d59fca6786
This PR adds the `juvix clean` command to the CLI that removes the Juvix project build directory. It respects the `--internal-build-dir` global option: ``` $ juvix compile Foo.juvix --internal-build-dir /tmp/build $ juvix clean --internal-build-dir /tmp/build ``` In addition this PR fixes the `juvix format` program brief description string. This was too long for the `juvix --help` display. The longer description is now only displayed when `juvix format --help` is run. * Closes https://github.com/anoma/juvix/issues/2017
41 lines
1.4 KiB
Haskell
41 lines
1.4 KiB
Haskell
module TopCommand where
|
|
|
|
import Commands.Base hiding (Format)
|
|
import Commands.Clean qualified as Clean
|
|
import Commands.Compile qualified as Compile
|
|
import Commands.Dev qualified as Dev
|
|
import Commands.Doctor qualified as Doctor
|
|
import Commands.Eval qualified as Eval
|
|
import Commands.Format qualified as Format
|
|
import Commands.Html qualified as Html
|
|
import Commands.Init qualified as Init
|
|
import Commands.Repl qualified as Repl
|
|
import Commands.Typecheck qualified as Typecheck
|
|
import Juvix.Extra.Version
|
|
import System.Environment (getProgName)
|
|
import TopCommand.Options
|
|
|
|
showHelpText :: IO ()
|
|
showHelpText = do
|
|
let p = prefs showHelpOnEmpty
|
|
progn <- getProgName
|
|
let helpText = parserFailure p descr (ShowHelpText Nothing) []
|
|
(msg, _) = renderFailure helpText progn
|
|
putStrLn (pack msg)
|
|
|
|
runTopCommand :: forall r. (Members '[Embed IO, App, Resource] r) => TopCommand -> Sem r ()
|
|
runTopCommand = \case
|
|
DisplayVersion -> embed runDisplayVersion
|
|
DisplayNumericVersion -> embed runDisplayNumericVersion
|
|
DisplayHelp -> embed showHelpText
|
|
Doctor opts -> runLogIO (Doctor.runCommand opts)
|
|
Init -> runLogIO Init.init
|
|
Dev opts -> Dev.runCommand opts
|
|
Typecheck opts -> Typecheck.runCommand opts
|
|
Compile opts -> Compile.runCommand opts
|
|
Clean -> runFilesIO Clean.runCommand
|
|
Eval opts -> Eval.runCommand opts
|
|
Html opts -> Html.runCommand opts
|
|
JuvixRepl opts -> Repl.runCommand opts
|
|
JuvixFormat opts -> runFilesIO (Format.runCommand opts)
|