Skip to content

Converts command-line arguments to function arguments - for simple CLI programs.

Notifications You must be signed in to change notification settings

airportyh/cmd-ln

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmd-ln

Converts command-line arguments to function arguments - for simple CLI programs.

Install

npm install cmd-ln

Usage

program:

#! /usr/bin/env node
var cmdLn = require('cmd-ln')

cmdLn(function(action, subject){
  console.log('I am going to do', action, 'with', subject + '.')
})

Running that and get.

$ program make lemonade
I am going to do make with lemonade.
$ program make
Usage: program <action> <subject>
$ program
Usage: program <action> <subject>

Optional Parameters

You can specify optional parameters using a leading underscore:

cmdLn(function(_url){
  var url = _url || 'http://google.com'
  console.log(url)
})

About

Converts command-line arguments to function arguments - for simple CLI programs.

Resources

Stars

Watchers

Forks

Packages

No packages published