0.1.0
Initial implementation.
API
-
gitSpawnedPromise:function({gitDir: ?string}): GitClientBound a
GitClientto a local repository. -
GitClient:function(cmd: string[], ?options: ClientOption): Promise<any,Error>Run the git command and settle once the git child process exit and the stdout/stderr pipe closes, or when either fail.
-
ClientOption:{ignore: ?boolean, sep: ?string, map: mapper[]}ignore: ignore stdout when set totrue(falseby default).sep: separator to split the stream (default to\nif a mapper is provided).map: when splitting a stream, apply each element and replace the returned value. If the value is a promise it will resolve it.
if
sepormapare set, thegitCLientPromisewill resolve to anArray. -
Mapper: function(item: any): anyA handler for a
stream.Transformerforstdout. Unlike regular handler async values are passed via aPromiseinstead of a callback function, and returningnull(orPromise<null>)does not close the stream; the Transformer would just skip the value.If the mapper throws or reject, the
GitClientreturnedPromisewill reject with that error. -
GitClient.run:function(...cmd: string[]): Promise<void,GitError>gitClient.run(...cmd)is equivalent togitClient(cmd, {capture: true}). -
GitClient.get:function(...cmd: string[]): Promise<string,GitError>gitClient.get(...cmd)is equivalent togitClient(cmd). -
GitClient.array:function(...cmd: string[], ?options: ClientOption): Promise<any[],Error>gitClient.array(...cmd)is equivalent togitClient(cmd, {sep: '\n', map: someMapperOrMappperArray}).