Socket
Socket
Sign inDemoInstall

@oclif/core

Package Overview
Dependencies
Maintainers
2
Versions
396
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/core - npm Package Compare versions

Comparing version 4.0.14 to 4.0.15

7

lib/parser/parse.js

@@ -306,9 +306,14 @@ "use strict";

if (fws.inputFlag.flag.type === 'option' && fws.inputFlag.flag.delimiter && fws.inputFlag.flag.multiple) {
// regex that will identify unescaped delimiters
const makeDelimiter = (delimiter) => new RegExp(`(?<!\\\\)${delimiter}`);
return {
...fws,
valueFunction: async (i) => (await Promise.all((i.tokens ?? [])
.flatMap((token) => token.input.split(i.inputFlag.flag.delimiter ?? ','))
.flatMap((token) => token.input.split(makeDelimiter(i.inputFlag.flag.delimiter ?? ',')))
// trim, and remove surrounding doubleQuotes (which would hav been needed if the elements contain spaces)
.map((v) => v
.trim()
// remove escaped characters from delimiter
// example: --opt="a\,b,c" -> ["a,b", "c"]
.replaceAll(new RegExp(`\\\\${i.inputFlag.flag.delimiter}`, 'g'), i.inputFlag.flag.delimiter ?? ',')
.replace(/^"(.*)"$/, '$1')

@@ -315,0 +320,0 @@ .replace(/^'(.*)'$/, '$1'))

2

package.json
{
"name": "@oclif/core",
"description": "base library for oclif CLIs",
"version": "4.0.14",
"version": "4.0.15",
"author": "Salesforce",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/oclif/core/issues",

@@ -104,4 +104,28 @@ <img src="https://user-images.githubusercontent.com/449385/38243295-e0a47d58-372e-11e8-9bc0-8c02a6f4d2ac.png" width="260" height="73">

You can also use oclif's `Parser` separately:
```javascript
// index.js
import {Args, Flags, Parser} from '@oclif/core'
const {args, flags} = await Parser.parse(process.argv.slice(2), {
args: {
name: Args.string({required: true}),
},
flags: {
from: Flags.string({char: 'f', default: 'oclif'}),
},
})
console.log(`hello ${args.name} from ${flags.form}`)
```
```
$ node index.js world --from oclif
hello world from oclif
```
🚀 Contributing
See the [contributing guide](./CONRTIBUTING.md).
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