Fix bulk upload example commands to work with paths with spaces (#2159)

The examples commands didn't work when the result of the subcommand $(pwd) contained spaces. This commit adds the proper escaping for them to work. This change also fixes the behavior of the alias allowing the correct current directory to be passed when it is placed inside the .bashrc file.
This commit is contained in:
Mauro Molin 2023-04-04 02:19:10 +01:00 committed by GitHub
parent 7e526f87b4
commit 9076f3e69e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,15 +60,15 @@ Be aware that as this runs inside a container, you need to mount the folder from
```bash title="Upload current directory"
cd /DIRECTORY/WITH/IMAGES
docker run -it --rm -v $(pwd):/import ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api
docker run -it --rm -v "$(pwd):/import" ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api
```
```bash title="Upload target directory"
docker run -it --rm -v /DIRECTORY/WITH/IMAGES:/import ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api
docker run -it --rm -v "/DIRECTORY/WITH/IMAGES:/import" ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api
```
```bash title="Create an alias"
alias immich="docker run -it --rm -v $(pwd):/import ghcr.io/immich-app/immich-cli:latest"
alias immich='docker run -it --rm -v "$(pwd):/import" ghcr.io/immich-app/immich-cli:latest'
immich upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api
```
@ -79,7 +79,7 @@ If you are running the CLI container on the same machine as your Immich server,
3. Use `--server http://immich-server:3001/` for the upload command instead of the external address.
```bash title="Upload to internal address"
docker run --network immich_default -it --rm -v $(pwd):/import ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://immich-server:3001/
docker run --network immich_default -it --rm -v "$(pwd):/import" ghcr.io/immich-app/immich-cli:latest upload --key HFEJ38DNSDUEG --server http://immich-server:3001/
```
:::