Giter Club home page Giter Club logo

gluegun's Introduction

npm module CircleCI code style: prettier Chat about GlueGun in the IR Community

Gluegun

gluegun2 0

Gluegun is a delightful toolkit for building Node-based command-line interfaces (CLIs), with support for:

๐ŸŒฏ parameters - command line arguments and options
๐ŸŽ› template - generating files from templates
๐Ÿ—„ patching - manipulating file contents
๐Ÿ’พ filesystem - moving files and directories around
โš’ system - executing other command-line scripts
๐ŸŽ… http - interacting with API servers
๐Ÿ›Ž prompt - auto-complete prompts
๐Ÿ’ƒ print - printing pretty colors and tables
๐Ÿ‘ฉโ€โœˆ๏ธ semver - working with semantic versioning
๐ŸŽป strings - manipulating strings & template data

In addition, gluegun supports expanding your CLI's ecosystem with a robust set of easy-to-write plugins and extensions.

Why use Gluegun?

You might want to use Gluegun if:

  • You need to build a CLI app
  • You want to have powerful tools at your fingertips
  • And you don't want to give up flexibility at the same time

If so ... welcome!

Quick Start

Just run the gluegun CLI like this:

$ npm install -g gluegun@next
$ gluegun new movies
$ cd movies
$ npm install
$ npm link
$ movies help

You should see your new CLI help. Open the folder in your favorite editor and start building your CLI!

Tip: If you want your CLI to be configured to use TypeScript, pass in --typescript

Code

Let's start with what a gluegun CLI looks like.

// in movie/src/cli.js...

// ready
const { build } = require('gluegun')

// aim
const movieCLI = build('movie')
  .src(`${__dirname}/core-plugins`)
  .plugins('node_modules', { matching: 'movie-*' })
  .help()
  .version()
  .defaultCommand()
  .create()

// fire!
movieCLI.run()

Commands

Commands are simple objects that provide a name, optional aliases, and a function to run.

// in movie/commands/foo.js
module.exports = {
  name: 'foo',
  alias: 'f',
  run: async function(toolbox) {
    // gluegun provides all these features and more!
    const { system, print, filesystem, strings } = toolbox

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

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

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

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!

Who Is Using This?

What's under the hood?

We've assembled an all star cast of libraries to help you build your CLI.

โญ๏ธ ejs for templating
โญ๏ธ semver for version investigations
โญ๏ธ fs-jetpack for the filesystem
โญ๏ธ yargs-parser, enquirer, colors, ora and cli-table3 for the command line
โญ๏ธ axios & apisauce for web & apis
โญ๏ธ cosmiconfig for flexible configuration
โญ๏ธ cross-spawn for running sub-commands
โญ๏ธ execa for running more sub-commands
โญ๏ธ node-which for finding executables
โญ๏ธ pluralize for manipulating strings

Node.js 7.6+ is required.

Sponsors

Gluegun is sponsored by Infinite Red, a premium custom mobile app and web design and development agency. We are a team of designers and developers distributed across the USA and based out of Portland, Oregon and the San Francisco Bay Area. Our specialties are UI/UX design, React and React Native, Node, and more. Email [email protected] if you'd like to talk about your project!

gluegun's People

Contributors

skellock avatar jamonholmgren avatar gantman avatar semantic-release-bot avatar cmckni3 avatar morgandonze avatar abrophy avatar imranolas avatar ryanlntn avatar yordis avatar andyfleming avatar ekryski avatar ruddell avatar markusguenther avatar 0xflotus avatar agneym avatar danielruf avatar newtykip avatar kavengagne avatar mikeerickson avatar orta avatar richicoder1 avatar sartaj avatar

Watchers

James Cloos avatar

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.