Use zsh aliases to open specefic url

Hi everyone,

Since I have been using a mac I have become quite a fan of zsh (other link).
Now I had a question that I have not yet found an answer to.

We use both Jira and Gitlab for our development.

Now I was wondering if it is possible to create an (firefix) alias that opens a certain link, some of which is static and the rest dynamic

For example:

ja open ticket-105
that opens:
https://example.atlassian.net/browse/ticket-105
In Firefox

1 Like

Sure :slight_smile:

In ~/.zshrc, add the following:

function ja {
        if [[ "$1" == "open" ]]; then
                open "https://example.atlassian.net/browse/"$2
        fi
}

Then run source ~/.zshrc to make it effective immediately (without having to log out and log in again).

EDIT: You seem to be on a Mac, so we should probably use open rather then xdg-open.

2 Likes

Works like a charm

1 Like