mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
updated /quit to use new slash command arch (#4259)
Co-authored-by: Abhi <abhipatel@google.com>
This commit is contained in:
35
packages/cli/src/ui/commands/quitCommand.ts
Normal file
35
packages/cli/src/ui/commands/quitCommand.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { formatDuration } from '../utils/formatters.js';
|
||||
import { type SlashCommand } from './types.js';
|
||||
|
||||
export const quitCommand: SlashCommand = {
|
||||
name: 'quit',
|
||||
altName: 'exit',
|
||||
description: 'exit the cli',
|
||||
action: (context) => {
|
||||
const now = Date.now();
|
||||
const { sessionStartTime } = context.session.stats;
|
||||
const wallDuration = now - sessionStartTime.getTime();
|
||||
|
||||
return {
|
||||
type: 'quit',
|
||||
messages: [
|
||||
{
|
||||
type: 'user',
|
||||
text: `/quit`, // Keep it consistent, even if /exit was used
|
||||
id: now - 1,
|
||||
},
|
||||
{
|
||||
type: 'quit',
|
||||
duration: formatDuration(wallDuration),
|
||||
id: now,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user