janet-lang / jpm

Janet Project Manager
MIT License
72 stars 22 forks source link

Support for OpenBSD's got #91

Open lescx opened 5 months ago

lescx commented 5 months ago

I tried to install jpm on my OpenBSD machine with an updated [open]bsd_config.janet: :manpath (string prefix "/man/man1") and :gitpath "got" instead of git.

OpenBSD is developing got as a nice, no-nonsense (no git column for example) alternative to git.

While the bootstrap installation works as expected, installing a module does not.

$ doas jpm install spork    
doas (luca@hostname) password: 
got: unknown option -- C
usage: got [-hV] command [arg ...]
error: command failed with non-zero exit code 1
  in os/execute [src/core/os.c] on line 1391
  in shell [/usr/local/lib/janet/jpm/shutil.janet] (tailcall) on line 132, column 5
  in update-git-bundle [/usr/local/lib/janet/jpm/pm.janet] on line 159, column 7
  in download-git-bundle [/usr/local/lib/janet/jpm/pm.janet] on line 177, column 5
  in download-bundle [/usr/local/lib/janet/jpm/pm.janet] on line 204, column 10
  in bundle-install [/usr/local/lib/janet/jpm/pm.janet] on line 217, column 13
  in resolve-bundle-name [/usr/local/lib/janet/jpm/pm.janet] on line 118, column 20
  in resolve-bundle [/usr/local/lib/janet/jpm/pm.janet] on line 148, column 9
  in bundle-install [/usr/local/lib/janet/jpm/pm.janet] on line 216, column 4
  in install [/usr/local/lib/janet/jpm/commands.janet] (tailcall) on line 199, column 20
  in run-main [boot.janet] on line 3975, column 16
  in cli-main [boot.janet] on line 4128, column 17

Got doesn't have a -C flag, nor does it need one; if we run cd in a subshell, the script can fetch in there without affecting the parent's current directory. There is also the very handy cd - on UNIX :)

I think this would be a good first commit for Janet by myself. What do you think about supporting got or rewriting the git-functions in a modular way so both commands work as expected?