Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable easy installation via NPM #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
presets: ['es2015']
presets: ['es2015'],
only: 'scripts/**.es'
}
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true
[*]
indent_style = space
indent_size = 2
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ npm-debug.log

node_modules/
assets/
_repos/
_output/
_tmp/
gitlogg.json
scripts/**/*.js
scripts/**/*.js.map
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.DS_Store
npm-debug.log

node_modules/
assets/
gitlogg.json
.editorconfig
.babelrc
20 changes: 15 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,23 @@
},
"copyright": "Copyright (c) Wallace Sidhrée - All rights reserved.",
"license": "MIT",
"devDependencies": {
"babel-preset-es2015": "^6.9.0",
"chalk": "^1.1.3"
"bin": {
"gitlogg": "scripts/gitlogg.sh"
},
"scripts": {
"setup": "npm install babel-cli -g && npm install && mkdir -p _output && mkdir -p _repos && mkdir -p _tmp",
"gitlogg": "./scripts/gitlogg.sh"
"build": "babel --source-maps --out-dir scripts scripts",
"test": "GITLOGG_DEV=1 ./gitlogg/gitlogg.sh ./",
"prepublish": "npm run build"
},
"dependencies": {
"chalk": "^1.1.3",
"lodash": "^4.17.2",
"which": "^1.2.12"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-preset-es2015": "^6.9.0",
"source-map-support": "^0.4.6"
},
"engines": {
"node": ">=4.3.0"
Expand Down
2 changes: 0 additions & 2 deletions scripts/colors.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/bash

# Extracted command line colors for nicer output

# Text Reset
Expand Down
231 changes: 231 additions & 0 deletions scripts/git-log-fields.es
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@

const fields = exports.fields = [
{ code: '%H',
name: 'commit hash',
fullDescription: 'commit hash',
description: '',
identifier: 'commit_hash' },
{ code: '%h',
name: 'abbreviated commit hash',
fullDescription: 'abbreviated commit hash',
description: '',
identifier: 'abbreviated_commit_hash' },
{ code: '%T',
name: 'tree hash',
fullDescription: 'tree hash',
description: '',
identifier: 'tree_hash' },
{ code: '%t',
name: 'abbreviated tree hash',
fullDescription: 'abbreviated tree hash',
description: '',
identifier: 'abbreviated_tree_hash' },
{ code: '%P',
name: 'parent hashes',
fullDescription: 'parent hashes',
description: '',
identifier: 'parent_hashes' },
{ code: '%p',
name: 'abbreviated parent hashes',
fullDescription: 'abbreviated parent hashes',
description: '',
identifier: 'abbreviated_parent_hashes' },
{ code: '%an',
name: 'author name',
fullDescription: 'author name',
description: '',
identifier: 'author_name' },
{ code: '%aN',
name: 'author name',
fullDescription: 'author name (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
description: ' (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
identifier: 'author_name_mailmap' },
{ code: '%ae',
name: 'author email',
fullDescription: 'author email',
description: '',
identifier: 'author_email' },
{ code: '%aE',
name: 'author email',
fullDescription: 'author email (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
description: ' (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
identifier: 'author_email_mailmap' },
// { code: '%ad',
// name: 'author date',
// fullDescription: 'author date (format respects --date= option)',
// description: ' (format respects --date= option)',
// identifier: 'author_date_(format_respects_--date=_option)' },
// { code: '%aD',
// name: 'author date',
// fullDescription: 'author date, RFC2822 style',
// description: ', RFC2822 style',
// identifier: 'author_date_RFC2822_style' },
{ code: '%ar',
name: 'author date',
fullDescription: 'author date, relative',
description: ', relative',
identifier: 'author_date_relative' },
// { code: '%at',
// name: 'author date',
// fullDescription: 'author date, UNIX timestamp',
// description: ', UNIX timestamp',
// identifier: 'author_date_UNIX_timestamp' },
// { code: '%ai',
// name: 'author date',
// fullDescription: 'author date, ISO 8601-like format',
// description: ', ISO 8601-like format',
// identifier: 'author_date_ISO_8601-like_format' },
{ code: '%aI',
name: 'author date',
fullDescription: 'author date, strict ISO 8601 format',
description: ', strict ISO 8601 format',
identifier: 'author_date' },
{ code: '%cn',
name: 'committer name',
fullDescription: 'committer name',
description: '',
identifier: 'committer_name' },
{ code: '%cN',
name: 'committer name',
fullDescription: 'committer name (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
description: ' (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
identifier: 'committer_name_mailmap' },
{ code: '%ce',
name: 'committer email',
fullDescription: 'committer email',
description: '',
identifier: 'committer_email' },
{ code: '%cE',
name: 'committer email',
fullDescription: 'committer email (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
description: ' (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
identifier: 'committer_email_mailmap' },
// { code: '%cd',
// name: 'committer date',
// fullDescription: 'committer date (format respects --date= option)',
// description: ' (format respects --date= option)',
// identifier: 'committer_date_(format_respects_--date=_option)' },
// { code: '%cD',
// name: 'committer date',
// fullDescription: 'committer date, RFC2822 style',
// description: ', RFC2822 style',
// identifier: 'committer_date_RFC2822_style' },
{ code: '%cr',
name: 'committer date',
fullDescription: 'committer date, relative',
description: ', relative',
identifier: 'committer_date_relative' },
// { code: '%ct',
// name: 'committer date',
// fullDescription: 'committer date, UNIX timestamp',
// description: ', UNIX timestamp',
// identifier: 'committer_date_UNIX_timestamp' },
// { code: '%ci',
// name: 'committer date',
// fullDescription: 'committer date, ISO 8601-like format',
// description: ', ISO 8601-like format',
// identifier: 'committer_date_ISO_8601-like_format' },
{ code: '%cI',
name: 'committer date',
fullDescription: 'committer date, strict ISO 8601 format',
description: ', strict ISO 8601 format',
identifier: 'committer_date' },
// { code: '%d',
// name: 'ref names',
// fullDescription: 'ref names, like the --decorate option of git-log[1]',
// description: ', like the --decorate option of git-log[1]',
// identifier: 'ref_names' },
{ code: '%D',
name: 'ref names without the "',
fullDescription: 'ref names without the " (", ")" wrapping.',
description: ' (", ")" wrapping.',
identifier: 'ref_names' },
{ code: '%e',
name: 'encoding',
fullDescription: 'encoding',
description: '',
identifier: 'encoding' },
{ code: '%s',
name: 'subject',
fullDescription: 'subject',
description: '',
identifier: 'subject' },
{ code: '%f',
name: 'sanitized subject line',
fullDescription: 'sanitized subject line, suitable for a filename',
description: ', suitable for a filename',
identifier: 'sanitized_subject' },
{ code: '%b',
name: 'body',
fullDescription: 'body',
description: '',
identifier: 'body' },
{ code: '%B',
name: 'raw body',
fullDescription: 'raw body (unwrapped subject and body)',
description: ' (unwrapped subject and body)',
identifier: 'raw_body' },
{ code: '%N',
name: 'commit notes',
fullDescription: 'commit notes',
description: '',
identifier: 'commit_notes' },
{ code: '%GG',
name: 'raw verification message from GPG for a signed commit',
fullDescription: 'raw verification message from GPG for a signed commit',
description: '',
identifier: 'raw_GPG_verification_message' },
{ code: '%G?',
name: 'show "G" for a good',
fullDescription: 'show "G" for a good (valid) signature, "B" for a bad signature, "U" for a good signature with unknown validity, "X" for a good signature that has expired, "Y" for a good signature made by an expired key, "R" for a good signature made by a revoked key, "E" if the signature cannot be checked (e.g. missing key) and "N" for no signature',
description: ' (valid) signature, "B" for a bad signature, "U" for a good signature with unknown validity, "X" for a good signature that has expired, "Y" for a good signature made by an expired key, "R" for a good signature made by a revoked key, "E" if the signature cannot be checked (e.g. missing key) and "N" for no signature',
identifier: 'signature_validity' },
{ code: '%GS',
name: 'show the name of the signer for a signed commit',
fullDescription: 'show the name of the signer for a signed commit',
description: '',
identifier: 'signer_name' },
{ code: '%GK',
name: 'show the key used to sign a signed commit',
fullDescription: 'show the key used to sign a signed commit',
description: '',
identifier: 'key' },
{ code: '%gD',
name: 'reflog selector',
fullDescription: 'reflog selector, e.g., refs/stash@{1} or refs/stash@{2 minutes ago}; the format follows the rules described for the -g option. The portion before the @ is the refname as given on the command line (so git log -g refs/heads/master would yield refs/heads/master@{0}).',
description: ', e.g., refs/stash@{1} or refs/stash@{2 minutes ago}; the format follows the rules described for the -g option. The portion before the @ is the refname as given on the command line (so git log -g refs/heads/master would yield refs/heads/master@{0}).',
identifier: 'reflog_selector' },
{ code: '%gd',
name: 'shortened reflog selector',
fullDescription: 'shortened reflog selector; same as %gD, but the refname portion is shortened for human readability (so refs/heads/master becomes just master).',
description: '; same as %gD, but the refname portion is shortened for human readability (so refs/heads/master becomes just master).',
identifier: 'shortened_reflog_selector' },
{ code: '%gn',
name: 'reflog identity name',
fullDescription: 'reflog identity name',
description: '',
identifier: 'reflog_identity_name' },
{ code: '%gN',
name: 'reflog identity name',
fullDescription: 'reflog identity name (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
description: ' (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
identifier: 'reflog_identity_name_mailmap' },
{ code: '%ge',
name: 'reflog identity email',
fullDescription: 'reflog identity email',
description: '',
identifier: 'reflog_identity_email' },
{ code: '%gE',
name: 'reflog identity email',
fullDescription: 'reflog identity email (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
description: ' (respecting .mailmap, see git-shortlog[1] or git-blame[1])',
identifier: 'reflog_identity_email_mailmap' },
{ code: '%gs',
name: 'reflog subject',
fullDescription: 'reflog subject',
description: '',
identifier: 'reflog_subject' } ];

const formatString = exports.formatString = fields.map(field =>
`${ field.code }%x00`
).join('');
Loading