Skip to content

Commit

Permalink
Main repo parity
Browse files Browse the repository at this point in the history
  • Loading branch information
SKaplanOfficial committed Jul 23, 2024
1 parent c54185d commit 97fa82c
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://www.raycast.com/schemas/extension.json",
"name": "pins",
"title": "Pins",
"version": "1.8.0",
"version": "1.9.0",
"description": "Create pins for paths and URLs and display them in the menu bar",
"keywords": [
"pin",
Expand Down Expand Up @@ -294,7 +294,7 @@
"name": "showVisibility",
"type": "checkbox",
"label": "Show Visibility",
"description": "Whether to show the visibility for each pin.",
"description": "Whether to show the visibility for each group.",
"default": true,
"required": false
},
Expand Down
7 changes: 6 additions & 1 deletion src/components/PinForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,12 @@ export const PinForm = (props: { pin?: Pin; setPins?: React.Dispatch<React.SetSt
info="Controls the visibility of the pin in the 'View Pins' command and the menu bar dropdown. If set to 'Hidden', you can find the pin by using the 'Show Hidden Pins' action of the 'View Pins' command. Hidden pins can still be opened using deeplinks, while disabled pins cannot be opened at all."
defaultValue={pin ? pin.visibility : Visibility.USE_PARENT}
>
<Form.Dropdown.Item key="use_parent" title="Use Parent Setting" value={Visibility.USE_PARENT} icon={Icon.Gear} />
<Form.Dropdown.Item
key="use_parent"
title="Use Parent Setting"
value={Visibility.USE_PARENT}
icon={Icon.Gear}
/>
<Form.Dropdown.Item key="visible" title="Visible" value={Visibility.VISIBLE} icon={Icon.Eye} />
<Form.Dropdown.Item
key="menubarOnly"
Expand Down
6 changes: 1 addition & 5 deletions src/components/actions/CopyPinActionsSubmenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ export default function CopyPinActionsSubmenu(props: { pin: Pin; pins: Pin[] })
const { pin, pins } = props;

return (
<ActionPanel.Submenu
title="Clipboard Actions"
icon={Icon.Clipboard}
shortcut={Keyboard.Shortcut.Common.Copy}
>
<ActionPanel.Submenu title="Clipboard Actions" icon={Icon.Clipboard} shortcut={Keyboard.Shortcut.Common.Copy}>
<Action.CopyToClipboard
title="Copy Pin Name"
content={pin.name}
Expand Down
5 changes: 5 additions & 0 deletions src/import-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { StorageKey, SORT_STRATEGY, Visibility } from "./lib/constants";
import { getGroups, Group, isGroup, validateGroups } from "./lib/Groups";
import { getPins, Pin, validatePins } from "./lib/Pins";
import { setStorage } from "./lib/storage";
import { GroupDisplaySetting } from "./lib/preferences";

/**
* Merges the existing pins/groups with the imported pins/groups, removing any duplicate entries. Duplicate entries are determined by the name of the pin. The ID of each pin is updated to ensure that there are no duplicates.
Expand Down Expand Up @@ -174,6 +175,10 @@ const importCSVData = async (data: string[][], importMethod: string) => {
id: parseInt(row[indices.id]),
visibility:
indices.visibility == -1 ? undefined : (row[indices.visibility] as Visibility) || Visibility.VISIBLE,
menubarDisplay:
indices.menubarDisplay == -1
? undefined
: (row[indices.menubarDisplay] as GroupDisplaySetting) || GroupDisplaySetting.USE_PARENT,
};
});
await importJSONData({ groups: newGroups }, importMethod);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/placeholders/custom-placeholders/deletePin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const DeletePinDirective: Placeholder = {
return { result: "" };
},
constant: false,
fn: async (pinRef, silent = "false") => (await DeletePinDirective.apply(`{{deletePin silent=${silent}:${pinRef}}}`)).result,
fn: async (pinRef, silent = "false") =>
(await DeletePinDirective.apply(`{{deletePin silent=${silent}:${pinRef}}}`)).result,
example: "{{deletePin:pinName}}",
description: "Deletes a pin.",
hintRepresentation: "{{deletePin silent=true:...}}",
Expand Down
5 changes: 3 additions & 2 deletions src/lib/placeholders/custom-placeholders/pinName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ const PinNamePlaceholder: Placeholder = {
name: "pinName",
regex: /{{pinName}}/,
rules: [],
apply: async (str, context?: { [key: string]: unknown } ) => {
apply: async (str, context?: { [key: string]: unknown }) => {
if (!context || !context["pin"]) {
return { result: "" };
}
return { result: (context["pin"] as Pin).name };
},
constant: false,
fn: async (context?) => (await PinNamePlaceholder.apply(`{{pinName}}`, context as unknown as { [key: string]: unknown })).result,
fn: async (context?) =>
(await PinNamePlaceholder.apply(`{{pinName}}`, context as unknown as { [key: string]: unknown })).result,
example: "{{pinName}}",
description: "Gets the name of the current pin.",
hintRepresentation: "{{pinName}}",
Expand Down
5 changes: 3 additions & 2 deletions src/lib/placeholders/custom-placeholders/pinTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ const PinTargetPlaceholder: Placeholder = {
name: "pinTarget",
regex: /{{pinTarget}}/,
rules: [],
apply: async (str, context?: { [key: string]: unknown } ) => {
apply: async (str, context?: { [key: string]: unknown }) => {
if (!context || !context["pin"]) {
return { result: "" };
}
return { result: (context["pin"] as Pin).url };
},
constant: false,
fn: async (context?) => (await PinTargetPlaceholder.apply(`{{pinTarget}}`, context as unknown as { [key: string]: unknown })).result,
fn: async (context?) =>
(await PinTargetPlaceholder.apply(`{{pinTarget}}`, context as unknown as { [key: string]: unknown })).result,
example: "{{pinTarget}}",
description: "Gets the target of the current pin.",
hintRepresentation: "{{pinTarget}}",
Expand Down
7 changes: 5 additions & 2 deletions src/lib/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ export const runCommandSync = (command: string) => {
* @returns A promise resolving to the output of the command as a string.
*/
export const runCommandInTerminal = async (command: string): Promise<string> => {
const output = await runAppleScript(`tell application "Terminal"
const output = await runAppleScript(
`tell application "Terminal"
try
activate
do script "${command.replaceAll('"', '\\"')}"
end try
end tell`, { timeout: 0 });
end tell`,
{ timeout: 0 },
);
return output;
};

Expand Down

0 comments on commit 97fa82c

Please sign in to comment.