Skip to content

Commit

Permalink
chore: format all possible files with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed May 16, 2023
1 parent 6202031 commit f9d5869
Show file tree
Hide file tree
Showing 69 changed files with 1,808 additions and 1,909 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Expand Up @@ -3,7 +3,7 @@ on:
branches:
- main
pull_request:
types: [ assigned, opened, synchronize, reopened, labeled ]
types: [assigned, opened, synchronize, reopened, labeled]
name: ci
permissions:
contents: read # to fetch code (actions/checkout)
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-please.yml
@@ -1,7 +1,7 @@
on:
push:
branches:
- main
push:
branches:
- main
name: release-please
permissions: {}
jobs:
Expand Down
10 changes: 2 additions & 8 deletions .nycrc
@@ -1,13 +1,7 @@
{
"exclude": [
"build/test/**",
"test/**"
],
"exclude": ["build/test/**", "test/**"],
"exclude-after-remap": true,
"reporter": [
"html",
"text"
],
"reporter": ["html", "text"],
"lines": 100,
"branches": "96",
"statements": "100"
Expand Down
4 changes: 2 additions & 2 deletions .prettierrc.cjs
@@ -1,3 +1,3 @@
module.exports = {
...require('gts/.prettierrc.json')
}
...require('gts/.prettierrc.json'),
};
279 changes: 121 additions & 158 deletions CHANGELOG.md

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Expand Up @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down
123 changes: 70 additions & 53 deletions README.md
Expand Up @@ -16,12 +16,13 @@
[![Slack][slack-image]][slack-url]

## Description

Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.

It gives you:

* commands and (grouped) options (`my-program.js serve --port=5000`).
* a dynamically generated help menu based on your arguments:
- commands and (grouped) options (`my-program.js serve --port=5000`).
- a dynamically generated help menu based on your arguments:

```
mocha [spec..]
Expand All @@ -38,17 +39,19 @@ Rules & Behavior
return a Promise [boolean]
```

* bash-completion shortcuts for commands and options.
* and [tons more](/docs/api.md).
- bash-completion shortcuts for commands and options.
- and [tons more](/docs/api.md).

## Installation

Stable version:

```bash
npm i yargs
```

Bleeding edge version with the most recent features:

```bash
npm i yargs@next
```
Expand All @@ -59,14 +62,14 @@ npm i yargs@next

```javascript
#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const argv = yargs(hideBin(process.argv)).argv
const yargs = require('yargs/yargs');
const {hideBin} = require('yargs/helpers');
const argv = yargs(hideBin(process.argv)).argv;

if (argv.ships > 3 && argv.distance < 53.5) {
console.log('Plunder more riffiwobbles!')
console.log('Plunder more riffiwobbles!');
} else {
console.log('Retreat from the xupptumblers!')
console.log('Retreat from the xupptumblers!');
}
```

Expand All @@ -84,26 +87,30 @@ Retreat from the xupptumblers!

```javascript
#!/usr/bin/env node
const yargs = require('yargs/yargs')
const { hideBin } = require('yargs/helpers')
const yargs = require('yargs/yargs');
const {hideBin} = require('yargs/helpers');

yargs(hideBin(process.argv))
.command('serve [port]', 'start the server', (yargs) => {
return yargs
.positional('port', {
.command(
'serve [port]',
'start the server',
yargs => {
return yargs.positional('port', {
describe: 'port to bind on',
default: 5000
})
}, (argv) => {
if (argv.verbose) console.info(`start server on :${argv.port}`)
serve(argv.port)
})
default: 5000,
});
},
argv => {
if (argv.verbose) console.info(`start server on :${argv.port}`);
serve(argv.port);
}
)
.option('verbose', {
alias: 'v',
type: 'boolean',
description: 'Run with verbose logging'
description: 'Run with verbose logging',
})
.parse()
.parse();
```

Run the example above with `--help` to see the help for the application.
Expand All @@ -125,36 +132,46 @@ See usage examples in [docs](/docs/typescript.md).
As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):

