Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve examples in types documentation #546

Merged
merged 2 commits into from
Mar 10, 2023
Merged

Improve examples in types documentation #546

merged 2 commits into from
Mar 10, 2023

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Mar 10, 2023

Examples in the types documentation are currently out-of-sync with readme.md. Also, some methods are missing them. This PR fixes this.

The `shell` option must be used if the `command` uses shell-specific features (for example, `&&` or `||`), as opposed to being a simple `file` followed by its `arguments`.

As a convenience, the result from previous `` $`command` `` or `` $.sync`command` `` calls can be used as template expressions in subsequent commands and `$`/`$.sync` will use the `stdout` value. See the example below `` with results from `$` or `$.sync` `` for more details.
Binds options to the `$` API. For example, you can use `$(options)` to create a new `$` instance with specific default options, which are then bound to both the asynchronous `` $`command` `` and synchronous `` $.sync`command` `` APIs.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous code comments were incorrect, as this should document $(options), not $`command`. This fixes it.

*/
export const $: Execa$;

/**
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those lines are moved after execaCommand() instead.

@@ -179,7 +179,6 @@ try {
escapedCommand: 'unknown command',
stdout: '',
stderr: '',
all: '',
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all is undefined there, not ''.

@sindresorhus sindresorhus merged commit 72443f3 into main Mar 10, 2023
@sindresorhus sindresorhus deleted the doc-examples branch March 10, 2023 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants