mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-04 06:30:53 +00:00
ui tweaks (#442)
This commit is contained in:
parent
28acb8d495
commit
9c72a3ae12
4 changed files with 30 additions and 22 deletions
|
|
@ -5,6 +5,20 @@
|
|||
*/
|
||||
|
||||
import path from 'node:path';
|
||||
import os from 'os';
|
||||
|
||||
/**
|
||||
* Replaces the home directory with a tilde.
|
||||
* @param path - The path to tildeify.
|
||||
* @returns The tildeified path.
|
||||
*/
|
||||
export function tildeifyPath(path: string): string {
|
||||
const homeDir = os.homedir();
|
||||
if (path.startsWith(homeDir)) {
|
||||
return path.replace(homeDir, '~');
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortens a path string if it exceeds maxLen, prioritizing the start and end segments.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue