I tried to install darklang locally on my system, and it didn't work. This PR started out as me trying to fix specific issues related to that, but widened to more general changes to our CLI 'bindings' and our setup for local install and uninstall.
Changes made:
put everything related to our "local install" of the darklang CLI into a new module Darklang.Cli.LocalInstall
made the "install" of Darklang non-automatic -- self-update should be automatic, but initial install shouldn't
moved some lower-level CLI stuff (i.e. read from .bashrc) in Stdlib. this includes: Host (getting info about OS, Arch, Shell), Bash, Zsh, Unix, Curl, Gzip, etc.
all CLI commands used to be executed through Builtin.processRun, wrapped by @Darklang.Stdlib.Process.runCommand, which returned a @Darklang.Stdlib.Process.Result. I found those names pretty unintuitive, so have renamed to Builtin.cliExecute, @Darklang.Stdlib.Cli.execute and @Darklang.Stdlib.Cli.ExecutionOutcome
I replaced sed usage with Dark code -- it turns out that sed differs between GNU (Linux) and BSD (macOS), and generally we should favor Dark code over wrapping thin Unix libraries
I've added two functions Cli.executeWithUnitOrStdErr and .executeWithStdOutOrStdErr (returning Result<Unit, String> and Result<String, String>, respectively) to handle common use cases of CLI executions, so we don't have to "check if exit code is 0" everywhere
deleted packages/darklang/localexec.dark -- it was unused for a while
extracted the bits of code around "what's the URL of the last-released Darklang release on GitHub?" to a Darklang.GitHub module
I tried to install
darklang
locally on my system, and it didn't work. This PR started out as me trying to fix specific issues related to that, but widened to more general changes to our CLI 'bindings' and our setup for local install and uninstall.Changes made:
darklang
CLI into a new moduleDarklang.Cli.LocalInstall
Host
(getting info about OS, Arch, Shell),Bash
,Zsh
,Unix
,Curl
,Gzip
, etc.Builtin.processRun
, wrapped by@Darklang.Stdlib.Process.runCommand
, which returned a@Darklang.Stdlib.Process.Result
. I found those names pretty unintuitive, so have renamed toBuiltin.cliExecute
,@Darklang.Stdlib.Cli.execute
and@Darklang.Stdlib.Cli.ExecutionOutcome
sed
usage with Dark code -- it turns out that sed differs between GNU (Linux) and BSD (macOS), and generally we should favor Dark code over wrapping thin Unix librariesCli.executeWithUnitOrStdErr
and.executeWithStdOutOrStdErr
(returningResult<Unit, String>
andResult<String, String>
, respectively) to handle common use cases of CLI executions, so we don't have to "check if exit code is 0" everywherepackages/darklang/localexec.dark
-- it was unused for a whileDarklang.GitHub
module