Skip to content

Latest commit

 

History

History
121 lines (87 loc) · 5.03 KB

readme.md

File metadata and controls

121 lines (87 loc) · 5.03 KB

npm module Build Status Coverage Status Chat about GlueGun in the IR Community

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 easy-to-use and easy-to-bust-out-of API.

⭐️ ejs for templating
⭐️ fs-jetpack for the filesystem
⭐️ minimist, enquirer, colors, ora 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
⭐️ cross-spawn for running sub-commands
⭐️ execa for running more sub-commands
⭐️ node-which for finding executables

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 } = require('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 and join us in the #gluegun channel of the Infinite Red Community Slack (community.infinite.red) to get friendly help!

The Glue Crew

Who's gluing CLIs together with gluegun?

These are underway:

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

Lastly...

Gluegun is yet another open source project by Infinite Red. We love our open source community -- thanks for being a part of it!