```typescript
import yargs from 'https://deno.land/x/yargs/deno.ts'
import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'
import yargs from 'https://deno.land/x/yargs/deno.ts';
import {Arguments} from 'https://deno.land/x/yargs/deno-types.ts';

yargs(Deno.args)
.command('download <files...>', 'download a list of files', (yargs: any) => {
return yargs.positional('files', {
describe: 'a list of files to do something with'
})
}, (argv: Arguments) => {
console.info(argv)
})
.command(
'download <files...>',
'download a list of files',
(yargs: any) => {
return yargs.positional('files', {
describe: 'a list of files to do something with',
});
},
(argv: Arguments) => {
console.info(argv);
}
)
.strictCommands()
.demandCommand(1)
.parse()
.parse();
```

### ESM

As of `v16`,`yargs` supports ESM imports:

```js
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
import yargs from 'yargs';
import {hideBin} from 'yargs/helpers';

yargs(hideBin(process.argv))
.command('curl <url>', 'fetch the contents of the URL', () => {}, (argv) => {
console.info(argv)
})
.command(
'curl <url>',
'fetch the contents of the URL',
() => {},
argv => {
console.info(argv);
}
)
.demandCommand(1)
.parse()
.parse();
```

### Usage in Browser
Expand All @@ -169,21 +186,21 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc

### Table of Contents

* [Yargs' API](/docs/api.md)
* [Examples](/docs/examples.md)
* [Parsing Tricks](/docs/tricks.md)
* [Stop the Parser](/docs/tricks.md#stop)
* [Negating Boolean Arguments](/docs/tricks.md#negate)
* [Numbers](/docs/tricks.md#numbers)
* [Arrays](/docs/tricks.md#arrays)
* [Objects](/docs/tricks.md#objects)
* [Quotes](/docs/tricks.md#quotes)
* [Advanced Topics](/docs/advanced.md)
* [Composing Your App Using Commands](/docs/advanced.md#commands)
* [Building Configurable CLI Apps](/docs/advanced.md#configuration)
* [Customizing Yargs' Parser](/docs/advanced.md#customizing)
* [Bundling yargs](/docs/bundling.md)
* [Contributing](/contributing.md)
- [Yargs' API](/docs/api.md)
- [Examples](/docs/examples.md)
- [Parsing Tricks](/docs/tricks.md)
- [Stop the Parser](/docs/tricks.md#stop)
- [Negating Boolean Arguments](/docs/tricks.md#negate)
- [Numbers](/docs/tricks.md#numbers)
- [Arrays](/docs/tricks.md#arrays)
- [Objects](/docs/tricks.md#objects)
- [Quotes](/docs/tricks.md#quotes)
- [Advanced Topics](/docs/advanced.md)
- [Composing Your App Using Commands](/docs/advanced.md#commands)
- [Building Configurable CLI Apps](/docs/advanced.md#configuration)
- [Customizing Yargs' Parser](/docs/advanced.md#customizing)
- [Bundling yargs](/docs/bundling.md)
- [Contributing](/contributing.md)

## Supported Node.js Versions

Expand Down
12 changes: 6 additions & 6 deletions contributing.md
Expand Up @@ -9,12 +9,12 @@ If you are looking to update the website, check out [yargs/yargs.github.io](http
1. Look through the existing issues and see if your idea is something new.
2. Create a new issue, or comment on an existing issue that you would like
to help solve:
* it's usually best to get some feedback before proceeding to write code.
- it's usually best to get some feedback before proceeding to write code.
3. fork the yargs repo, and clone it to your computer:
* GitHub has [great documentation](https://help.github.com/articles/using-pull-requests/) regarding writing your first pull request.
- GitHub has [great documentation](https://help.github.com/articles/using-pull-requests/) regarding writing your first pull request.
4. make sure that you write unit-test for any code that you write for yargs:
* we use the [standard](https://github.com/feross/standard) coding style,
which will validate your style when you run tests.
* look through our extensive test suite in `/test` to get an idea for how
to write unit-tests for this codebase.
- we use the [standard](https://github.com/feross/standard) coding style,
which will validate your style when you run tests.
- look through our extensive test suite in `/test` to get an idea for how
to write unit-tests for this codebase.
5. make sure you are comfortable with the Code of Conduct outlined below.

0 comments on commit f9d5869

Please sign in to comment.