Skip to content

Commit 97daf4a

Browse files
authored
Add --version and --help flags (#1)
1 parent a3bb333 commit 97daf4a

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "linear-release",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"private": true,
55
"description": "CLI tool to integrate CI/CD pipelines with Linear releases",
66
"homepage": "https://github.com/linear/linear-release",

src/index.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,46 @@ import { log } from "./log";
1818
import { pluralize } from "./util";
1919
import { buildUserAgent } from "./user-agent";
2020

21+
declare const CLI_VERSION: string;
22+
23+
if (process.argv.includes("--version") || process.argv.includes("-v")) {
24+
console.log(CLI_VERSION);
25+
process.exit(0);
26+
}
27+
28+
if (process.argv.includes("--help") || process.argv.includes("-h")) {
29+
console.log(`Linear Release CLI v${CLI_VERSION}
30+
31+
Integrate CI/CD pipelines with Linear releases.
32+
33+
Usage: linear-release <command> [options]
34+
35+
Commands:
36+
sync Create or update a release by scanning commits (default)
37+
complete Mark the current release as complete
38+
update Update the deployment stage of a release
39+
40+
Options:
41+
--name=<name> Custom release name (sync only)
42+
--version=<version> Release version identifier
43+
--stage=<stage> Deployment stage (required for update)
44+
--include-paths=<paths> Filter commits by file paths (comma-separated globs)
45+
-v, --version Show version number
46+
-h, --help Show this help message
47+
48+
Environment:
49+
LINEAR_ACCESS_KEY Pipeline access key (required)
50+
51+
Examples:
52+
linear-release sync
53+
linear-release sync --name="Release 1.2.0" --version="1.2.0"
54+
linear-release complete
55+
linear-release update --stage=production
56+
linear-release sync --include-paths="apps/web/**,packages/**"
57+
`);
58+
process.exit(0);
59+
}
60+
2161
const accessKey: string = process.env.LINEAR_ACCESS_KEY || "";
2262
const command: string = process.argv[2] || "sync";
2363

0 commit comments

Comments
 (0)