This project provides a set of commands to backup and restore files in a Nexus Repository. It uses the Typer library to create a command-line interface (CLI).
Before running the commands, make sure you have Python 3.12 or later installed. Then, install the required libraries with pip:
pip install -r requirements.txtThe CLI provides three commands: repo-list, download, and upload.
The repo-list command retrieves a list of repositories from a Nexus server.
python scripts repo-list --nexus-base-url http://example.com:8081 --username <username> --password <password>The download command downloads components from a Nexus repository to a local directory.
python scripts download --nexus-base-url http://example.com:8081 --repo-name <repository-name> --username <username> --password <password> --destination <path>| Option | Default Value | Description |
|---|---|---|
| nexus-base-url | http://localhost:8081 | The repository URL |
| repo-name | pypi-all | The repository name |
| username | admin | The username for authentication |
| password | admin123 | The password for authentication |
| destination | backup | The destination for backup |
The upload command uploads components from a local directory to a Nexus repository.
python scripts upload --nexus-base-url http://example.com:8081 --repo-name <repository-name> --username <username> --password <password> --source_directory <path>| Option | Default Value | Description |
|---|---|---|
| nexus-base-url | http://localhost:8081 | The repository URL |
| repo-name | pypi-all | The repository name |
| username | admin | The username for authentication |
| password | admin123 | The password for authentication |
| source-directory | backup | The source directory for restore |
In these commands, replace http://example.com:8081, <repository-name>, <username>, <password>, and <path> with your Nexus server URL, repository name, username, password, and the path to the local directory, respectively.
Contributions are welcome! Please feel free to submit a Pull Request.