{"name":"staged-git-files","version":"1.1.2","devDependencies":{"should":"~2.0.1","mocha":"^2.0.1"},"description":"get a list of staged git files and their status","main":"index.js","directories":{"test":"test"},"scripts":{"test":"mocha"},"bin":{"sgf":"bin/cli.js"},"repository":{"type":"git","url":"git://github.com/mcwhittemore/staged-git-files.git"},"keywords":["git","pre-commit","post-commit","hooks"],"author":{"name":"Matthew Chase Whittemore","email":"mcwhittemore@gmail.com"},"license":"BSD-2-Clause","bugs":{"url":"https://github.com/mcwhittemore/staged-git-files/issues"},"gitHead":"ff43da4222a93a5aaaf1b47b628b7f65569a69a8","homepage":"https://github.com/mcwhittemore/staged-git-files#readme","_id":"staged-git-files@1.1.2","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"mcwhittemore","email":"mcwhittemore@gmail.com"},"dist":{"integrity":"sha512-0Eyrk6uXW6tg9PYkhi/V/J4zHp33aNyi2hOCmhFLqLTIhbgqWn5jlSzI+IU0VqrZq6+DbHcabQl/WP6P3BG0QA==","shasum":"4326d33886dc9ecfa29a6193bf511ba90a46454b","tarball":"http://registry-npm.ywwl.com/staged-git-files/download/staged-git-files-1.1.2.tgz","fileCount":9,"unpackedSize":23060,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb10biCRA9TVsSAnZWagAAgtYP/04q+B+s0mUz0JZJFwRD\n3Xhs3O/PsAtP4Ix1X6a+y0W0xZiSg0hhA9hYZHg30Opajp03C08XZSmeZiw8\nB1r/FwXmVfqoqZMe2ptuwHJUNLSKgyQkPpS8KM0bzrimVodCxSXIK6SwUxwo\nl3o6WGc9lxGJnJL8cQFa3UL7JPBatUJWryWjSrFHNraJDJVhkfQsgEFKmjd2\n3R5HB3EkmnB238vCoWykscIEN2mPZ0oM7ZwA/wL0hxJ5laVcktwU/s7l0wEd\nwzqKrggZumXOZmvGfxkmKY4mTVB5iDrxYqvh3V4XXvAc7K5b6ysnjO5HXyfJ\nhdMk+Bl/JHy70vM9MFktVGwOBMoO1QBhvSruJpxVieXQARmhW3YfLNUbDB3R\n+Yz+Zq9Tm6zBuDhkkSxMUfr2PX/1LWDyJj0bKvUybgIXq7HXSRVsbskL/jyX\nPddRHfZ+bvAude7H5dl0KpU2fQMilkbZUB0FodYaoWn+b89IEn5oYLAwrXNI\nB80rHuSesTY64Nx4EVgLytQ22RbKUcF5PkGgguNjAHA7pN4chuhU/Lk/R3/x\nSXJVoSD+EvmUfkkoCO7T/75PG2gaC2ITQeD1NCZpm+DFifmPiThAqfPTmfVZ\nT5JpK66QBDI0ffG0tcK5Umu/gnFrM2blqLh0tRsMcZA90P7GLOWaho7Sgbu8\n8Vd8\r\n=UW/t\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICurifYvp0cZLH/lVMvtdPjpOsaZyKqcfOQAdxPCwRPNAiAokqrUmKfEm/S5PYPe85m2HFNUnHFmBwn5nGImv/xePA=="}],"size":5906,"noattachment":false,"key":"/staged-git-files/-/staged-git-files-1.1.2.tgz"},"maintainers":[{"name":"mcwhittemore","email":"mcwhittemore@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/staged-git-files_1.1.2_1540835040190_0.6249724067579332"},"_hasShrinkwrap":false,"readme":"# Staged Git Files\n\nThis module returns an array of staged files and their status acording to git.\n\n[![Build Status](https://travis-ci.org/mcwhittemore/staged-git-files.svg?branch=master)](https://travis-ci.org/mcwhittemore/staged-git-files)\n\n## Usage\n\n`npm install staged-git-files`\n\n\n```js\nvar sgf = require(\"staged-git-files\");\nsgf(function(err, results){\n\t//WHAT EVER YOU SO PLEASE\n});\n```\n\n**Example Results**\n\n```json\n[\n\t{\n\t\t\"filename\": \"package.json\",\n\t\t\"status\": \"Added\"\n\t},\n\t{\n\t\t\"filename\": \"readme.md\",\n\t\t\"status\": \"Modified\"\n\t},\n\t{\n\t\t\"filename\": \"index.js\",\n\t\t\"status\": \"Renamed\"\n\t}\n]\n```\n\n## Usage as a cli\n\n```sh\n$ sgf\nAdded package.json\nModified readme.md\nRenamed index.js\n```\n\n## API\n\n### sgf(filter, callback)\n\nGet a list of staged git files\n\n* options:\n  * filter: string of git status codes. No spaces\n  * relative: boolean, tells [diff to run in relative mode](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---relativeltpathgt)\n* callback:\n\t* err: the error\n\t* results: file object array.\n\nIf you omit a callback `sgf` will return a promise. How to use with `async`/`await`:\n\n```javascript\nasync function main () {\n\tconst stagedFiles = await sgf();\n}\n\nmain();\n```\n\n\n### sgf.getHead(callback)\n\nGet head that will be used in the diff to ID which files are waiting to be staged.\n\n* callback\n\t* err: the error\n\t* head: the git commit id which is aliased to head.\n\n### sgf.readFile(filename, [options], callback)\n\nThis is a proxy for [fs.readFile](http://nodejs.org/api/fs.html#fs_fs_readfile_filename_options_callback) with one change. The filename will be relative to the `sgf.cwd`\n\n### sgf.debug\n\nBoolean that flips logging on and off. By default this is false. If true, all git commands will be console logged.\n\n### sgf.includeContent\n\nIf true, include content will add a `content` or `err` param to the file object.\n\n* Default Value: false\n* Content Param: the content of the file staged\n* Err Param: the error message received while trying to read the file.\n\n### sgf.cwd\n\nThe current working directory. AKA: where the .git folder you care about is.\n\n# Default Value: is equal to process.cwd() of your app.g\n\n## Statuses\n\n**SGF-Status (git status code)**\n\n* Added (A)\n* Copied (C)\n* Deleted (D)\n* Modified (M)\n* Renamed (R)\n* Type-Change (T) [i.e. regular file, symlink, submodule, etc.]\n* Unmerged (U)\n* Unknown (X)\n","publish_time":1540835041675,"_cnpm_publish_time":1540835041675,"dist-tags":{"latest":"1.3.0"}}