Skip to content

Commit a25d400

Browse files
committed
initial commit
0 parents  commit a25d400

23 files changed

Lines changed: 1836 additions & 0 deletions

File tree

.github/workflows/go.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
13+
build-release:
14+
name: Build release Executable (${{ matrix.os }})
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-musl
21+
- os: ubuntu-latest
22+
target: armv7-unknown-linux-musleabihf
23+
- os: ubuntu-latest
24+
target: aarch64-unknown-linux-musl
25+
- os: macos-latest
26+
target: x86_64-apple-darwin
27+
- os: macos-latest
28+
target: aarch64-apple-darwin
29+
- os: windows-latest
30+
target: x86_64-pc-windows-msvc
31+
env:
32+
BINARY_EXTENSION: ${{ endsWith(matrix.target, '-msvc') && '.exe' || '' }}
33+
PATH_BINARY: ${{ github.workspace }}/target/${{ matrix.TARGET }}/release/lin${{ matrix.EXTENSION }}${{ endsWith(matrix.target, '-msvc') && '.exe' || '' }}
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- name: Install deps for linux build
38+
if: ${{ matrix.os == 'ubuntu-latest' }}
39+
uses: awalsh128/cache-apt-pkgs-action@latest
40+
with:
41+
packages: gcc libgl1-mesa-dev xorg-dev
42+
version: 1.0
43+
44+
- name: Set up Go
45+
uses: actions/setup-go@v5
46+
with:
47+
go-version: '1.25.4'
48+
49+
- name: Build
50+
run: |
51+
go build -v -o ${{ env.PATH_BINARY }} ./cmd/...
52+
53+
- uses: actions/upload-artifact@v4
54+
with:
55+
name: ${{ matrix.target }}-lin${{ env.BINARY_EXTENSION }}
56+
path: ${{ env.PATH_BINARY }}
57+
58+
- name: Evaluate shasum
59+
run: echo -n $(shasum -ba 256 ${{ env.PATH_BINARY }} | cut -d " " -f 1) > ${{ env.PATH_BINARY }}.sha256
60+
61+
- uses: actions/upload-artifact@v4
62+
with:
63+
name: ${{ matrix.target }}-lin.sha256
64+
path: ${{ env.PATH_BINARY }}.sha256
65+
66+
- name: '[Optional] Publish Artifact'
67+
if: ${{ github.event_name == 'release' }}
68+
uses: svenstaro/upload-release-action@v2
69+
with:
70+
repo_token: ${{ secrets.GITHUB_TOKEN }}
71+
file: ${{ env.PATH_BINARY }}
72+
asset_name: ${{ matrix.target }}-lin${{ env.BINARY_EXTENSION }}
73+
tag: ${{ github.ref }}
74+
overwrite: true
75+
76+
- name: '[Optional] Publish Artifact (shasum)'
77+
if: ${{ github.event_name == 'release' }}
78+
uses: svenstaro/upload-release-action@v2
79+
with:
80+
repo_token: ${{ secrets.GITHUB_TOKEN }}
81+
file: ${{ env.PATH_BINARY }}.sha256
82+
asset_name: ${{ matrix.target }}-lin${{ env.BINARY_EXTENSION }}.sha256
83+
tag: ${{ github.ref }}
84+
overwrite: true

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.env
2+
bin/
3+
log/
4+
*.log
5+
.#*
6+
.linear-cli-config.toml

LICENSE.md

Lines changed: 132 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
PKGS := $(shell go list ./cmd/...)
2+
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
3+
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
4+
5+
export GO111MODULE=on
6+
#export GOOS=linux
7+
#export GOARCH=amd64
8+
9+
.PHONY: all dep build clean test coverage coverhtml lint
10+
11+
all: build
12+
13+
lint: ## Lint the files
14+
golint -set_exit_status ${PKG_LIST}
15+
16+
test: ## Run unittests
17+
go test -short ${PKG_LIST}
18+
19+
race: dep ## Run data race detector
20+
go test -race -short ${PKG_LIST}
21+
22+
msan: dep ## Run memory sanitizer
23+
go test -msan -short ${PKG_LIST}
24+
25+
coverage: ## Generate global code coverage report
26+
./tools/coverage.sh;
27+
28+
coverhtml: ## Generate global code coverage report in HTML
29+
./tools/coverage.sh html;
30+
31+
dep: ## Get the dependencies
32+
go mod download
33+
34+
build: dep ## Build the binary file
35+
mkdir -p bin
36+
go build -v -o ./bin/ $(PKGS)
37+
38+
clean: ## Remove previous build
39+
find .bin/ -maxdepth 1 -type f -executable -exec rm {} +
40+
41+
help: ## Display this help screen
42+
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

