@npalenchar/giftwrap

0.9.81-beta • Public • Published

gift-wrap

Make JS functions into CLI processes!

Example

// hello.js
function hello(name="world", greeter="computer"){
  console.log(`Hello ${name}! My name is ${greeter}\n`);
}

Open the command line in the root where the js file lives and type

$ giftwrap # go through interactive steps.

Or:

$ giftwrap --file=path/to/hello.js --cli-name=greet

You now have a cli named greet, that you can use, passing custom arguments!

$ greet Nick 'gift wrap' # positional arguments
Hello, Nick! my name is gift wrap

$ greet --greeter='gift wrap' # you can name arguments based on parameters from the js (camelCase converted to snake-case)
Hello world! my name is gift wrap

$ greet --name=path/to/myName.txt --greeter=/absolute/path/to/greeter.txt # you can pass files (parsed as strings) with named arguments
Hello, Nick! my name is gift wrap

$ greet --name='twitter/palencharizard' # use quotes to pass arguments with slashes to avoid parsing as file path
Hello, twitter/palencharizard! my name is gift wrap

Installation/Getting Started

Get the CLI.

$ npm i -g @npalenchar/giftwrap

Let giftwrap set itself up

$ [sudo] giftwrap

After that, run wherever you want to turn a js function into a CLI! giftwrap will walk you through the process and prompt you when needed. But if you'd like to get more in depth, visit the API Page.

Readme

Keywords

none

Package Sidebar

Install

npm i @npalenchar/giftwrap

Weekly Downloads

1

Version

0.9.81-beta

License

ISC

Unpacked Size

270 kB

Total Files

117

Last publish

Collaborators

  • npalenchar