1.2.3 • Published 6 years ago

run-git-command v1.2.3

Weekly downloads
141
License
MIT
Repository
github
Last release
6 years ago

run-git-command   npm version

A light weight promise wrapper for running git commands in any node.js application.

Dependencies 🤝

Having git installed on your system.

Installation ⬇

To install the stable version you can use npm or yarn:

$ npm install run-git-command
$ yarn install run-git-command  

Usage

execGitCmd takes two parameters: 1. Array of git command arguments (e.g "merge", "--abort" -> 'git merge --abort') 2. Executor options (optional)

import {execGitCmd} from "run-git-command";

/** You can read more about this in the project's wiki **/
const execOptions = {
    execOptions: {}, // Options passed to the child_process spawn executor
    logProcess: false, // By default a console log is being printed
    customMsg: `run-git-command` // A custom msg to be printed to the console
};

/** Simple usage **/
execGitCmd(['pull'], execOptions)
    .then((result) => "Command ran successfully")
    .catch((error) => "Command execution failed");
    
/** Since the executor returns a promise they can be chained **/
execGitCmd(['pull'], execOptions)
    .then(() => execGitCmd(['push']))
    .then((result) => "Both commands ran successfully")
    .catch((error) => "Command execution failed");

License

MIT

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago