A low-ceremony toolkit for building CLIs.
JavaScript HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
github
packages
.editorconfig
.gitattributes
.gitignore
LICENSE
lerna.json
package.json
readme.md

readme.md

gluegun

gluegun is a toolkit for building CLIs.

We assembled an all-star cast of outstanding & focused libraries, added a plugin layer, then wrapped it up in an ease-to-use and ease-to-bust-out-of API.

⭐️ ejs for templating
⭐️ fs-jetpack for the filesystem
⭐️ minimist, enquirer, colors, and ascii-table for the command line
⭐️ axios & apisauce for web & apis
⭐️ both lodash AND ramda + ramdasauce for quality of life
⭐️ toml for human-friendly config files
⭐️ clipboardy brings the copy and the paste

It uses Node.js 7 with --harmony for async/await syntax.

Ya, But Why?

Libraries like this shouldn't be the star. This is just glue. What you're building is important thing. So gluegun aims to plug into YOUR code, not vice versa.

If you want to make your CLI...

  • get built quickly
  • have plugin support
  • but skip the boring parts of developing it

... welcome!

Captain F. Disclosure Says...

Under construction! We're just still wrapping up things here. If you have any questions, feel free to file an issue! Contributing?

Do I need it?

gluegun wiggles it's butt into that spot between DIY scripts & full-featured monsters like Yeoman.

Here's the highlights:

🎛 generate files from templates
💾 move files and directories around
🔮 generate files from templates
execute other scripts
🎅 interact with API servers
🔌 have my own users write plugins
🌯 support command line arguments and options
🛎 have user interactions like auto-complete prompts
💃 print pretty colors and tables

We picked these features because they're gloriously generic. Most CLIs could use more than a few in this list. And if it's this easy. Why not, right?

Code.

Let's start with what you or your end user will be writing.

Plugins.

module.exports = async function (context) {
  // grab a fist-full of features...
  const { system, print, filesystem, strings } = context
  const { trim, kebabCase } = strings
  const { info, warning, success, checkmark } = print

  // ...and be the CLI you wish to see in the world
  const awesome = trim(system.run('whoami'))
  const moreAwesome = kebabCase(`${awesome} and a keyboard`)
  const contents = `🚨 Warning! ${moreAwesome} coming thru! 🚨`
  const home = process.env['HOME']
  filesystem.write(`${home}/realtalk.json`, { contents })

  info(`${checkmark} Citius`)
  warning(`${checkmark} Altius`)
  success(`${checkmark} Fortius`)
}

See the context api docs for more details on what you can do.

And what about the CLI you make? Depending on the features you want, more or less:

// ready
const { build } = 'gluegun'

// aim
const runtime = build()
  .brand('movie')
  .configFile('./movie.toml')
  .loadDefault(`${__dirname}/core-plugins`)
  .load('~/Desktop/movie/quote')
  .load('~/Desktop/movie/credits')
  .loadAll('~/Downloads/VariousMoviePlugins')
  .createRuntime()

// fire!
runtime.run()

See the runtime docs for more details on building your own CLI.

The Glue Crew

Who's gluing CLIs together with gluegun?

These are underway:

  • Reactotron - App for React App Inspection
  • Ignite - React Native Headstarter
  • ...next?