How to open a file in the SAP Business Application Studio (BAS) editor with a simple command ("open <file>").
You can open a file with basctl --open file:// as described here: https://answers.sap.com/questions/13305362/open-file-from-terminal-in-bas-ide.html. This is is however quite a lot to write, especially since only absolute paths like /home/user/project/<projectname>/package.json are accepted. So I added the following helper script:
Create file /home/bin/open:
touch /home/bin/openOpen the newly created file:
basctl --open file://home/bin/openInsert within /home/bin/open:
#!/bin/bash
abspath=$(realpath $1)
basctl --open file://$abspathGrant the authorization to execute the script:
chmod +x /home/bin/openOpen .bashrc:
basctl --open file://home/user/.bashrcAppend at the end of file /home/user/.bashrc:
export PATH="/home/bin:$PATH"Now you can open a file with the command open <RelativePath> or open <AbsolutePath> in the BAS editor, like:
open package.json