Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oclif/plugin-search

Package Overview
Dependencies
Maintainers
0
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/plugin-search - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5-dev.0

26

dist/commands/search.js

@@ -7,4 +7,5 @@ /*

*/
import { Command, loadHelpClass, toConfiguredId, toStandardizedId } from '@oclif/core';
import { Command, loadHelpClass, toConfiguredId, toStandardizedId, ux } from '@oclif/core';
import autocomplete from 'inquirer-autocomplete-standalone';
import readline from 'node:readline';
export default class Search extends Command {

@@ -14,2 +15,5 @@ static description = 'Once you select a command, hit enter and it will show the help for that command.';

async run() {
this.log(`Interactively search the catalog of ${this.config.bin} commands.
Use ${ux.colorize('bold', '↑')} and ${ux.colorize('bold', '↓')} keys or type to search. Press ${ux.colorize('bold', 'ESC')} to exit.
`);
const commandChoices = this.config.commands

@@ -26,6 +30,6 @@ .filter((c) => !c.hidden && !c.aliases.includes(c.id))

});
const command = await autocomplete({
const commandPromise = autocomplete({
emptyText: 'Nothing found!',
message: 'Search for a command',
pageSize: 10,
pageSize: Math.floor(process.stdout.rows < 20 ? process.stdout.rows / 2 : 10),
async source(input) {

@@ -35,2 +39,18 @@ return input ? commandChoices.filter((c) => c.name.includes(input)) : commandChoices;

});
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);
process.stdin.on('keypress', (_, key) => {
if (key.name === 'escape') {
commandPromise.cancel();
}
});
const command = await commandPromise
.catch((error) => {
if (error.message === 'Prompt was canceled')
return;
throw error;
})
.then((result) => result);
if (!command)
return;
const Help = await loadHelpClass(this.config);

@@ -37,0 +57,0 @@ const help = new Help(this.config, this.config.pjson.oclif.helpOptions ?? this.config.pjson.helpOptions);

2

oclif.manifest.json

@@ -29,3 +29,3 @@ {

},
"version": "1.1.4"
"version": "1.1.5-dev.0"
}
{
"name": "@oclif/plugin-search",
"version": "1.1.4",
"version": "1.1.5-dev.0",
"description": "A command for searching commands",

@@ -29,4 +29,4 @@ "author": "Salesforce",

"mocha": "^10.4.0",
"oclif": "^4.13.2",
"prettier": "^3.3.1",
"oclif": "^4.13.6",
"prettier": "^3.3.2",
"shx": "^0.3.3",

@@ -33,0 +33,0 @@ "ts-node": "^10.9.2",

@@ -25,3 +25,3 @@ # @oclif/plugin-search

$ @oclif/plugin-search (--version)
@oclif/plugin-search/1.1.4 linux-x64 node-v20.14.0
@oclif/plugin-search/1.1.5-dev.0 linux-x64 node-v20.14.0
$ @oclif/plugin-search --help [COMMAND]

@@ -53,3 +53,3 @@ USAGE

_See code: [src/commands/search.ts](https://github.com/oclif/plugin-search/blob/v1.1.4/src/commands/search.ts)_
_See code: [src/commands/search.ts](https://github.com/oclif/plugin-search/blob/v1.1.5-dev.0/src/commands/search.ts)_
<!-- commandsstop -->

@@ -56,0 +56,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc