1#!/bin/bash
2
3set -e
4
5if [[ -z "$GITHUB_TOKEN" ]]; then
6 cat <<-MESSAGE
7Missing \`GITHUB_TOKEN\` environment variable. This token is needed
8for fetching your GitHub identity from the command-line.
9
10Create an access token here: https://github.com/settings/tokens
11Then edit your \`~/.zshrc\` (or other shell initialization script),
12adding a line like this:
13
14 export GITHUB_TOKEN="(the token)"
15
16MESSAGE
17 exit 1
18fi
19
20github_login=$(curl -sH "Authorization: bearer $GITHUB_TOKEN" https://api.github.com/user | jq -r .login)
21
22other_github_login=nathansobo
23if [[ $github_login == $other_github_login ]]; then
24 other_github_login=as-cii
25fi
26
27export ZED_ADMIN_API_TOKEN=secret
28export ZED_SERVER_URL=http://localhost:8080
29export ZED_WINDOW_SIZE=800,600
30
31cargo build
32sleep 0.1
33
34trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
35ZED_WINDOW_POSITION=0,0 ZED_IMPERSONATE=${github_login} target/debug/Zed $@ &
36sleep 0.1
37ZED_WINDOW_POSITION=800,0 ZED_IMPERSONATE=${other_github_login} target/debug/Zed &
38sleep 0.1
39wait