@git-lazy/util
@git-lazy core lib and a better cross spawn for git
Last updated 9 hours ago by bluelovers .
ISC · Original npm · Tarball · package.json
$ cnpm install @git-lazy/util 
SYNC missed versions from official npm registry.

@git-lazy/util

@git-lazy core lib and a better cross spawn for git
npm install @git-lazy/util
import { crossSpawnSync, crossSpawnAsync, SpawnOptions, checkGitOutput } from '@git-lazy/util/spawn/git';
import { notEmptyString, debug } from '@git-lazy/util';
import { crossSpawnOutput, filterCrossSpawnArgv } from '@git-lazy/util/spawn/util';

export function localBranchList(REPO_PATH: string): string[]
{
	let cp = crossSpawnSync('git', [
		'branch',
		'--list',
		'--format=%(refname)',
	], {
		cwd: REPO_PATH,
	});

	cp = checkGitOutput(cp);

	if (!cp.error)
	{
		let out = crossSpawnOutput(cp.stdout, {
			clearEol: true,
			stripAnsi: true,
		});

		let ls = out.split(/\n/).map(function (s)
		{
			return s.trim();
		});

		if (ls.length)
		{
			return ls
		}
	}

	debug.enabled && debug(crossSpawnOutput(cp.output));

	return [];
}

Current Tags

  • 1.0.9                                ...           latest (9 hours ago)

7 Versions

  • 1.0.9                                ...           9 hours ago
  • 1.0.8                                ...           9 hours ago
  • 1.0.7                                ...           10 hours ago
  • 1.0.5                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 35
This Month 39
Last Day 35
Last Week 4
Last Month 0
Dependencies (3)
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |