New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cltags

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cltags

Lightweight library for parsing process.argv

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ClTags

A Lightweight Node.JS module for parsing process.argv

Code Example

var tags = require("cltags");
var options = tags.parse(process.argv);

Thats really all their is to it, so for example if you ran your script with:

node script_name search --recursive --filetype="js" demo search query

You would get back from the tags.parse command an object that looks like:

{
  command: "search",
  filetype: "js",
  recursive: true,
  query: "demo search query"
}

Other features

  • Defaults - the second parameter is an optional list of defaults which will get returned in the object unless overridden
  • Short Formed Tags - the third parameter is a list of replacements for short tags

All together it would look something like the following:

var tags = require("cltags");

var defaults = {
  depth: 2,
  recursive: false
}

var replacements = {
  d: "depth",
  r: "recursive"
}

var options = tags.parse(process.argv, defaults, replacements);

You can then run something like:

script_name -r

and get back an object like:

{
  command: "",
  query: "",
  depth: 2,
  recursive: true
}

Keywords

FAQs

Package last updated on 25 Sep 2013

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