Skip to content

Commit

Permalink
docs: add missing syntax highlighting (yargs#1618)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin E. Coe <bencoe@google.com>
  • Loading branch information
cherryblossom000 and bcoe committed Apr 12, 2020
1 parent 0894175 commit 40d6a8d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ for detailed documentation of this feature.

## Command finish hook
### Example
```
```js
yargs
.command('cmd', ..., async () => {
await this.model.find()
Expand Down Expand Up @@ -484,7 +484,7 @@ In this example, our middleware will check if the `username` and `password` is p

#### Middleware function

```
```js
const normalizeCredentials = (argv) => {
if (!argv.username || !argv.password) {
const credentials = JSON.parse(fs.readSync('~/.credentials'))
Expand All @@ -503,7 +503,7 @@ This example is exactly the same however it loads the `username` and `password`

#### Middleware function

```
```js
const { promisify } = require('util') // since node 8.0.0
const readFile = promisify(require('fs').readFile)

Expand All @@ -520,7 +520,7 @@ yargs.middleware(normalizeCredentials)

#### yargs parsing configuration

```
```js
var argv = require('yargs')
.usage('Usage: $0 <command> [options]')
.command('login', 'Authenticate user', (yargs) =>{
Expand All @@ -537,7 +537,7 @@ var argv = require('yargs')
### Using the non-singleton interface

To use yargs without running as a singleton, do:
```
```js
const argv = require('yargs/yargs')(process.argv.slice(2))
```

Expand Down

0 comments on commit 40d6a8d

Please sign in to comment.