Skip to content

A CLI params parsing library that does nothing else for you

Notifications You must be signed in to change notification settings

cfv1984/cli-params

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pasamanos:

A CLI parameter parser that makes 0 decisions about how you structure your project.

Usage

First, obviously, npm install pasamanos.

In your code:

import { params } from 'pasamanos'

const fromCLI = params(process.argv, {
    'verbose':'v',
    'force':'f'
});

// or maybe take key=value pairs from somewhere else? I won't judge you.
const fromSomewhereElse = params(['-f=false','-v','--very-long-flag'], {
    'verbose':'v',
    'force':'f'
});

if(fromCli.verbose){
    // say something
}

or

const { params } = require('pasamanos');

Troubleshooting

I get some variant of Error [ERR_REQUIRE_ESM] when using your module
Turns out using `microbundle` to ensure compatibility between ESM and CommonJS and such
uncovered a whole rat king worth of flags and version compatibility issues. 
Sorry about that.
If you encounter this error, your best choice is requiring `pasamanos/dist/index.cjs`
instead of the default `pasamanos`. 
Is this production ready?
I mean it's below 0.1 yet but you do you.

About

A CLI params parsing library that does nothing else for you

Resources

Stars

Watchers

Forks

Packages

No packages published