diff options
| author | Lee James <[email protected]> | 2025-08-07 12:00:46 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-07 16:00:46 +0000 |
| commit | 8d848dca4a52d169b3dfea2f66e7e5f69ee5e45c (patch) | |
| tree | bbb82f3a1e8024e6c116c1ca3b5a5313fa31ab02 /packages/cli/src/ui/utils/commandUtils.ts | |
| parent | 6ae75c9f32a968efa50857a8f24b958a58a84fd6 (diff) | |
feat: open repo secrets page in addition to README (#5684)
Diffstat (limited to 'packages/cli/src/ui/utils/commandUtils.ts')
| -rw-r--r-- | packages/cli/src/ui/utils/commandUtils.ts | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/packages/cli/src/ui/utils/commandUtils.ts b/packages/cli/src/ui/utils/commandUtils.ts index 4280388f..80ed51ae 100644 --- a/packages/cli/src/ui/utils/commandUtils.ts +++ b/packages/cli/src/ui/utils/commandUtils.ts @@ -27,7 +27,7 @@ export const isAtCommand = (query: string): boolean => */ export const isSlashCommand = (query: string): boolean => query.startsWith('/'); -//Copies a string snippet to the clipboard for different platforms +// Copies a string snippet to the clipboard for different platforms export const copyToClipboard = async (text: string): Promise<void> => { const run = (cmd: string, args: string[]) => new Promise<void>((resolve, reject) => { @@ -80,3 +80,27 @@ export const copyToClipboard = async (text: string): Promise<void> => { throw new Error(`Unsupported platform: ${process.platform}`); } }; + +export const getUrlOpenCommand = (): string => { + // --- Determine the OS-specific command to open URLs --- + let openCmd: string; + switch (process.platform) { + case 'darwin': + openCmd = 'open'; + break; + case 'win32': + openCmd = 'start'; + break; + case 'linux': + openCmd = 'xdg-open'; + break; + default: + // Default to xdg-open, which appears to be supported for the less popular operating systems. + openCmd = 'xdg-open'; + console.warn( + `Unknown platform: ${process.platform}. Attempting to open URLs with: ${openCmd}.`, + ); + break; + } + return openCmd; +}; |
