mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-08-31 03:07:23 +00:00
fix(preferences): pass all command preferences to setCurrentPlugin
Previously, we were passing in only the plugin preferences. This means that when calling `getPreferenceValues`, none of the command preferences would be returned. This commit changes it to return *all* command preferences -- I do not think it will cause any problems, but we'll see I guess ¯\_(ツ)_/¯
This commit is contained in:
parent
2d40fee318
commit
a561534075
1 changed files with 6 additions and 10 deletions
|
@ -130,15 +130,7 @@ interface LaunchProps {
|
|||
|
||||
export const runPlugin = (pluginPath?: string, mode: 'view' | 'no-view' = 'view'): void => {
|
||||
let pluginName = 'unknown';
|
||||
let preferences: Array<{
|
||||
name: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
type: 'textfield' | 'dropdown' | 'checkbox' | 'directory';
|
||||
required?: boolean;
|
||||
default?: string | boolean;
|
||||
data?: Array<{ title: string; value: string }>;
|
||||
}> = [];
|
||||
let preferences: Preference[] = [];
|
||||
|
||||
if (!pluginPath) {
|
||||
throw new Error('No plugin specified.');
|
||||
|
@ -153,7 +145,11 @@ export const runPlugin = (pluginPath?: string, mode: 'view' | 'no-view' = 'view'
|
|||
try {
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
||||
pluginName = packageJson.name || path.basename(pluginDir);
|
||||
preferences = packageJson.preferences || [];
|
||||
const pluginPreferences = packageJson.preferences || [];
|
||||
const allCommandPreferences = (packageJson.commands || []).flatMap(
|
||||
(cmd: { preferences?: Preference[] }) => cmd.preferences || []
|
||||
);
|
||||
preferences = [...pluginPreferences, ...allCommandPreferences];
|
||||
} catch (error) {
|
||||
writeLog(`Error reading plugin package.json: ${error}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue