structurizr / cli

A command line utility for Structurizr.
https://docs.structurizr.com/cli
Apache License 2.0
491 stars 75 forks source link

Can't launch `structurizr.sh` if it's a symlink #77

Closed Morozzzko closed 2 years ago

Morozzzko commented 2 years ago

https://github.com/structurizr/cli/commit/d259e8bec1d9a782473a8a54209bebd771f7479e introduced a way to run structurizr-cli from any directory. Ironically, it doesn't seem to work if I have a soft symlink

I'm trying to launch structurizr from an arbitrary directory and get an error:

Error: Could not find or load main class com.structurizr.cli.StructurizrCliApplication

It appears that the problem is how the first line of structurizr.sh works with symlinks:

root@8a47c96fc549:/usr/local# structurizr-cli/structurizr.sh
SCRIPT_DIR is /usr/local/structurizr-cli
Structurizr CLI v1.19.0
Structurizr DSL v1.19.1
Usage: structurizr push|pull|lock|unlock|export|validate|list [options]
root@8a47c96fc549:/usr/local# structurizr-cli
SCRIPT_DIR is /usr/local/bin
Error: Could not find or load main class com.structurizr.cli.StructurizrCliApplication

See dockerfile for reproduction:

FROM jruby:9.3

ARG STRUCTURIZR_CLI_VERSION=1.19.0

RUN apt-get install -y bash curl

RUN curl -L -o /tmp/structurizr-cli.zip "https://github.com/structurizr/cli/releases/download/v$STRUCTURIZR_CLI_VERSION/structurizr-cli-$STRUCTURIZR_CLI_VERSION.zip" && unzip "/tmp/structurizr-cli.zip" -d /usr/local/structurizr-cli && ln -s /usr/local/structurizr-cli/structurizr.sh /usr/local/bin/structurizr-cli

CMD 'structurizr-cli'
simonbrowndotje commented 2 years ago

This seems to be a duplicate of #43.

Morozzzko commented 2 years ago

oh right, it does. sorry!