From bc9d855282491e40d03f95cd89a99a7ef2e539b3 Mon Sep 17 00:00:00 2001 From: Nell Hardcastle Date: Wed, 8 Nov 2023 14:12:36 -0800 Subject: [PATCH] fix(cli): Prevent commander parsing from overriding git-annex-remote-openneuro --- packages/openneuro-cli/src/cli.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/openneuro-cli/src/cli.js b/packages/openneuro-cli/src/cli.js index 468db2c1b..5b524cdaf 100644 --- a/packages/openneuro-cli/src/cli.js +++ b/packages/openneuro-cli/src/cli.js @@ -74,12 +74,16 @@ commander .option('-s, --snapshot [snapshotVersion]') .action(ls) -commander.parse(process.argv) - -if (process.argv[1].endsWith('git-credential-openneuro')) { - gitCredential() -} else if (process.argv[1].endsWith('git-annex-remote-openneuro')) { - gitAnnexRemote() -} else if (!process.argv.slice(2).length) { - commander.help() +function main(argv) { + if (argv.endsWith('git-credential-openneuro')) { + gitCredential() + } else if (argv.endsWith('git-annex-remote-openneuro')) { + gitAnnexRemote() + } else if (!process.argv.slice(2).length) { + commander.help() + } else { + commander.parse(process.argv) + } } + +main(process.argv)