Download src/modules/explorer/lib/contextActions.ts from lekmikdok/termix: direct link, hf CLI and curl.
- Browser
- Download file 663 Bytes
-
https://huggingface.co/spaces/lekmikdok/termix/resolve/main/src/modules/explorer/lib/contextActions.ts
- Command line
-
hf download hf://spaces/lekmikdok/termix/src/modules/explorer/lib/contextActions.ts
-
curl -L -o contextActions.ts https://huggingface.co/spaces/lekmikdok/termix/resolve/main/src/modules/explorer/lib/contextActions.ts
663 Bytes
| import { revealItemInDir } from "@tauri-apps/plugin-opener"; | |
| export async function copyToClipboard(text: string): Promise<void> { | |
| try { | |
| await navigator.clipboard.writeText(text); | |
| } catch { | |
| // Best-effort; ignore in environments without clipboard permission. | |
| } | |
| } | |
| export function relativePath(rootPath: string, path: string): string { | |
| if (path === rootPath) return "."; | |
| if (path.startsWith(`${rootPath}/`)) return path.slice(rootPath.length + 1); | |
| return path; | |
| } | |
| export async function revealInFinder(path: string): Promise<void> { | |
| try { | |
| await revealItemInDir(path); | |
| } catch (e) { | |
| console.error("revealItemInDir failed:", e); | |
| } | |
| } | |