Skip to content

Commit 74beca7

Browse files
authored
Merge pull request #3284 from OpenNeuroOrg/cli/docs
docs(cli): Update to use the new CLI in documentation
2 parents 9209d70 + a768405 commit 74beca7

File tree

2 files changed

+69
-21
lines changed

2 files changed

+69
-21
lines changed

cli/README.md

Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,105 @@
1-
# OpenNeuro CLI for Deno
1+
---
2+
name: Command Line Interface
3+
route: /cli
4+
---
25

3-
Command line tools for OpenNeuro. Upload and download support for working with OpenNeuro datasets from the command line.
6+
# OpenNeuro command line interface
47

5-
## Install
8+
This tool allows you to upload and download [OpenNeuro.org](https://openneuro.org) datasets without a browser.
69

7-
Download deno via [any supported installation method](https://docs.deno.com/runtime/manual/getting_started/installation).
10+
## Install
811

9-
## Usage
12+
1. Install [Deno] (https://deno.land/) via [any supported installation method](https://docs.deno.com/runtime/manual/getting_started/installation).
13+
2. In a terminal type: `deno run -A jsr:@openneuro/cli --help`
1014

11-
OpenNeuro CLI will validate your dataset with the [bids-validator](https://github.com/bids-standard/bids-validator/) and then allow you to upload to OpenNeuro. If you wish to make changes to a dataset, the CLI can download, allow you to make local changes, and reupload only the changes to OpenNeuro.
15+
To download annexed files, you will need the git-annex special remote for OpenNeuro.
1216

1317
```shell
14-
# Interactive help
15-
deno run -A jsr:@openneuro/cli --help
16-
# Available for each subcommand
17-
deno run -A jsr:@openneuro/cli upload --help
18+
# A script is provided to wrap the CLI as a special remote
19+
curl https://raw.githubusercontent.com/OpenNeuroOrg/openneuro/refs/heads/master/bin/git-annex-remote-openneuro -o git-annex-remote-openneuro
20+
# Make this executable and move this script to your path
21+
chmod +x git-annex-remote-openneuro
1822
```
1923

20-
### Login
24+
## Setup
2125

22-
To upload or download data from OpenNeuro, login with your account.
26+
The setup step is needed for both uploading _and_ downloading data from OpenNeuro.
2327

24-
```shell
25-
# Run login and follow the prompts
26-
deno run -A jsr:@openneuro/cli login
27-
```
28+
Run `deno run -A jsr:@openneuro/cli login` to configure credentials.
29+
This prompts you for the required configuration fields and these are saved in Deno's local storage.
30+
31+
`deno run -A jsr:@openneuro/cli login` will require you to enter an API key.
2832

29-
You can also create an API key on [OpenNeuro](https://openneuro.org/keygen) and specify this as an option or environment variable.
33+
You can obtain an API key via a browser on [OpenNeuro](https://openneuro.org/keygen) after logging to the OpenNeuro platform via one of the provided authentication services (for example ORCID).
34+
35+
You can also specify this as an option or environment variable.
3036

3137
```shell
3238
# For scripts
3339
export OPENNEURO_API_KEY=<api_key>
3440
deno run -A jsr:@openneuro/cli login --error-reporting true
3541
```
3642

37-
### Uploading
43+
## Usage
44+
45+
### Uploading datasets
46+
47+
To upload a new dataset:
3848

3949
```shell
4050
# Path to the dataset root (directory containing dataset_description.json)
4151
deno run -A jsr:@openneuro/cli upload --affirmDefaced path/to/dataset
4252
```
4353

54+
Your dataset must pass validation to upload but warnings can be skipped with `deno run -A jsr:@openneuro/cli upload --ignoreWarnings path/to/dataset`.
55+
56+
To resume an interrupted upload or add files to an existing dataset:
57+
4458
```shell
4559
# Add files to an existing dataset
4660
deno run -A jsr:@openneuro/cli upload --dataset ds000001 path/to/dataset
4761
```
4862

63+
where <accession_number> is a unique dataset identifier that can be found in the URL. For example accession number for `https://openneuro.org/datasets/ds001555` is `ds001555`.
64+
65+
This command will add or replace any files in the dataset but does not delete any files that are only present in the server copy of the dataset.
66+
67+
### Downloading datasets
68+
69+
Downloads using the CLI will create a DataLad dataset and configure a special remote to retrieve the larger annexed files from OpenNeuro.
70+
71+
To download a snapshot:
72+
73+
```shell
74+
deno run -A jsr:@openneuro/cli download <accession number> <destination directory>
75+
```
76+
77+
To download the current draft files:
78+
79+
```shell
80+
deno run -A jsr:@openneuro/cli download --draft <accession number> <destination directory>
81+
```
82+
83+
If the destination directory does not exist, it will be created.
84+
85+
To download the annexed objects, use [DataLad](https://datalad.org/) or [git-annex](https://git-annex.branchable.com).
86+
87+
```shell
88+
cd ds000001
89+
# Make sure you have the `git-annex-remote-openneuro` script available in your path
90+
git-annex get <path or paths to download>
91+
# DataLad is supported as well
92+
datalad get <path or paths to download>
93+
```
94+
95+
### Debugging issues
96+
4997
```shell
5098
# To debug issues - enable logging and provide this log to support or open a GitHub issue
5199
export OPENNEURO_LOG=INFO
52100
deno run -A jsr:@openneuro/cli upload --affirmDefaced path/to/dataset
53101
```
54102

55-
## Implementation Notes
103+
### Implementation Notes
56104

57-
This tool uses isomorphic git to download, modify, and push datasets using OpenNeuro's [git interface](https://docs.openneuro.org/git.html). Other tools that support git and git-annex repositories such as [DataLad](https://www.datalad.org/) can also be used with the local copy.
105+
This tool uses isomorphic git to download, modify, and push datasets using OpenNeuro's [git interface](https://docs.openneuro.org/git.html). Other tools that support git and git-annex repositories such as [DataLad](https://www.datalad.org/) can also be used with the local copy.

docs/packages/openneuro-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
../../packages/openneuro-cli/README.md
1+
../../cli/README.md

0 commit comments

Comments
 (0)