staged-git-files

WebJar for staged-git-files

Лицензия

Лицензия

BSD 2-Clause
Категории

Категории

Git Инструменты разработки Контроль версий
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

staged-git-files
Последняя версия

Последняя версия

1.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

staged-git-files
WebJar for staged-git-files
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/mcwhittemore/staged-git-files

Скачать staged-git-files

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/staged-git-files/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>staged-git-files</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/staged-git-files/
implementation 'org.webjars.npm:staged-git-files:1.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/staged-git-files/
implementation ("org.webjars.npm:staged-git-files:1.1.1")
'org.webjars.npm:staged-git-files:jar:1.1.1'
<dependency org="org.webjars.npm" name="staged-git-files" rev="1.1.1">
  <artifact name="staged-git-files" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='staged-git-files', version='1.1.1')
)
libraryDependencies += "org.webjars.npm" % "staged-git-files" % "1.1.1"
[org.webjars.npm/staged-git-files "1.1.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Staged Git Files

This module returns an array of staged files and their status acording to git.

Build Status

Usage

npm install staged-git-files

var sgf = require("staged-git-files");
sgf(function(err, results){
	//WHAT EVER YOU SO PLEASE
});

Example Results

[
	{
		"filename": "package.json",
		"status": "Added"
	},
	{
		"filename": "readme.md",
		"status": "Modified"
	},
	{
		"filename": "index.js",
		"status": "Renamed"
	}
]

Usage as a cli

$ sgf
Added package.json
Modified readme.md
Renamed index.js

API

sgf(filter, callback)

Get a list of staged git files

  • filter: string of git status codes. No spaces
  • callback:
    • err: the error
    • results: file object array.

If you omit a callback sgf will return a promise. How to use with async/await:

async function main () {
	const stagedFiles = await sgf();
}

main();

sgf.getHead(callback)

Get head that will be used in the diff to ID which files are waiting to be staged.

  • callback
    • err: the error
    • head: the git commit id which is aliased to head.

sgf.readFile(filename, [options], callback)

This is a proxy for fs.readFile with one change. The filename will be relative to the sgf.cwd

sgf.debug

Boolean that flips logging on and off. By default this is false. If true, all git commands will be console logged.

sgf.includeContent

If true, include content will add a content or err param to the file object.

  • Default Value: false
  • Content Param: the content of the file staged
  • Err Param: the error message received while trying to read the file.

sgf.cwd

The current working directory. AKA: where the .git folder you care about is.

Default Value: is equal to process.cwd() of your app.g

Statuses

SGF-Status (git status code)

  • Added (A)
  • Copied (C)
  • Deleted (D)
  • Modified (M)
  • Renamed (R)
  • Type-Change (T) [i.e. regular file, symlink, submodule, etc.]
  • Unmerged (U)
  • Unknown (X)

Версии библиотеки

Версия
1.1.1