simple-git-promise
DEPRECATED: This is just a 1-line wrapper around cmd-executor
. You should probably just use that instead.
Installation
npm i simple-git-promise -S
Usage
const git = // All calls return a promise, so you should probably wait for them to complete // before running another command. You could use `.then()` or `await` ;async { // There are no specific attributes or functions defined on `git`. // Instead, it is a proxy object that will take all attributes/function calls and // parse them into a git command. For example: // will run `git init` await git // will run `git add .` await git // will run `git commit -m "initial commit"` await git // will run `git remote add origin git@github.com:renolc/simple-git-promise.git` await gitremote // Text that would be output by the git CLI are resolved by the promise await git const msg = await git console // "Switched to branch 'newBranch'\n" // Finally, since what you can call on `git` is unbound, you could // certainly do something nonsensical like: try await gitbork // will try to run `git bork blarg 42` catch e console // error message containing "git: 'bork' is not a git command. See 'git --help'" }