
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
discord-cmd-parser
Advanced tools
yarn add discord-cmd-parser
or
npm install discord-cmd-parser
// Import package in your project
const Parser = require('discord-cmd-parser');
// Initialize with or without options
const parser = Parser.createParser()
// args and commands always tranfroms to lower case excemp names of the args and args in quotes
// parse()
console.log(parser.parse('git remote add origin https://github.com')) // ---> {_:['git', 'remote', 'add', 'origin', 'https://github.com']}
// Or with args definition
console.log(parser.parse('git remote add origin https://github.com', ['command', 'arg1', 'arg2', 'arg3'])) // ---> {_:['https://github.com'], command: 'git', arg1: 'remote', arg2: 'add', arg3: 'origin'}
// Also you can use quotes to define long args with spaces and new lines
console.log(parser.parse(`command "super long arg with spaces or tabs
or newlines" https://github.com`), ['command', 'longArg', 'link']) // ---> {_:[], command: 'command', longarg: 'super long arg with spaces or tabs or newlines', link: 'https://github.com'}
// Multiple spaces, tabs and new lines always will be converted to one space
console.log(parser.parse(`command "super long arg with spaces or tabs
or newlines" https://git hub.com `), ['command', 'longArg', 'link']) // ---> {_:['hub.com'], command: 'command', longArg: 'super long arg with spaces or tabs or newlines', link: 'https://git'}
console.log(parser.parseCommandArgs( parser.parse(`git remote test1 test2`), {command: { default: ""}, arg1: { default: "asdas" }, arg2: { default: "odd" }})) // ---> {_: ["test2"], command: 'git', arg1: 'remote',arg2: 'test1'}
| Method | return | Description |
|---|---|---|
| parse(string: string) | []string | Parses string into args. |
| parseCommandArgs(parsedMessage: string[], commandArgsDef: IargsDefinition[]) | Object | assign parsed string to args. |
| disableQuotes() | void | Disables parsing args in quotes as one. |
| enableQuotes() | void | Enable parsing args in quotes as one. |
| changeQuotesType(value: string) | void | Change quotes type. |
| Option | Type | Deffault | Description |
|---|---|---|---|
| useQuotes | boolean | true | if false quotes will be ignored |
| quotesType | string | " | symbol to separate long arg |
Copyright (c) 2021 Andrew t.rumibul.work@gmail.com
FAQs
Parser for discord chat commands
The npm package discord-cmd-parser receives a total of 1 weekly downloads. As such, discord-cmd-parser popularity was classified as not popular.
We found that discord-cmd-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.