JSPM

@putout/git-status-porcelain

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8297
  • Score
    100M100P100Q149475F
  • License MIT

parse git status --porclain output with a pleasure

Package Exports

  • @putout/git-status-porcelain

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@putout/git-status-porcelain) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Porcelain License NPM version Dependency Status Build Status Coverage

Parse git status --porcelain output with a pleasure.

Install

npm i @putout/git-status-porcelain

How to use?

porcalain can be used in simpified mode, when you just need names of modified files (added, deleted, works as well):

const porcelain = require('@putout/git-status-porcelain');

porcelain({
    modified: true,
    untracked: true,
});
// returns
[ 'README.md', '1.js' ]

But you can get break porcelain into pieces as well 😉:

const porcelain = require('@putout/git-status-porcelain');
const {run, parse, pick, getNames} = porcelain;

// run git status --porcelain
const stdout = run();
// returns
' M README.md\n?? 1.js\n'
>

const files = parse(stdout);
// returns
[ { name: 'README.md', mode: ' M ' }, { name: '1.js', mode: '?' } ]

const modifiedFiles = pick(files, {
    modified: true,
    untracked: false,   // default
    deleted: false,     // default
    added: false,       // default
});
// returns
[ { name: 'README.md', mode: ' M ' } ]

getNames(modifiedFiles);
// returns
[ 'README.md' ]

License

MIT