Giter VIP home page Giter VIP logo

sendak-usage's Introduction

sendak-usage

It became clear after writing the bulk of Sendak's command-line components that a common "header" accompanied each task that included the command-line options, their long- and short- arguments, defaults, and descriptions, from which nopt-usage would generate a "usage" statement and nopt would do the actual parsedown into a hash.

But this was big and sprawling and when @konklone said to me that he uses minimist, I was peeved because I wanted to be able to switch and realised I had coded myself into this nopt and nopt-usage-shaped corner where I could not just forklift in minimist if I wanted to.

Accordingly I wrote this tiny package to abstract away the command-line parser I am using with usage stuff into a single hash so that I am not dependent on the vagaries of other packages (ahem, looking at you, nopt-usageโ€ฆ) that may or may not be actually maintained.

It is published here primarily so that Sendak can require it, but you should feel comfortable that it will continue to be maintained for at least as long as Sendak is if it is useful to you.

Usage

From the original issue:

var parsed = require( 'sendak-usage' ).parse( {
  // This is a full argument declaration
  //
  'help': {
    'long-args': [ 'help', 'halp' ],
    'description': 'sets the helpful bit',
    'short-args': [ 'h' ],
    'default': false
    'type': [ Boolean ]
  },
  // But all you need to do is specify the type of argument you want.
  //
  'long-arg-name': { 'type': [ Boolean ] }
} );

Author

@avriette, [email protected]

sendak-usage's People

Contributors

janearc avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

sendak-usage's Issues

default support for version number

some method to discern what version of the software we're running.

the problem is when i say foo --help it does not tell me what version of foo is installed, which is a pain when there is npm install -g foo action happening.

default handler for help

I include --help in all my tools, so provide that by default.

  'help' : { 
    'long-args'   : [ 'help' ],
    'description' : 'Halp the user.',
    'type'        : [ Boolean ]
  },

no need to repeat this in code everywhere.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.