launch and manage windows terminal instances with raycast
raycast raycast-extension

add support for aliases in folders

+61 -19
+61 -19
src/open-profile.tsx
··· 162 162 } 163 163 164 164 function FolderView(props: { folder: Folder; profiles: Profile[] }) { 165 + const [getAliases, setAliases] = useState<{ [key: string]: { alias: string } }>({}); 166 + 167 + useEffect(() => { 168 + async function load() { 169 + const profiles = await getAllProfilePreferences(); 170 + setAliases(profiles); 171 + } 172 + load(); 173 + }, []); 174 + 165 175 return ( 166 176 <List searchBarPlaceholder={`Search in ${props.folder.name}...`}> 167 177 <List.Section title={props.folder.name}> ··· 174 184 <List.Item 175 185 key={item.profile} 176 186 title={props.profiles.filter((profile) => profile.guid === item.profile)[0].name} 177 - actions={<Actions profile={props.profiles.filter((profile) => profile.guid === item.profile)[0]} />} 187 + actions={ 188 + <Actions 189 + profile={props.profiles.filter((profile) => profile.guid === item.profile)[0]} 190 + alias={ 191 + getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 192 + ? getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 193 + .alias 194 + : "" 195 + } 196 + /> 197 + } 178 198 icon={ 179 199 props.profiles.filter((profile) => profile.guid === item.profile)[0].source === 180 200 "Windows.Terminal.SSH" ··· 201 221 "{574e775e-4f2a-5b96-ac1e-a2962a402336}" || // Windows PowerShell 7.0+ 202 222 props.profiles.filter((profile) => profile.guid === item.profile)[0].source === 203 223 "Windows.Terminal.PowershellCore" // Windows Powershell 7.0+ (source for better handling) 204 - ? ["pwsh", "ps", "posh"] 224 + ? [ 225 + "pwsh", 226 + "ps", 227 + "posh", 228 + getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 229 + ? getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 230 + .alias 231 + : "", 232 + ] 205 233 : props.profiles.filter((profile) => profile.guid === item.profile)[0].guid === 206 234 "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}" 207 - ? ["cmd"] 208 - : [] 235 + ? [ 236 + "cmd", 237 + getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 238 + ? getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 239 + .alias 240 + : "", 241 + ] 242 + : [ 243 + getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 244 + ? getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 245 + .alias 246 + : "", 247 + ] 248 + } 249 + accessories={ 250 + getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 251 + ? [ 252 + { 253 + tag: { 254 + value: 255 + getAliases[props.profiles.filter((profile) => profile.guid === item.profile)[0].guid] 256 + .alias, 257 + }, 258 + }, 259 + ] 260 + : undefined 209 261 } 210 262 /> 211 263 ); ··· 361 413 ? ["pwsh", "ps", "posh", getAliases[item.guid] ? getAliases[item.guid].alias : ""] 362 414 : item.guid === "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}" 363 415 ? ["cmd", getAliases[item.guid] ? getAliases[item.guid].alias : ""] 364 - : [ 365 - getAliases[item.guid] ? getAliases[item.guid].alias : "" 366 - ] 416 + : [getAliases[item.guid] ? getAliases[item.guid].alias : ""] 367 417 } 368 418 accessories={getAliases[item.guid] ? [{ tag: { value: getAliases[item.guid].alias } }] : undefined} 369 - actions={ 370 - <Actions profile={item} alias={getAliases[item.guid] ? getAliases[item.guid].alias : ""} /> 371 - } 419 + actions={<Actions profile={item} alias={getAliases[item.guid] ? getAliases[item.guid].alias : ""} />} 372 420 /> 373 421 ))} 374 422 </List.Section> ··· 385 433 title={item.name} 386 434 keywords={[getAliases[item.guid] ? getAliases[item.guid].alias : ""]} 387 435 accessories={getAliases[item.guid] ? [{ tag: { value: getAliases[item.guid].alias } }] : undefined} 388 - actions={ 389 - <Actions profile={item} alias={getAliases[item.guid] ? getAliases[item.guid].alias : ""} /> 390 - } 436 + actions={<Actions profile={item} alias={getAliases[item.guid] ? getAliases[item.guid].alias : ""} />} 391 437 /> 392 438 ))} 393 439 </List.Section> ··· 405 451 title={item.name} 406 452 keywords={[getAliases[item.guid] ? getAliases[item.guid].alias : ""]} 407 453 accessories={getAliases[item.guid] ? [{ tag: { value: getAliases[item.guid].alias } }] : undefined} 408 - actions={ 409 - <Actions profile={item} alias={getAliases[item.guid] ? getAliases[item.guid].alias : ""} /> 410 - } 454 + actions={<Actions profile={item} alias={getAliases[item.guid] ? getAliases[item.guid].alias : ""} />} 411 455 /> 412 456 ))} 413 457 </List.Section> ··· 430 474 title={item.name} 431 475 keywords={[getAliases[item.guid] ? getAliases[item.guid].alias : ""]} 432 476 accessories={getAliases[item.guid] ? [{ tag: { value: getAliases[item.guid].alias } }] : undefined} 433 - actions={ 434 - <Actions profile={item} alias={getAliases[item.guid] ? getAliases[item.guid].alias : ""} /> 435 - } 477 + actions={<Actions profile={item} alias={getAliases[item.guid] ? getAliases[item.guid].alias : ""} />} 436 478 /> 437 479 ))} 438 480 </List.Section>