Skip to content

tanem/shelljs-plugin-authors

Repository files navigation

shelljs-plugin-authors

npm version build status coverage status npm downloads shelljs-plugin

A ShellJS plugin for generating a nicely formatted list of authors.

Usage

Let's assume that we're inside a git repo, and the output of git shortlog -se gives us something like:

    24  Andrew Powlowski <[email protected]>
    39  Gregorio Heaney <[email protected]>
    55  Miller Reichel <[email protected]>
    70  Mervin Graham <[email protected]>
    99  Hallie Paucek <[email protected]>

We want to generate a nicely formatted list of authors sorted alphabetically by author name. There are two ways to do that with this module, first you can use it as a ShellJS plugin:

const shell = require('shelljs')
require('shelljs-plugin-authors')
const authors = shell.authors()
shell.echo(authors.stdout)
/*
Andrew Powlowski <[email protected]>
Gregorio Heaney <[email protected]>
Miller Reichel <[email protected]>
Mervin Graham <[email protected]>
Hallie Paucek <[email protected]>
*/

Or you can use it via the CLI:

$ shelljs-authors
Andrew Powlowski <[email protected]>
Gregorio Heaney <[email protected]>
Miller Reichel <[email protected]>
Mervin Graham <[email protected]>
Hallie Paucek <[email protected]>

If you'd prefer the list be sorted by number of commits per author, pass the -n option:

const shell = require('shelljs')
require('shelljs-plugin-authors')
const authors = shell.authors('-n')
shell.echo(authors.stdout)
/*
Hallie Paucek <[email protected]>
Mervin Graham <[email protected]>
Miller Reichel <[email protected]>
Gregorio Heaney <[email protected]>
Andrew Powlowski <[email protected]>
*/
$ shelljs-authors -n
Hallie Paucek <[email protected]>
Mervin Graham <[email protected]>
Miller Reichel <[email protected]>
Gregorio Heaney <[email protected]>
Andrew Powlowski <[email protected]>

API

Plugin

Options

  • -n - Optional Sort the list by number of commits per author.

Example

shell.authors('-n')

CLI

$ shelljs-authors -h

  Usage: shelljs-authors [options]

  Generate a nicely formatted list of authors

  Options:

    -V, --version   output the version number
    -n, --numbered  Sort by number of commits per author
    -h, --help      output usage information

  Examples:

    $ shelljs-authors
    $ shelljs-authors -n

Installation

Plugin

$ npm i -D shelljs shelljs-plugin-authors

CLI

$ npm i -g shelljs shelljs-plugin-authors

License

MIT