Skip to content

Add a function for getting only the return code #307

@acrodrig

Description

@acrodrig

Just as there are specialized function to retrieve text or json, there should be a function to retrieve the code of the command (in may cases such as in git diff --quiet that is all I am interested in,

Example:

const result = await $`echo 1`.code();
console.log(result); // 0

If I just want the code, then the noThrow should be implicit.

As of now I have to execute the command with noThrow and then fish for the code.

It's a nice to have but I think it would increase the DX.

Thanks for a great library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions