feat: add support for 'cu' command in extension installation (#3261)
This commit is contained in:
@@ -14,7 +14,7 @@ function getStdioConfig(
|
|||||||
timeout: number
|
timeout: number
|
||||||
) {
|
) {
|
||||||
// Validate that the command is one of the allowed commands
|
// Validate that the command is one of the allowed commands
|
||||||
const allowedCommands = ['docker', 'jbang', 'npx', 'uvx', 'goosed'];
|
const allowedCommands = ['cu', 'docker', 'jbang', 'npx', 'uvx', 'goosed'];
|
||||||
if (!allowedCommands.includes(cmd)) {
|
if (!allowedCommands.includes(cmd)) {
|
||||||
toastService.handleError(
|
toastService.handleError(
|
||||||
'Invalid Command',
|
'Invalid Command',
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ export function extractExtensionConfig(fixedEntry: FixedExtensionEntry): Extensi
|
|||||||
|
|
||||||
export async function replaceWithShims(cmd: string) {
|
export async function replaceWithShims(cmd: string) {
|
||||||
const binaryPathMap: Record<string, string> = {
|
const binaryPathMap: Record<string, string> = {
|
||||||
|
cu: await window.electron.getBinaryPath('cu'),
|
||||||
goosed: await window.electron.getBinaryPath('goosed'),
|
goosed: await window.electron.getBinaryPath('goosed'),
|
||||||
jbang: await window.electron.getBinaryPath('jbang'),
|
jbang: await window.electron.getBinaryPath('jbang'),
|
||||||
npx: await window.electron.getBinaryPath('npx'),
|
npx: await window.electron.getBinaryPath('npx'),
|
||||||
@@ -212,7 +213,7 @@ export async function replaceWithShims(cmd: string) {
|
|||||||
|
|
||||||
export function removeShims(cmd: string) {
|
export function removeShims(cmd: string) {
|
||||||
// Only remove shims if the path matches our known shim patterns
|
// Only remove shims if the path matches our known shim patterns
|
||||||
const shimPatterns = [/goosed$/, /docker$/, /jbang$/, /npx$/, /uvx$/];
|
const shimPatterns = [/cu$/, /goosed$/, /docker$/, /jbang$/, /npx$/, /uvx$/];
|
||||||
|
|
||||||
// Check if the command matches any shim pattern
|
// Check if the command matches any shim pattern
|
||||||
const isShim = shimPatterns.some((pattern) => pattern.test(cmd));
|
const isShim = shimPatterns.some((pattern) => pattern.test(cmd));
|
||||||
|
|||||||
@@ -270,6 +270,7 @@ export async function loadAndAddStoredExtensions() {
|
|||||||
// Update the path to the binary based on the command
|
// Update the path to the binary based on the command
|
||||||
export async function replaceWithShims(cmd: string) {
|
export async function replaceWithShims(cmd: string) {
|
||||||
const binaryPathMap: Record<string, string> = {
|
const binaryPathMap: Record<string, string> = {
|
||||||
|
cu: await window.electron.getBinaryPath('cu'),
|
||||||
goosed: await window.electron.getBinaryPath('goosed'),
|
goosed: await window.electron.getBinaryPath('goosed'),
|
||||||
jbang: await window.electron.getBinaryPath('jbang'),
|
jbang: await window.electron.getBinaryPath('jbang'),
|
||||||
npx: await window.electron.getBinaryPath('npx'),
|
npx: await window.electron.getBinaryPath('npx'),
|
||||||
|
|||||||
Reference in New Issue
Block a user