npryce / adr-tools

Command-line tools for working with Architecture Decision Records
Other
4.63k stars 588 forks source link

Support invocation of adr from paths that contain symlinks #54

Closed bompstable closed 6 years ago

bompstable commented 6 years ago

adr fails when invoked as a symlink. For example:

# ls
adr-tools-2.1.0
# ln -s adr-tools-2.1.0/src/adr adr
# ./adr
./adr: line 3: ./adr-config: No such file or directory
./adr: line 11: /adr-help: No such file or directory

This PR adds a test for this that fails then fixes the issue.

npryce commented 6 years ago

Can you not symlink to the directory instead of the script itself? Then add that directory to the PATH?

E.g.

# ls
adr-tools-2.1.0
# ln -s adr-tools-2.1.0/src adr-tools-current
# adr-tools-current/adr
usage: adr help COMMAND [ARG] ...
...
# export PATH=$PATH:$PWD/adr-tools-current
# adr
usage: adr help COMMAND [ARG] ...
...

This way there are no difficulties with reading the target of a symlink on different platforms.

npryce commented 6 years ago

There is a workaround and this PR breaks tests, so I'm closing it for now.