diff --git a/src/commands/git/branch.ts b/src/commands/git/branch.ts index 6f2b571..be17d48 100644 --- a/src/commands/git/branch.ts +++ b/src/commands/git/branch.ts @@ -7,18 +7,20 @@ export const gitBranchCommand = () => { const config = projectConfig(); command - .name('branch') - .description('Abstracts the git branch command so it is run in all available repositories.') - .argument('', 'The name of the branch to create.') - .action((ref) => { - const { repositories } = config; - for (const repo of repositories) { - git.branch({ - path: `${config.paths.repos_root}/${repo}`, - ref, - }); - } - }); + .name('branch') + .description( + 'Abstracts the git branch command so it is run in all available repositories.', + ) + .argument('', 'The name of the branch to create.') + .action((ref) => { + const { repositories } = config; + for (const repo of repositories) { + git.branch({ + path: `${config.paths.repos_root}/${repo}`, + ref, + }); + } + }); return command; }; diff --git a/src/commands/git/index.ts b/src/commands/git/index.ts index 1f1860a..9dd604b 100644 --- a/src/commands/git/index.ts +++ b/src/commands/git/index.ts @@ -1,7 +1,7 @@ import { Command } from 'commander'; +import { gitBranchCommand } from './branch'; import { gitCheckoutCommand } from './checkout'; import { gitCloneCommand } from './clone'; -import { gitBranchCommand } from './branch'; export const gitCommand = () => { const command = new Command(); @@ -11,7 +11,7 @@ export const gitCommand = () => { .description('All git commands abstracted by DEMS') .addCommand(gitCloneCommand()) .addCommand(gitCheckoutCommand()) - .addCommand(gitBranchCommand()) + .addCommand(gitBranchCommand()); return command; }; diff --git a/src/utils/git.ts b/src/utils/git.ts index e8061ef..1d49b53 100644 --- a/src/utils/git.ts +++ b/src/utils/git.ts @@ -35,7 +35,7 @@ const git = { } cmd.run(`git -C ${path} checkout -b ${ref}`); log.success(`Branch ${ref} was created successfully!`); - } + }, }; export const getRepoName = ({ repo }: Pick) => { diff --git a/test/utils/git.test.ts b/test/utils/git.test.ts index 2756c76..cdad418 100644 --- a/test/utils/git.test.ts +++ b/test/utils/git.test.ts @@ -106,10 +106,13 @@ describe('Utils: git', () => { expect(fs.existsSync).toHaveBeenLastCalledWith(`${path}/.git`); expect(fs.lstatSync).toHaveBeenLastCalledWith(`${path}/.git`); - expect(execSync).toHaveBeenCalledWith(`git -C ${path} checkout -b ${ref}`, { - stdio: 'inherit', - encoding: 'utf-8', - }); + expect(execSync).toHaveBeenCalledWith( + `git -C ${path} checkout -b ${ref}`, + { + stdio: 'inherit', + encoding: 'utf-8', + }, + ); }); });