@@ -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` } )
1010 if ( stderr ) {
1111 console . error ( stderr )
1212 throw new Error ( 'Error stashing files' )
@@ -21,7 +21,7 @@ const cherryPickCommit = async (commit: string, count = 0): Promise<never | void
2121 try {
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 } ` } )
2525 if ( ! stdout ) {
2626 throw 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 } '` } )
5151 if ( stderr ) {
5252 console . error ( stderr )
5353 throw 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 > {
5959 try {
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' } )
6262 if ( ! stderr ) {
6363 return
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' } )
7474 if ( stderr ) {
7575 throw 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 } ` } )
8989 if ( externalRepoExists . stderr ) {
9090 // no repo found or no internet connection
9191 throw 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 } ` } )
9595 if ( stderr ) {
9696 throw 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 } ` } )
105105 if ( stderr ) {
106106 const alreadyExists = stderr . match ( `${ gitOrigin } already exists.` )
107107 const 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 > {
118118 try {
119- const { stdout, stderr } = await exec ( 'git remote -v' )
119+ const { stdout, stderr } = await exec ( { command : 'git remote -v' } )
120120 if ( stderr ) {
121121 return false
122122 }
0 commit comments