7947c3bae9
- config list: remove --long option, always display URL - config list: add ls alias (#[command(alias = "ls")]) - config delete: add rm and remove aliases (#[command(aliases = ["remove", "rm"])]) - README: update config list and config delete examples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
223 lines
4.4 KiB
Markdown
223 lines
4.4 KiB
Markdown
# mdrs
|
|
|
|
`mdrs` is a command-line client for uploading and downloading files to and from an MDRS-based repository.
|
|
|
|
## Installing
|
|
|
|
### Build from source
|
|
|
|
```shell
|
|
cargo build --release
|
|
```
|
|
|
|
The compiled binary will be available at `target/release/mdrs`.
|
|
|
|
To build a fully static binary for Linux:
|
|
|
|
```shell
|
|
cargo build --release --target x86_64-unknown-linux-musl
|
|
```
|
|
|
|
## Configuration
|
|
|
|
### Environment variables
|
|
|
|
The following environment variables can be set, either in the shell or via a `.env` file placed in the working directory:
|
|
|
|
| Variable | Default | Description |
|
|
|---|---|---|
|
|
| `MDRS_CLIENT_CONFIG_DIRNAME` | `~/.mdrs-client` | Directory where config and login cache files are stored |
|
|
| `MDRS_CLIENT_CONCURRENT` | `10` | Number of concurrent file transfers for upload/download |
|
|
|
|
## Example Usage
|
|
|
|
### config create
|
|
|
|
Register a remote host.
|
|
|
|
```shell
|
|
mdrs config create neurodata https://neurodata.riken.jp/api
|
|
```
|
|
|
|
### config update
|
|
|
|
Update the URL of a registered remote host.
|
|
|
|
```shell
|
|
mdrs config update neurodata https://neurodata.riken.jp/api
|
|
```
|
|
|
|
### config list
|
|
|
|
List registered remote hosts.
|
|
|
|
```shell
|
|
mdrs config list
|
|
mdrs config ls
|
|
```
|
|
|
|
### config delete
|
|
|
|
Remove a registered remote host.
|
|
|
|
```shell
|
|
mdrs config delete neurodata
|
|
mdrs config rm neurodata
|
|
```
|
|
|
|
### login
|
|
|
|
Log in to a remote host and cache credentials.
|
|
|
|
```shell
|
|
mdrs login neurodata:
|
|
Username: (enter your login name)
|
|
Password: (enter your password)
|
|
|
|
mdrs login -u USERNAME -p PASSWORD neurodata:
|
|
```
|
|
|
|
### logout
|
|
|
|
Log out from a remote host and remove cached credentials.
|
|
|
|
```shell
|
|
mdrs logout neurodata:
|
|
```
|
|
|
|
### whoami
|
|
|
|
Print the currently logged-in user name.
|
|
|
|
```shell
|
|
mdrs whoami neurodata:
|
|
```
|
|
|
|
### labs
|
|
|
|
List all laboratories accessible to the current user.
|
|
|
|
```shell
|
|
mdrs labs neurodata:
|
|
```
|
|
|
|
### ls
|
|
|
|
List the contents of a remote folder.
|
|
|
|
```shell
|
|
mdrs ls neurodata:/NIU/Repository/
|
|
mdrs ls -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/
|
|
mdrs ls -r neurodata:/NIU/Repository/Dataset1/
|
|
mdrs ls -J -r neurodata:/NIU/Repository/Dataset1/
|
|
mdrs ls -q neurodata:/NIU/Repository/
|
|
```
|
|
|
|
### mkdir
|
|
|
|
Create a new remote folder.
|
|
|
|
```shell
|
|
mdrs mkdir neurodata:/NIU/Repository/TEST
|
|
```
|
|
|
|
### upload
|
|
|
|
Upload a file or directory to a remote folder.
|
|
|
|
```shell
|
|
mdrs upload ./sample.dat neurodata:/NIU/Repository/TEST/
|
|
mdrs upload -r ./dataset neurodata:/NIU/Repository/TEST/
|
|
mdrs upload -r --skip-if-exists ./dataset neurodata:/NIU/Repository/TEST/
|
|
```
|
|
|
|
### download
|
|
|
|
Download a file or folder from a remote path.
|
|
|
|
```shell
|
|
mdrs download neurodata:/NIU/Repository/TEST/sample.dat ./
|
|
mdrs download -r neurodata:/NIU/Repository/TEST/dataset/ ./
|
|
mdrs download -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/Readme.dat ./
|
|
mdrs download -r --exclude /NIU/Repository/TEST/dataset/skip neurodata:/NIU/Repository/TEST/dataset/ ./
|
|
mdrs download -r --skip-if-exists neurodata:/NIU/Repository/TEST/dataset/ ./
|
|
```
|
|
|
|
### mv
|
|
|
|
Move or rename a file or folder on the remote.
|
|
|
|
```shell
|
|
mdrs mv neurodata:/NIU/Repository/TEST/sample.dat neurodata:/NIU/Repository/TEST2/sample2.dat
|
|
mdrs mv neurodata:/NIU/Repository/TEST/dataset neurodata:/NIU/Repository/TEST2/
|
|
```
|
|
|
|
### cp
|
|
|
|
Copy a file or folder on the remote.
|
|
|
|
```shell
|
|
mdrs cp neurodata:/NIU/Repository/TEST/sample.dat neurodata:/NIU/Repository/TEST2/sample2.dat
|
|
mdrs cp -r neurodata:/NIU/Repository/TEST/dataset neurodata:/NIU/Repository/TEST2/
|
|
```
|
|
|
|
### rm
|
|
|
|
Remove a file or folder from the remote.
|
|
|
|
```shell
|
|
mdrs rm neurodata:/NIU/Repository/TEST/sample.dat
|
|
mdrs rm -r neurodata:/NIU/Repository/TEST/dataset
|
|
```
|
|
|
|
### chacl
|
|
|
|
Change the access level of a remote folder.
|
|
|
|
```shell
|
|
mdrs chacl private neurodata:/NIU/Repository/Private
|
|
mdrs chacl cbs_open -r neurodata:/NIU/Repository/CBS_Open
|
|
mdrs chacl pw_open -r -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open
|
|
```
|
|
|
|
Available access levels: `private`, `public`, `pw_open`, `cbs_open`, `5kikan_open`, `cbs_pw_open`, `5kikan_pw_open`
|
|
|
|
### metadata
|
|
|
|
Show metadata for a remote folder.
|
|
|
|
```shell
|
|
mdrs metadata neurodata:/NIU/Repository/TEST/
|
|
mdrs metadata -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/
|
|
```
|
|
|
|
### file-metadata
|
|
|
|
Show metadata for a remote file.
|
|
|
|
```shell
|
|
mdrs file-metadata neurodata:/NIU/Repository/TEST/dataset/sample.dat
|
|
mdrs file-metadata -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/Readme.txt
|
|
```
|
|
|
|
### version
|
|
|
|
Show the tool name and version number.
|
|
|
|
```shell
|
|
mdrs version
|
|
```
|
|
|
|
### help
|
|
|
|
Show help for a command.
|
|
|
|
```shell
|
|
mdrs --help
|
|
mdrs upload --help
|
|
```
|
|
|
|
## License
|
|
|
|
[MIT](LICENSE) © 2026- Neuroinformatics Unit, RIKEN CBS
|