Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli.js isn't correctly calling git-annex-remote-openneuro #2924

Closed
Shotgunosine opened this issue Oct 11, 2023 · 1 comment · Fixed by #2939
Closed

cli.js isn't correctly calling git-annex-remote-openneuro #2924

Shotgunosine opened this issue Oct 11, 2023 · 1 comment · Fixed by #2939
Assignees
Labels

Comments

@Shotgunosine
Copy link

What went wrong?

I installed node and datalad via conda and openneuro via npm and ran echo "EXTENSIONS" | git-annex-remote-openneuro from the help page, but the only output I got was the openneuro cli help message:

Usage: git-annex-remote-openneuro [options] [command]

OpenNeuro command line tools.

Options:
  -V, --version                                   output the version number
  -h, --help                                      display help for command

Commands:
  login|l                                         Setup authentication with OpenNeuro
  upload|u [options] <dir>                        Upload or sync a dataset (if an accession number is provided)
  download|d [options] <datasetId> <destination>  Download a dataset draft or snapshot. If neither is specified, will prompt with available snapshots.
  git-credential <operation>                      A git credentials helper for easier datalad or git-annex access to datasets.
  create-dataset|c                                Create a new empty dataset, useful for adding existing DataLad or git-annex datasets.
  ls [options] <datasetId>                        Lists files from a snapshotted dataset version.
  help [command]                                  display help for command

Expected behavior

I expected to see 'VERSION 1' 'EXTENSIONS'.

How to reproduce

conda create -n openneuro -c conda-forge nodejs git-annex
npm install -g @openneuro/cli
echo "EXTENSIONS" | git-annex-remote-openneuro

Desktop

  • OS: Red Hat Enterprise Linux 8.8 (Ootpa)

Phone

  • Device:
  • OS:
  • Browser:
  • Version:

Additional information

I edited cli.js and added a bunch of console.log statements and found that it was not executing below line 77:

commander.parse(process.argv)

I moved that to line 8 and it works as expected now.

@Shotgunosine
Copy link
Author

Of course, moving that line broke all of the other openneuro commands. If I instead move line 79:85 up to the top:

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()
}

and wrap the remainder of the code in a final else statement, then it seems to work for both logging in and when calling git-annex-remote-openneuro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants