Skip to content

Commit 98470e9

Browse files
committed
fix: standardize string quotes in README files
1 parent ed09a59 commit 98470e9

File tree

2 files changed

+62
-66
lines changed

2 files changed

+62
-66
lines changed

README-CN.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![npm download](https://img.shields.io/npm/dm/@axiosleo/cli-tool.svg?style=flat-square)](https://npmjs.org/package/@axiosleo/cli-tool)
77
[![node version](https://img.shields.io/badge/node.js-%3E=_14.0-green.svg?style=flat-square)](http://nodejs.org/download/)
88
[![CI Build Status](https://github.com/AxiosLeo/node-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/AxiosLeo/node-cli/actions/workflows/ci.yml)
9-
[![](https://codecov.io/gh/AxiosLeo/node-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/AxiosLeo/node-cli)
9+
[![Codecov](https://codecov.io/gh/AxiosLeo/node-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/AxiosLeo/node-cli)
1010
[![License](https://img.shields.io/github/license/AxiosLeo/node-cli?color=%234bc524)](LICENSE)
1111
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FAxiosLeo%2Fnode-cli.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FAxiosLeo%2Fnode-cli/refs/branch/master)
1212

@@ -60,7 +60,7 @@ app.start();
6060
- 通过 Command 类注册命令
6161

6262
```js
63-
const CommandExample = require('/path/to/your/command/file');
63+
const CommandExample = require("/path/to/your/command/file");
6464
app.register(CommandExample);
6565

6666
app.exec("<command-name>");
@@ -69,7 +69,7 @@ app.exec("<command-name>");
6969
- 通过 Command 对象注册命令
7070

7171
```js
72-
const CommandExample = require('/path/to/your/command/file');
72+
const CommandExample = require("/path/to/your/command/file");
7373
const command = new CommandExample();
7474
app.register(command);
7575

@@ -79,7 +79,7 @@ app.exec("<command-name>");
7979
- 通过 Command 文件地址注册命令
8080

8181
```js
82-
app.register('/path/to/your/command/file');
82+
app.register("/path/to/your/command/file");
8383

8484
app.exec("<command-name>");
8585
```
@@ -93,27 +93,27 @@ app.exec("<command-name>");
9393
> 详见 [locales wiki](https://github.com/AxiosLeo/node-cli/wiki/locales)
9494
9595
```js
96-
const path = require('path');
96+
const path = require("path");
9797
app.locale({
98-
dir: path.join(__dirname, '../locales'), // /path/to/app/locales/dir
99-
sets: ['en-US', 'zh-CN'], // 不能为空, 且第一个元素为默认值
98+
dir: path.join(__dirname, "../locales"), // /path/to/app/locales/dir
99+
sets: ["en-US", "zh-CN"], // 不能为空, 且第一个元素为默认值
100100
});
101101
app.start(); // 需要在调用 app.start() 方法前配置 locale
102102
```
103103

104104
### 命令类示例
105105

106106
```js
107-
'use strict';
107+
"use strict";
108108

109-
const { Command } = require('@axiosleo/cli-tool');
109+
const { Command } = require("@axiosleo/cli-tool");
110110

111111
class CommandExample extends Command {
112112
constructor() {
113113
super({
114-
name: 'command-name',
115-
desc: 'command desc',
116-
alias: ['command-alia1', 'command-alia2'],
114+
name: "command-name",
115+
desc: "command desc",
116+
alias: ["command-alia1", "command-alia2"],
117117
});
118118

119119
/**
@@ -123,7 +123,7 @@ class CommandExample extends Command {
123123
* @param mode argument mode : required | optional
124124
* @param default_value only supported on optional mode
125125
*/
126-
this.addArgument('arg-name', 'desc', 'required', null);
126+
this.addArgument("arg-name", "desc", "required", null);
127127

128128
/**
129129
* add option of current command
@@ -133,35 +133,33 @@ class CommandExample extends Command {
133133
* @param mode option mode : required | optional
134134
* @param default_value only supported on optional mode
135135
*/
136-
this.addOption('test', 't', 'desc', 'required', null);
136+
this.addOption("test", "t", "desc", "required", null);
137137
}
138138

139139
async exec(args, options, argList, app) {
140-
// do something in here
140+
// do something in here
141141

142-
// get arg&option by name
143-
const arg1 = args.argName;
144-
const option1 = options.optionName;
142+
// get arg&option by name
143+
const arg1 = args.argName;
144+
const option1 = options.optionName;
145145

146-
// get arg by index
147-
const index = 0;
148-
const arg2 = argList[index];
146+
// get arg by index
147+
const index = 0;
148+
const arg2 = argList[index];
149149

150-
// ask for answer
151-
const answer = await this.ask('Please input your answer');
150+
// ask for answer
151+
const answer = await this.ask("Please input your answer");
152152

153-
// ask for confirm, default value is 'false'
154-
const confirm = await this.confirm('Confirm do this now?', false);
153+
// ask for confirm, default value is 'false'
154+
const confirm = await this.confirm("Confirm do this now?", false);
155155

156-
// select action
157-
const action = await this.select('Select an action', ['info', 'update']);
156+
// select action
157+
const action = await this.select("Select an action", ["info", "update"]);
158158

159-
// print table
160-
const rows = [
161-
['Bob', 2]
162-
];
163-
const head = ['Name', 'Score'];
164-
this.table(rows, head);
159+
// print table
160+
const rows = [["Bob", 2]];
161+
const head = ["Name", "Score"];
162+
this.table(rows, head);
165163
}
166164
}
167165

README.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ English | [简体中文](/README-CN.md)
66
[![npm download](https://img.shields.io/npm/dm/@axiosleo/cli-tool.svg?style=flat-square)](https://npmjs.org/package/@axiosleo/cli-tool)
77
[![node version](https://img.shields.io/badge/node.js-%3E=_14.0-green.svg?style=flat-square)](http://nodejs.org/download/)
88
[![CI Build Status](https://github.com/AxiosLeo/node-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/AxiosLeo/node-cli/actions/workflows/ci.yml)
9-
[![](https://codecov.io/gh/AxiosLeo/node-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/AxiosLeo/node-cli)
9+
[![Codecov](https://codecov.io/gh/AxiosLeo/node-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/AxiosLeo/node-cli)
1010
[![License](https://img.shields.io/github/license/AxiosLeo/node-cli?color=%234bc524)](LICENSE)
1111
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FAxiosLeo%2Fnode-cli.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FAxiosLeo%2Fnode-cli/refs/branch/master)
1212

@@ -60,7 +60,7 @@ app.start();
6060
- register with command class
6161

6262
```js
63-
const CommandExample = require('/path/to/your/command/file');
63+
const CommandExample = require("/path/to/your/command/file");
6464
app.register(CommandExample);
6565

6666
app.exec("<command-name>");
@@ -69,7 +69,7 @@ app.exec("<command-name>");
6969
- register with command object
7070

7171
```js
72-
const CommandExample = require('/path/to/your/command/file');
72+
const CommandExample = require("/path/to/your/command/file");
7373
const command = new CommandExample();
7474
app.register(command);
7575

@@ -79,7 +79,7 @@ app.exec("<command-name>");
7979
- register with command file path
8080

8181
```js
82-
app.register('/path/to/your/command/file');
82+
app.register("/path/to/your/command/file");
8383

8484
app.exec("<command-name>");
8585
```
@@ -93,27 +93,27 @@ app.exec("<command-name>");
9393
> see detail from [locales wiki](https://github.com/AxiosLeo/node-cli/wiki/locales)
9494
9595
```js
96-
const path = require('path');
96+
const path = require("path");
9797
app.locale({
98-
dir: path.join(__dirname, '../locales'), // /path/to/app/locales/dir
99-
sets: ['en-US', 'zh-CN'], // cannot be empty, the first set as default.
98+
dir: path.join(__dirname, "../locales"), // /path/to/app/locales/dir
99+
sets: ["en-US", "zh-CN"], // cannot be empty, the first set as default.
100100
});
101101
app.start(); // set locale before start app
102102
```
103103

104104
### Command Class Example
105105

106106
```js
107-
'use strict';
107+
"use strict";
108108

109-
const { Command } = require('@axiosleo/cli-tool');
109+
const { Command } = require("@axiosleo/cli-tool");
110110

111111
class CommandExample extends Command {
112112
constructor() {
113113
super({
114-
name: 'command-name',
115-
desc: 'command desc',
116-
alias: ['command-alia1', 'command-alia2'],
114+
name: "command-name",
115+
desc: "command desc",
116+
alias: ["command-alia1", "command-alia2"],
117117
});
118118

119119
/**
@@ -123,7 +123,7 @@ class CommandExample extends Command {
123123
* @param mode argument mode : required | optional
124124
* @param default_value only supported on optional mode
125125
*/
126-
this.addArgument('arg-name', 'desc', 'required', null);
126+
this.addArgument("arg-name", "desc", "required", null);
127127

128128
/**
129129
* add option of current command
@@ -133,35 +133,33 @@ class CommandExample extends Command {
133133
* @param mode option mode : required | optional
134134
* @param default_value only supported on optional mode
135135
*/
136-
this.addOption('test', 't', 'desc', 'required', null);
136+
this.addOption("test", "t", "desc", "required", null);
137137
}
138138

139139
async exec(args, options, argList, app) {
140-
// do something in here
140+
// do something in here
141141

142-
// get arg&option by name
143-
const arg1 = args.argName;
144-
const option1 = options.optionName;
142+
// get arg&option by name
143+
const arg1 = args.argName;
144+
const option1 = options.optionName;
145145

146-
// get arg by index
147-
const index = 0;
148-
const arg2 = argList[index];
146+
// get arg by index
147+
const index = 0;
148+
const arg2 = argList[index];
149149

150-
// ask for answer
151-
const answer = await this.ask('Please input your answer');
150+
// ask for answer
151+
const answer = await this.ask("Please input your answer");
152152

153-
// ask for confirm, default value is 'false'
154-
const confirm = await this.confirm('Confirm do this now?', false);
153+
// ask for confirm, default value is 'false'
154+
const confirm = await this.confirm("Confirm do this now?", false);
155155

156-
// select action
157-
const action = await this.select('Select an action', ['info', 'update']);
156+
// select action
157+
const action = await this.select("Select an action", ["info", "update"]);
158158

159-
// print table
160-
const rows = [
161-
['Bob', 2]
162-
];
163-
const head = ['Name', 'Score'];
164-
this.table(rows, head);
159+
// print table
160+
const rows = [["Bob", 2]];
161+
const head = ["Name", "Score"];
162+
this.table(rows, head);
165163
}
166164
}
167165

0 commit comments

Comments
 (0)