@@ -6,7 +6,7 @@ const gitOrigin = 'coderoad'
66
77const stashAllFiles = async ( ) :Promise < never | void > => {
88// stash files including untracked (eg. newly created file)
9- const { stdout, stderr} = await exec ( `git stash --include-untracked` )
9+ const { stdout, stderr} = await exec ( { command : `git stash --include-untracked` } )
1010if ( stderr ) {
1111console . error ( stderr )
1212throw new Error ( 'Error stashing files' )
@@ -21,7 +21,7 @@ const cherryPickCommit = async (commit: string, count = 0): Promise<never | void
2121try {
2222// cherry-pick pulls commits from another branch
2323// -X theirs merges and accepts incoming changes over existing changes
24- const { stdout} = await exec ( `git cherry-pick -X theirs${ commit } ` )
24+ const { stdout} = await exec ( { command : `git cherry-pick -X theirs${ commit } ` } )
2525if ( ! stdout ) {
2626throw new Error ( 'No cherry-pick output' )
2727}
@@ -47,7 +47,7 @@ export function loadCommit(commit: string): Promise<never | void> {
4747*/
4848
4949export async function saveCommit ( message :string ) :Promise < never | void > {
50- const { stdout, stderr} = await exec ( `git commit -am '${ message } '` )
50+ const { stdout, stderr} = await exec ( { command : `git commit -am '${ message } '` } )
5151if ( stderr ) {
5252console . error ( stderr )
5353throw new Error ( 'Error saving progress to Git' )
@@ -58,7 +58,7 @@ export async function saveCommit(message: string): Promise<never | void> {
5858export async function clear ( ) :Promise < Error | void > {
5959try {
6060// commit progress to git
61- const { stderr} = await exec ( 'git reset HEAD --hard && git clean -fd' )
61+ const { stderr} = await exec ( { command : 'git reset HEAD --hard && git clean -fd' } )
6262if ( ! stderr ) {
6363return
6464}
@@ -70,7 +70,7 @@ export async function clear(): Promise<Error | void> {
7070}
7171
7272async function init ( ) :Promise < Error | void > {
73- const { stderr} = await exec ( 'git init' )
73+ const { stderr} = await exec ( { command : 'git init' } )
7474if ( stderr ) {
7575throw new Error ( 'Error initializing Git' )
7676}
@@ -85,13 +85,13 @@ export async function initIfNotExists(): Promise<never | void> {
8585
8686export async function checkRemoteConnects ( repo :TT . TutorialRepo ) :Promise < never | void > {
8787// check for git repo
88- const externalRepoExists = await exec ( `git ls-remote --exit-code --heads${ repo . uri } ` )
88+ const externalRepoExists = await exec ( { command : `git ls-remote --exit-code --heads${ repo . uri } ` } )
8989if ( externalRepoExists . stderr ) {
9090// no repo found or no internet connection
9191throw new Error ( externalRepoExists . stderr )
9292}
9393// check for git repo branch
94- const { stderr, stdout} = await exec ( `git ls-remote --exit-code --heads${ repo . uri } ${ repo . branch } ` )
94+ const { stderr, stdout} = await exec ( { command : `git ls-remote --exit-code --heads${ repo . uri } ${ repo . branch } ` } )
9595if ( stderr ) {
9696throw new Error ( stderr )
9797}
@@ -101,7 +101,7 @@ export async function checkRemoteConnects(repo: TT.TutorialRepo): Promise<never
101101}
102102
103103export async function addRemote ( repo :string ) :Promise < never | void > {
104- const { stderr} = await exec ( `git remote add${ gitOrigin } ${ repo } && git fetch${ gitOrigin } ` )
104+ const { stderr} = await exec ( { command : `git remote add${ gitOrigin } ${ repo } && git fetch${ gitOrigin } ` } )
105105if ( stderr ) {
106106const alreadyExists = stderr . match ( `${ gitOrigin } already exists.` )
107107const successfulNewBranch = stderr . match ( 'new branch' )
@@ -116,7 +116,7 @@ export async function addRemote(repo: string): Promise<never | void> {
116116
117117export async function checkRemoteExists ( ) :Promise < boolean > {
118118try {
119- const { stdout, stderr} = await exec ( 'git remote -v' )
119+ const { stdout, stderr} = await exec ( { command : 'git remote -v' } )
120120if ( stderr ) {
121121return false
122122}