@oclif/plugin-search 0.0.24 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -4
- package/bin/dev.js +8 -0
- package/bin/run.js +9 -0
- package/dist/commands/search.d.ts +1 -1
- package/dist/commands/search.js +24 -42
- package/dist/index.js +1 -5
- package/oclif.lock +6691 -0
- package/oclif.manifest.json +21 -9
- package/package.json +46 -39
- package/bin/dev +0 -17
- package/bin/run +0 -5
- package/dist/util/autocomplete.d.ts +0 -61
- package/dist/util/autocomplete.js +0 -250
package/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
@oclif/plugin-search
|
|
2
|
-
=================
|
|
1
|
+
# @oclif/plugin-search
|
|
3
2
|
|
|
4
3
|
A `search` command for your oclif CLI
|
|
5
4
|
|
|
@@ -10,24 +9,29 @@ A `search` command for your oclif CLI
|
|
|
10
9
|
[](https://github.com/oclif/plugin-search/blob/main/package.json)
|
|
11
10
|
|
|
12
11
|
<!-- toc -->
|
|
12
|
+
* [@oclif/plugin-search](#oclifplugin-search)
|
|
13
13
|
* [Usage](#usage)
|
|
14
14
|
* [Commands](#commands)
|
|
15
15
|
<!-- tocstop -->
|
|
16
|
+
|
|
16
17
|
# Usage
|
|
18
|
+
|
|
17
19
|
<!-- usage -->
|
|
18
20
|
```sh-session
|
|
19
21
|
$ npm install -g @oclif/plugin-search
|
|
20
22
|
$ @oclif/plugin-search COMMAND
|
|
21
23
|
running command...
|
|
22
24
|
$ @oclif/plugin-search (--version)
|
|
23
|
-
@oclif/plugin-search/
|
|
25
|
+
@oclif/plugin-search/1.0.1 linux-x64 node-v18.18.0
|
|
24
26
|
$ @oclif/plugin-search --help [COMMAND]
|
|
25
27
|
USAGE
|
|
26
28
|
$ @oclif/plugin-search COMMAND
|
|
27
29
|
...
|
|
28
30
|
```
|
|
29
31
|
<!-- usagestop -->
|
|
32
|
+
|
|
30
33
|
# Commands
|
|
34
|
+
|
|
31
35
|
<!-- commands -->
|
|
32
36
|
* [`@oclif/plugin-search search`](#oclifplugin-search-search)
|
|
33
37
|
|
|
@@ -45,5 +49,5 @@ DESCRIPTION
|
|
|
45
49
|
Once you select a command, hit enter and it will show the help for that command.
|
|
46
50
|
```
|
|
47
51
|
|
|
48
|
-
_See code: [src/commands/search.ts](https://github.com/oclif/plugin-search/blob/
|
|
52
|
+
_See code: [src/commands/search.ts](https://github.com/oclif/plugin-search/blob/v1.0.1/src/commands/search.ts)_
|
|
49
53
|
<!-- commandsstop -->
|
package/bin/dev.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
|
|
2
|
+
// eslint-disable-next-line node/shebang
|
|
3
|
+
async function main() {
|
|
4
|
+
const {execute} = await import('@oclif/core')
|
|
5
|
+
await execute({development: true, dir: import.meta.url})
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
await main()
|
package/bin/run.js
ADDED
package/dist/commands/search.js
CHANGED
|
@@ -1,52 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
3
|
* All rights reserved.
|
|
5
4
|
* Licensed under the BSD 3-Clause license.
|
|
6
5
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { Command, toConfiguredId, toStandardizedId } from '@oclif/core';
|
|
8
|
+
import autocomplete from 'inquirer-autocomplete-standalone';
|
|
9
|
+
export default class Search extends Command {
|
|
10
|
+
static description = 'Once you select a command, hit enter and it will show the help for that command.';
|
|
11
|
+
static summary = 'Search for a command.';
|
|
13
12
|
async run() {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
shouldSort: true,
|
|
32
|
-
threshold: 0.25,
|
|
33
|
-
ignoreLocation: true,
|
|
34
|
-
},
|
|
35
|
-
displayKey: 'readableId',
|
|
36
|
-
options: commands,
|
|
37
|
-
footer: (currentChoices, index) => {
|
|
38
|
-
const cmd = commands.find(c => c.readableId === currentChoices.getChoice(index).value);
|
|
39
|
-
if (cmd && cmd.summary)
|
|
40
|
-
return cmd.summary;
|
|
41
|
-
},
|
|
13
|
+
const commandChoices = this.config.commands
|
|
14
|
+
.filter((c) => !c.hidden && !c.aliases.includes(c.id))
|
|
15
|
+
.sort((a, b) => a.id.localeCompare(b.id))
|
|
16
|
+
.map((c) => {
|
|
17
|
+
const name = toConfiguredId(c.id, this.config);
|
|
18
|
+
return {
|
|
19
|
+
description: c.summary,
|
|
20
|
+
name,
|
|
21
|
+
value: name,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
const command = await autocomplete({
|
|
25
|
+
emptyText: 'Nothing found!',
|
|
26
|
+
message: 'Search for a command',
|
|
27
|
+
pageSize: 10,
|
|
28
|
+
async source(input) {
|
|
29
|
+
return input ? commandChoices.filter((c) => c.name.includes(input)) : commandChoices;
|
|
42
30
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return this.config.runCommand((0, core_1.toStandardizedId)(command, this.config), []);
|
|
46
|
-
}
|
|
47
|
-
return this.config.runCommand('help', [(0, core_1.toStandardizedId)(command, this.config)]);
|
|
31
|
+
});
|
|
32
|
+
return this.config.runCommand('help', [toStandardizedId(command, this.config)]);
|
|
48
33
|
}
|
|
49
34
|
}
|
|
50
|
-
exports.default = Search;
|
|
51
|
-
Search.summary = 'Search for a command.';
|
|
52
|
-
Search.description = 'Once you select a command, hit enter and it will show the help for that command.';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.run = void 0;
|
|
4
|
-
var core_1 = require("@oclif/core");
|
|
5
|
-
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
|
|
1
|
+
export { run } from '@oclif/core';
|