Skip to content

Commit c73ee70

Browse files
authored
Merge pull request #7 from srl-labs/develop
Develop
2 parents 9f5779b + b97892d commit c73ee70

File tree

5 files changed

+32
-16
lines changed

5 files changed

+32
-16
lines changed

CHANGELOG.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Change Log
22

3-
All notable changes to the "vscode-containerlab" extension will be documented in this file.
3+
## [0.2.0] - 2025-25-01
4+
### Added
5+
- Check if containerlab is installed
46

5-
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
7+
## [0.1.0] - 2025-25-01
8+
- Initial public release
69

710
## [0.0.1] - 2025-22-01
811

9-
## [Unreleased]
10-
1112
- Initial release

README.md

-9
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ These commands are available via:
6262

6363
- None reported. If you spot any bug or have a feature request, please open an issue on our repository.
6464

65-
---
66-
67-
## Release Notes
68-
69-
### 0.1.0
70-
71-
- Initial release of **vscode-containerlab**.
72-
73-
7465
---
7566

7667
## Feedback and Contributions

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"displayName": "Containerlab",
55
"icon": "resources/containerlab.png",
66
"description": "Manages containerlab topologies in VS Code",
7-
"version": "0.1.2",
7+
"version": "0.2.0",
88
"engines": {
99
"vscode": "^1.70.0"
1010
},

src/extension.ts

+26-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as vscode from 'vscode';
22
import { ContainerlabTreeDataProvider } from './containerlabTreeDataProvider';
3+
import { promisify } from 'util';
4+
import { exec } from 'child_process';
35
import {
46
deploy,
57
deployCleanup,
@@ -21,9 +23,32 @@ import {
2123
} from './commands/index';
2224

2325
export let outputChannel: vscode.OutputChannel;
26+
const execAsync = promisify(exec);
2427

25-
export function activate(context: vscode.ExtensionContext) {
28+
export async function activate(context: vscode.ExtensionContext) {
2629
outputChannel = vscode.window.createOutputChannel("Containerlab");
30+
context.subscriptions.push(outputChannel);
31+
32+
// Check if containerlab is installed
33+
let versionOutput: string;
34+
try {
35+
const { stdout } = await execAsync('sudo containerlab version');
36+
versionOutput = stdout;
37+
} catch (err) {
38+
// Show error message with button to open installation guide
39+
const installAction = 'Open Installation Guide';
40+
const selection = await vscode.window.showErrorMessage(
41+
'containerlab not detected. Please install it first.',
42+
installAction
43+
);
44+
45+
if (selection === installAction) {
46+
vscode.env.openExternal(vscode.Uri.parse('https://containerlab.dev/install/'));
47+
}
48+
versionOutput = '';
49+
}
50+
51+
2752
const provider = new ContainerlabTreeDataProvider();
2853
vscode.window.registerTreeDataProvider('containerlabExplorer', provider);
2954

@@ -62,7 +87,6 @@ export function activate(context: vscode.ExtensionContext) {
6287
}, refreshInterval);
6388
context.subscriptions.push({ dispose: () => clearInterval(intervalId) });
6489

65-
vscode.window.showInformationMessage('Containerlab Extension is now active!');
6690
}
6791

6892
export function deactivate() {}
Binary file not shown.

0 commit comments

Comments
 (0)