#!/usr/bin/env nu # The host handles TLS. Test anonymous HTTPS against a small public repository. use std/assert def main [component: path] { let component = ($component | path expand) let fixture = (mktemp -d -p /tmp/p1-git public-https.XXXXXX) with-env {GIT_AUTHOR_NAME: 'Agent', GIT_AUTHOR_EMAIL: 'agent@example.test', GIT_COMMITTER_NAME: 'Agent', GIT_COMMITTER_EMAIL: 'agent@example.test'} { for args in [[clone https://github.com/octocat/Hello-World.git /hello] [-C /hello config user.name Agent] [-C /hello config user.email agent@example.test] [-C /hello fetch]] { let result = (^wasmtime run -S http -S cli-exit-with-code=y --dir $'($fixture)::/' --env GIT_AUTHOR_NAME --env GIT_AUTHOR_EMAIL --env GIT_COMMITTER_NAME --env GIT_COMMITTER_EMAIL $component ...$args | complete) if $result.exit_code != 0 {error make {msg: ($result | to json)}} print $'HTTPS ($args | str join " "): PASS' } assert (($fixture | path join hello README) | path exists) print $'Fixture: ($fixture)' } }