mirror of
https://github.com/anoma/juvix.git
synced 2024-12-18 20:31:51 +03:00
76d69b5ef3
This PR adds a new command `juvix dependencies update` that fetches all dependencies in a project and updates the project lock file. Currently the only way to update the lock file is to delete it and generate a new one. ## CLI Docs ``` juvix dependencies --help Usage: juvix dependencies COMMAND Subcommands related to dependencies Available options: -h,--help Show this help text Available commands: update Fetch package dependencies and update the lock file ``` ## Example A project containing the following `juvix.yaml` ```yaml dependencies: - .juvix-build/stdlib/ - git: url: https://github.com/anoma/juvix-test ref: v0.6.0 name: test main: Example.juvix name: example version: 1.0.0 ``` compile to generate the lockfile: `juvix compile` ```yaml # This file was autogenerated by Juvix version 0.5.1. # Do not edit this file manually. dependencies: - path: .juvix-build/stdlib/ dependencies: [] - git: name: test ref: a94c61749678ff57556ee6e4cb1f8fbbddbc4ab1 url: https://github.com/anoma/juvix-test dependencies: - git: name: stdlib ref: 4facf14d9b2d06b81ce1be1882aa9050f768cb45 url: https://github.com/anoma/juvix-stdlib dependencies: [] ``` Now update the test dependency version: ```yaml - .juvix-build/stdlib/ - git: url: https://github.com/anoma/juvix-test ref: v0.6.1 name: test main: Example.juvix name: example version: 1.0.0 ``` And run `juvix dependencies update` Now the lockfile has updated to the hash of v0.6.1: ```yaml # This file was autogenerated by Juvix version 0.5.1. # Do not edit this file manually. dependencies: - path: .juvix-build/stdlib/ dependencies: [] - git: name: test ref: a7ac74cac0db92e0b5e349f279d797c3788cdfdd url: https://github.com/anoma/juvix-test dependencies: - git: name: stdlib ref: 4facf14d9b2d06b81ce1be1882aa9050f768cb45 url: https://github.com/anoma/juvix-stdlib dependencies: [] ``` --------- Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
43 lines
1.5 KiB
Haskell
43 lines
1.5 KiB
Haskell
module TopCommand where
|
|
|
|
import Commands.Base hiding (Format)
|
|
import Commands.Clean qualified as Clean
|
|
import Commands.Compile qualified as Compile
|
|
import Commands.Dependencies qualified as Dependencies
|
|
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)
|
|
Dependencies opts -> Dependencies.runCommand opts
|