Skip to content

Commit 3a6cb05

Browse files
authored
Support Wezterm packaged by Nix / NixOS (#6)
1 parent 414305b commit 3a6cb05

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,15 @@ export function createSupportsHyperlinks(stream) {
9191
}
9292

9393
case 'WezTerm': {
94-
return version.major >= 20_200_620;
94+
// WezTerm packaged by Nix uses their own version scheme.
95+
if (/^0-unstable-\d{4}-\d{2}-\d{2}$/.test(TERM_PROGRAM_VERSION)) {
96+
const date = TERM_PROGRAM_VERSION.slice('0-unstable-'.length);
97+
return date >= '2020-06-20';
98+
}
99+
100+
// This number is a date and reads better grouped as such.
101+
// eslint-disable-next-line unicorn/numeric-separators-style
102+
return version.major >= 2020_06_20;
95103
}
96104

97105
case 'vscode': {

test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,30 @@ test('not supported WezTerm 20200608, tty stream', t => {
135135
}));
136136
});
137137

138+
test('supported WezTerm 20200620 packaged by Nix, tty stream', t => {
139+
t.true(isSupported({
140+
env: {
141+
TERM_PROGRAM: 'WezTerm',
142+
TERM_PROGRAM_VERSION: '0-unstable-2020-06-20',
143+
},
144+
stream: {
145+
isTTY: true,
146+
},
147+
}));
148+
});
149+
150+
test('not supported WezTerm 20200608 packaged by Nix, tty stream', t => {
151+
t.false(isSupported({
152+
env: {
153+
TERM_PROGRAM: 'WezTerm',
154+
TERM_PROGRAM_VERSION: '0-unstable-2020-06-08',
155+
},
156+
stream: {
157+
isTTY: true,
158+
},
159+
}));
160+
});
161+
138162
test('not supported vscode <= 1.0 no stream supplied', t => {
139163
t.false(isSupported({
140164
env: {

0 commit comments

Comments
 (0)