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

@keg-hub/args-parse

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keg-hub/args-parse

Parse command line arguments

  • 8.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
increased by55.56%
Maintainers
3
Weekly downloads
 
Created
Source

argsParse

Parse command line arguments

Setup

Install It

Add to your package.json

  "argsParse": "git+https://github.com/keg-hub/argsParse.git"

Use It

See test examples

;(() => {

  const { argsParse } = require('argsParse')
  const task = {
    options: {
      // Define required
      doo: {
        description: "dew the doo",
        require: true,
      },
      // Define defaults
      foo: {
        description: 'I am foo bar',
        default: 'bar'
      },
      baz: {
      // Define alias
        alias: [ 'zoo' ],
        description: 'The baz with bas',
      },
    }
  }
  
  const parsed = await argsParse({
    task,
    args: [ 'doo=f', '--zoo', 'bas', ],
  })
  
  expect(parsed.doo).toBe(false)
  expect(parsed.foo).toBe('bar')
  expect(parsed.baz).toBe('bas')

})()

Custom Config

  • Use the PARSE_CONFIG_PATH environment vairable to overwrite the path to the parse config
    • Path should be relative to the applications root directory
  • See default config
  • Custom Configs should match the keys within the default config
    • bools && environment

Keywords

FAQs

Package last updated on 10 Mar 2022

Did you know?

Socket

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.

Install

Related posts

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