Skip to content

Commit

Permalink
fix: migrate cli
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Jun 9, 2024
1 parent a6d128a commit 3187245
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 44 deletions.
3 changes: 2 additions & 1 deletion .bin/update-release-cache
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -o errexit
set -o pipefail
set -o nounset

unifi-protect release-versions
poetry install
poetry run uiprotect release-versions
32 changes: 0 additions & 32 deletions .bin/update-requirements

This file was deleted.

2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"onCreateCommand": [
"/bin/bash",
"-c",
"sudo -E HOME=/root uv pip install -e '.[dev]' && /usr/local/bin/unifi-protect --install-completion bash && docker-fix"
"sudo -E HOME=/root uv pip install -e '.[dev]' && /usr/local/bin/uiprotect --install-completion bash && docker-fix"
],
"updateContentCommand": [
"/bin/bash",
Expand Down
2 changes: 1 addition & 1 deletion .docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -o errexit
set -o pipefail
set -o nounset

/usr/local/bin/unifi-protect "$@"
/usr/local/bin/uiprotect "$@"
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{
"label": "Generate Sample Data",
"type": "shell",
"command": "unifi-protect generate-sample-data -w ${input:sampleTime} ${input:sampleAnonymize}",
"command": "uiprotect generate-sample-data -w ${input:sampleTime} ${input:sampleAnonymize}",
"problemMatcher": [],
"options": {
"env": {
Expand All @@ -39,7 +39,7 @@
{
"label": "Regenerate Release Cache",
"type": "shell",
"command": "unifi-protect release-versions",
"command": "uiprotect release-versions",
"problemMatcher": [],
},
],
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pip install git+https://github.com/uilibs/uiprotect.git#egg=uiprotect
A Docker container is also provided so you do not need to install/manage Python as well. You can add the following to your `.bashrc` or similar.

```bash
function unifi-protect() {
function uiprotect() {
docker run --rm -it \
-e UFP_USERNAME=YOUR_USERNAME_HERE \
-e UFP_PASSWORD=YOUR_PASSWORD_HERE \
Expand Down Expand Up @@ -164,8 +164,8 @@ export UFP_PORT=443
# change to false if you do not have a valid HTTPS Certificate for your instance
export UFP_SSL_VERIFY=True

unifi-protect --help
unifi-protect nvr
uiprotect --help
uiprotect nvr
```

### Python
Expand Down
6 changes: 3 additions & 3 deletions docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Once you have all three setup,
2. Open the main folder
3. You should be prompted to "Reopen folder to develop in a container". If you are not, you can open the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) run the "Remote-Containers: Reopen in Container" command.

This should be all you need to do to get a working development environment. The docker container will automatically be build and VS Code will attach itself to it. The integrated terminal in VS Code will already be set up with the `unifi-protect` command.
This should be all you need to do to get a working development environment. The docker container will automatically be build and VS Code will attach itself to it. The integrated terminal in VS Code will already be set up with the `uiprotect` command.

### Docker (without VS Code)

Expand Down Expand Up @@ -75,7 +75,7 @@ There is also a [VS Code task](https://code.visualstudio.com/Docs/editor/tasks)
All of the tests in the project are ran against that is generated from a real UniFi Protect instance and then anonymized so it is safe to commit to a Git repo. To generate new sample test data:

```
unifi-protect generate-sample-data
uiprotect generate-sample-data
```

This will gather test data for 30 seconds and write it all into the `tests/sample_data` directory. During this time, it is a good idea to generate some good events that can tested. An example would be to generate a motion event for a FloodLight, Camera and/or Doorbell and then also ring a Doorbell.
Expand All @@ -87,7 +87,7 @@ This will gather test data for 30 seconds and write it all into the `tests/sampl

```bash
export UFP_SAMPLE_DIR=/workspaces/uiprotect/test-data
unifi-protect generate-sample-data
uiprotect generate-sample-data
```

### Real Data in Tests
Expand Down
2 changes: 1 addition & 1 deletion src/uiprotect/cli/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def adopt(ctx: typer.Context, name: Optional[str] = typer.Argument(None)) -> Non
Adopts a device.
By default, unadopted devices do not show up in the bootstrap. Use
`unifi-protect -u` to show unadopted devices.
`uiprotect -u` to show unadopted devices.
"""
require_device_id(ctx)
obj: ProtectAdoptableDeviceModel = ctx.obj.device
Expand Down

0 comments on commit 3187245

Please sign in to comment.