README.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# Linear CLI
2+
3+
A CLI client to linear.app
4+
5+
This is primarily aimed at allowing a dev to interact with their issues from a CLI.
6+
The goal is to improve adoption of Linear.app by devs who have a heavy terminal-focused workflow.
7+
8+
This allows for devs to quickly create issues for new tasks they may be starting work on, and also automatically create a new local git branch for the linear issue (and switch into it).
9+
This also provides an easy way to switch to git branch for a linear issue.
10+
11+
## Usage
12+
13+
### Configuration
14+
15+
XDG Config location is honored. In Linux/Mac this should be `~/.config/linear-cli/config.toml`
16+
17+
This file holds your Linear.app API Key.
18+
You can create a Personal API Key in Settings > Security & access
19+
20+
```toml
21+
LINEAR_API_KEY = "<key>"
22+
```
23+
24+
#### Project Level Settings
25+
26+
You can set project level settings in your project directory by creating a `.linear-cli-config.toml`.
27+
28+
A Sample of this looks like:
29+
30+
```toml
31+
default_git_head_branch = "main"
32+
default_team = "Engineering"
33+
34+
[default_issue_template]
35+
team = "Engineering"
36+
priority = 3
37+
status = "Todo"
38+
labels = ["Backend Team"]
39+
```
40+
41+
#### List
42+
43+
- Issues
44+
- Teams
45+
- Projects
46+
47+
```
48+
NAME:
49+
lin list - list entities
50+
51+
USAGE:
52+
lin list [command [command options]]
53+
54+
COMMANDS:
55+
issue, i, is list issues
56+
team, tm list teams
57+
project, prj list projects
58+
59+
OPTIONS:
60+
--limit int (default: 50)
61+
--help, -h show help
62+
```
63+
64+
##### Examples:
65+
66+
- To list all you issues under a given team: (all of below are equivalent)
67+
```
68+
lin list issues --team="Engineering" --mine
69+
```
70+
71+
```
72+
lin ls is --tm="Engineering" --mine
73+
```
74+
75+
```
76+
lin l is --tm="Engineering" --mine
77+
```
78+
79+
80+
#### Details
81+
82+
- Issue
83+
84+
```
85+
NAME:
86+
lin detail - show entity detail
87+
88+
USAGE:
89+
lin detail [command [command options]]
90+
91+
COMMANDS:
92+
issue, i, is issue details
93+
94+
OPTIONS:
95+
--help, -h show help
96+
```
97+
98+
##### Examples:
99+
100+
- To get details of a specific issue: (all of below are equivalent)
101+
102+
```
103+
lin detail issue --id=ENG-9999
104+
```
105+
106+
```
107+
lin cat issue --id=ENG-9999
108+
```
109+
110+
```
111+
lin cat is --id=ENG-9999
112+
```
113+
114+
```
115+
lin cat i --id=ENG-9999
116+
```
117+
118+
119+
120+
#### Create
121+
122+
- Issue
123+
124+
Once an issue is created, linear-cli will try to open the issue in the default browser.
125+
126+
(Note: You can also set default values for fields like team, label, priority, status in the project level config file)
127+
128+
```
129+
NAME:
130+
lin new - create a new entity
131+
132+
USAGE:
133+
lin new [command [command options]]
134+
135+
COMMANDS:
136+
issue, i, is issue details
137+
138+
OPTIONS:
139+
--help, -h show help
140+
```
141+
142+
##### Examples:
143+
144+
- Create a new issue ; create a new git-branch for issue and switch to it: (all below are equivalent)
145+
146+
```
147+
lin new issue --team="Engineering" --title="test issue" --label="Backend Team" --label="Improvement" --priority=3 --status="Todo" --git-create-branch
148+
```
149+
150+
```
151+
lin touch is --tm="Engineering" --title="test issue" --label="Backend Team" --label="Improvement" --priority=3 --status="Todo" --g-cb
152+
```
153+
154+
```
155+
lin mk is --tm="Engineering" --title="test issue" --label="Backend Team" --label="Improvement" --priority=3 --status="Todo" --g-cb
156+
```
157+
158+
```
159+
lin mk i --tm="Engineering" --title="test issue" --label="Backend Team" --label="Improvement" --priority=3 --status="Todo" --g-cb
160+
```
161+
162+
163+
### Git
164+
165+
```
166+
NAME:
167+
lin git - Linear based helper commands for git repo
168+
169+
USAGE:
170+
lin git [command [command options]]
171+
172+
COMMANDS:
173+
switch, sw checkout to the branch for linear issue (if it already exists)
174+
175+
OPTIONS:
176+
--help, -h show help
177+
```
178+
179+
##### Examples
180+
181+
- Switch branch for linear issue ; Create branch if it doesn't exist: (all below are equivalent)
182+
183+
```
184+
lin git switch --id=ENG-9999 --create-if-not-exists
185+
```
186+
187+
```
188+
lin g sw --id=ENG-9999 --cr
189+
```
190+
191+
192+
## TODO
193+
194+
- [ ] Cache Teams and Issue Labels locally
195+
- [ ] Show timestamps in local timezone

0 commit comments

Comments
 (0)