mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2026-02-22 16:47:43 +00:00
Add WSL support for usage terminal commands
Run ccusage commands through bash -ic in WSL to properly load shell environment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2716,17 +2716,29 @@ class ClaudeChatProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _openUsageTerminal(usageType: string): void {
|
private _openUsageTerminal(usageType: string): void {
|
||||||
|
// Get WSL configuration
|
||||||
|
const config = vscode.workspace.getConfiguration('claudeCodeChat');
|
||||||
|
const wslEnabled = config.get<boolean>('wsl.enabled', false);
|
||||||
|
const wslDistro = config.get<string>('wsl.distro', 'Ubuntu');
|
||||||
|
|
||||||
const terminal = vscode.window.createTerminal({
|
const terminal = vscode.window.createTerminal({
|
||||||
name: 'Claude Usage',
|
name: 'Claude Usage',
|
||||||
location: { viewColumn: vscode.ViewColumn.One }
|
location: { viewColumn: vscode.ViewColumn.One }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let command: string;
|
||||||
if (usageType === 'plan') {
|
if (usageType === 'plan') {
|
||||||
// Plan users get live usage view
|
// Plan users get live usage view
|
||||||
terminal.sendText('npx -y ccusage blocks --live');
|
command = 'npx -y ccusage blocks --live';
|
||||||
} else {
|
} else {
|
||||||
// API users get recent usage history
|
// API users get recent usage history
|
||||||
terminal.sendText('npx -y ccusage blocks --recent --order desc');
|
command = 'npx -y ccusage blocks --recent --order desc';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wslEnabled) {
|
||||||
|
terminal.sendText(`wsl -d ${wslDistro} bash -ic "${command}"`);
|
||||||
|
} else {
|
||||||
|
terminal.sendText(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
terminal.show();
|
terminal.show();
|
||||||
|
|||||||
Reference in New Issue
Block a user