diff --git a/bash-env.nu b/bash-env.nu index e714131..1070477 100644 --- a/bash-env.nu +++ b/bash-env.nu @@ -16,20 +16,23 @@ export def main [ [] } - let raw = ($in | str join "\n") | bash-env-json ...($fn_args ++ $path_args) | from json + let raw = ($in | str join "\n") | bash-env-json ...($fn_args ++ $path_args) | complete + let raw_json = $raw.stdout | from json - let error = $raw | get -i error + let error = $raw_json | get -i error if $error != null { error make { msg: $error } + } else if $raw.exit_code != 0 { + error make { msg: $"unexpected failure from bash-env-json ($raw.stderr)" } } if ($export | is-not-empty) { print "warning: --export is deprecated, use --shellvars(-s) instead" - let exported_shellvars = ($raw.shellvars | select -i ...$export) - $raw.env | merge ($exported_shellvars) + let exported_shellvars = ($raw_json.shellvars | select -i ...$export) + $raw_json.env | merge ($exported_shellvars) } else if $shellvars or ($fn | is-not-empty) { - $raw + $raw_json } else { - $raw.env + $raw_json.env } } diff --git a/flake.lock b/flake.lock index ee4431c..e85304c 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ ] }, "locked": { - "lastModified": 1729393456, - "narHash": "sha256-EpGpe7P4DLETvKKgaZxDDaMptJnQMuMw9MSbegkIsI0=", + "lastModified": 1730091345, + "narHash": "sha256-kerVDH54dRGgrY83nQ8qJzDX3Od/ybw7Jhzp/Nb0cnk=", "owner": "tesujimath", "repo": "bash-env-json", - "rev": "5d7ec7e2e184e3f3f763050a40b862fd2599cef8", + "rev": "ba87ef4d764e48bafbd67d0cf770e8c7175c77c6", "type": "github" }, "original": {