Open
Conversation
Contributor
Overviewsrc/br.ts:Info:src/@magnolia/cli.ts:Info:src/bunx.ts:Info:Single Functions:postProcess: function (out) {
const cli = [...npxSuggestions].reduce(
(acc, { name }) => [...acc, name],
[]
);
return out
.split("\n")
.filter((name) => !cli.includes(name))
.map((name) => ({
name,
icon: "fig://icon?type=command",
loadSpec: name,
}));
}src/build-storybook.ts:Info:src/code-insiders.ts:Info:src/cl.ts:Info:src/blitz.ts:Info:URLs:
src/deno/generators.ts:Info:URLs:
src/argo.ts:Info:src/aws/secretsmanager.ts:Info:Single Functions:postProcess: function (out) {
try {
const list = JSON.parse(out)["SecretList"];
return list.map((item) => ({
name: item["Name"],
}));
} catch (error) {
console.error(error);
}
return [];
}postProcess: function (out) {
try {
const list = JSON.parse(out)["Keys"];
return list.map((item) => ({
name: item["KeyId"],
}));
} catch (error) {
console.error(error);
}
return [];
}postProcess: function (out, tokens) {
try {
const list = JSON.parse(out)["Keys"];
return list.flatMap((secret) => {
return awsRegions.flatMap((region) => {
return {
name: `Region=${region},KmsKeyId=${secret.KeyId}`,
};
});
});
} catch (e) {
console.log(e);
}
return [];
}postProcess: function (out, tokens) {
try {
const list = JSON.parse(out)["Functions"];
return list.map((item) => ({
name: item["FunctionArn"],
}));
} catch (e) {
console.log(e);
}
return [];
}custom: async function (tokens, executeShellCommand) {
try {
// secret-id value
const idx = tokens.indexOf("--secret-id");
if (idx < 0) {
return [];
}
const secretId = tokens[idx + 1];
const { stdout } = await executeShellCommand({
command: "aws",
args: ["secretsmanager", "describe-secret", "--secret-id", secretId],
});
const versions = JSON.parse(stdout)["VersionIdsToStages"];
return Object.keys(versions).map((elm) => ({ name: elm }));
} catch (e) {
console.log(e);
}
return [];
}custom: async function (tokens, executeShellCommand) {
try {
// secret-id value
const idx = tokens.indexOf("--secret-id");
if (idx < 0) {
return [];
}
const secretId = tokens[idx + 1];
const { stdout } = await executeShellCommand({
command: "aws",
args: ["secretsmanager", "describe-secret", "--secret-id", secretId],
});
const versions = JSON.parse(stdout)["VersionIdsToStages"];
return Object.keys(versions).map((elm) => ({ name: versions[elm][0] }));
} catch (e) {
console.log(e);
}
return [];
}custom: async function (tokens, executeShellCommand) {
try {
// secret-id value
const idx = tokens.indexOf("--secret-id");
if (idx < 0) {
return [];
}
const secretId = tokens[idx + 1];
const { stdout } = await executeShellCommand({
command: "aws",
args: ["secretsmanager", "describe-secret", "--secret-id", secretId],
});
const versions = JSON.parse(stdout)["Tags"];
return versions.map((elm) => ({ name: elm["Key"] }));
} catch (e) {
console.log(e);
}
return [];
}src/bun.ts:Info:src/g++.ts:Info:src/clang++.ts:Info:src/c++.ts:Info:src/aws/cloudformation.ts:Info:Single Functions:postProcess: function (out) {
try {
const accountId = JSON.parse(out)["Account"];
return [{ name: accountId }];
} catch (error) {
console.error(error);
}
return [];
}postProcess: function (out) {
return postPrecessGenerator(out, "TypeSummaries", "TypeArn");
}postProcess: function (out) {
return postPrecessGenerator(out, "Exports", "Name");
}postProcess: function (out, tokens) {
try {
return out.split("\n").map((line) => {
const parts = line.split(/\s+/);
// sub prefix
if (!parts.length) {
return [];
}
return {
name: _prefixS3 + parts[parts.length - 1],
};
}) as Fig.Suggestion[];
} catch (error) {
console.error(error);
}
return [];
}postProcess: function (out) {
return postPrecessGenerator(out, "Keys", "KeyId");
}src/cal.ts:Info:src/aws/s3.ts:Info:Single Functions:postProcess: function (out, context) {
try {
return out.split("\n").map((line) => {
const parts = line.split(/\s+/);
// sub prefix
if (!parts.length) {
return [];
}
return {
name: _prefixS3 + parts[parts.length - 1],
};
}) as Fig.Suggestion[];
} catch (error) {
console.error(error);
}
return [];
}postProcess: function (out) {
try {
const list = JSON.parse(out)["Keys"];
return list.map((item) => ({
name: item["KeyId"],
}));
} catch (error) {
console.error(error);
}
return [];
}URLs:
src/fig/1.0.0.ts:Info:src/goland.ts:Info:src/fly.ts:Info:src/https.ts:Info:src/fig/2.0.0.ts:Info:src/clion.ts:Info:src/n.ts:Info:Single Functions:postProcess: function (out) {
const set = new Set<string>();
const versions = out.split("\n").slice(1);
for (const version of versions) {
set.add(version); // 16.1.2
const split = version.split(".");
set.add(split[0] + "." + split[1]); // 16.1
set.add(split[0]); // 16
}
return Array.from(set).map((version) => {
return {
name: [version, `v${version}`],
description: `Node.js ${version}`,
};
});
}src/iex.ts:Info:src/aws/lambda.ts:Info:Single Functions:custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-layer-versions",
["--layer-name"],
"LayerVersions",
"Version"
);
}postProcess: function (out, tokens) {
try {
const accountId = JSON.parse(out)["Account"];
return [{ name: accountId }, { name: "*" }];
} catch (error) {
console.error(error);
}
return [];
}custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-layer-version-policy",
["--layer-name", "--version-number"],
"RevisionId"
);
}custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-policy",
["--function-name"],
"RevisionId"
);
}custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-function",
["--function-name"],
"Configuration",
"RevisionId"
);
}custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-aliases",
["--function-name"],
"Aliases",
"Name"
);
}custom: async function (tokens, executeShellCommand) {
try {
const idx = tokens.indexOf("--function-name");
const args = [
"lambda",
"list-versions-by-function",
"--function-name",
tokens[idx + 1],
];
const { stdout } = await executeShellCommand({
command: "aws",
args,
});
const list = JSON.parse(stdout)["Versions"];
return list
.filter((elm) => elm.Version !== "$LATEST")
.map((elm) => {
const version = elm["Version"];
return {
insertValue: version,
name: version,
displayName: `version: ${version}`,
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
}custom: async function (tokens, executeShellCommand) {
return listCustomSIDGenerator(tokens, executeShellCommand, "get-policy", [
"--function-name",
]);
}custom: async function (tokens, executeShellCommand) {
return listCustomSIDGenerator(
tokens,
executeShellCommand,
"get-layer-version-policy",
["--layer-name", "--version-number"]
);
}custom: async function (tokens, executeShellCommand) {
// Getting sqs queues is implemented, although it has a huge performance toll.
// It seems Fig rejects long-running promises after a time.
// I am currently investigating if this is the case.
// const result = await Promise.all([
// getResultList(tokens, executeShellCommand, "aws sqs list-queues", "QueueUrls"),
// getResultList(tokens, executeShellCommand, "aws kinesis list-streams", "StreamNames")
// ]);
// const objects = result.flat().map((elm) => {
// if (elm.includes("sqs")) {
// return ({
// command: `aws sqs get-queue-attributes --queue-url ${elm} --attribute-names QueueArn`,
// parentKey: "Attributes",
// childKey: "QueueArn",
// })
// }
// return ({
// command: `aws kinesis describe-stream --stream-name ${elm}`,
// parentKey: "StreamDescription",
// childKey: "StreamARN",
// })
// });
return MultiSuggestionsGenerator(tokens, executeShellCommand, [
{
command: ["dynamodbstreams", "list-streams"],
parentKey: "Streams",
childKey: "StreamArn",
},
{
command: ["kafka", "list-clusters"],
parentKey: "ClusterInfoList",
childKey: "ClusterArn",
},
//...objects,
]);
}custom: async function (tokens, executeShellCommand) {
// Getting sqs queues is implemented, although it has a huge performance toll.
// It seems Fig rejects long-running promises after a time.
// I am currently investigating if this is the case.
// const out = await executeShellCommand("aws sqs list-queues");
// const list = JSON.parse(out)["QueueUrls"];
// const sqsObjects = list.map((url) => ({
// command: `aws sqs get-queue-attributes --queue-url ${url} --attribute-names QueueArn`,
// parentKey: "Attributes",
// childKey: "QueueArn",
// }));
return MultiSuggestionsGenerator(tokens, executeShellCommand, [
{
command: ["sns", "list-topics"],
parentKey: "Topics",
childKey: "TopicArn",
},
{
command: ["events", "list-event-buses"],
parentKey: "EventBuses",
childKey: "Arn",
},
{
command: ["lambda", "list-functions"],
parentKey: "Functions",
childKey: "FunctionArn",
},
// ...sqsObjects,
]);
}postProcess: function (out) {
return postPrecessGenerator(out, "Roles", "RoleName");
}postProcess: function (out) {
return postPrecessGenerator(out, "Keys", "KeyArn");
}postProcess: function (out) {
return postPrecessGenerator(out, "Layers", "LayerArn");
}postProcess: function (out) {
try {
const list = JSON.parse(out)["Layers"];
return list.map((elm) => {
return {
name: elm["LatestMatchingVersion"]["LayerVersionArn"],
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
}postProcess: function (out) {
try {
const list = JSON.parse(out)["FileSystems"];
return list.map((elm) => {
const name = ("FileSystemArn" ? elm["FileSystemArn"] : elm) as string;
return {
name: `Arn=${name},LocalMountPath=/mnt/`,
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
}postProcess: function (out) {
return postPrecessGenerator(
out,
"CodeSigningConfigs",
"CodeSigningConfigArn"
);
}postProcess: function (out) {
return postPrecessGenerator(out, "EventSourceMappings", "UUID");
}postProcess: function (out) {
return postPrecessGenerator(out, "Functions", "CodeSha256");
}postProcess: function (out, tokens) {
try {
return out.split("\n").map((line) => {
const parts = line.split(/\s+/);
// sub prefix
if (!parts.length) {
return [];
}
return {
name: parts[parts.length - 1],
};
}) as Fig.Suggestion[];
} catch (error) {
console.error(error);
}
return [];
}custom: async function (tokens, executeShellCommand) {
try {
const idx = tokens.indexOf("--s3-bucket");
const args = [
"s3",
"ls",
`${_prefixS3}${tokens[idx + 1]}`,
"--recursive",
"--page-size",
"1000",
];
const { stdout } = await executeShellCommand({
command: "aws",
args,
});
if (stdout == "") {
return [];
}
if (stdout.trim() === _prefixS3) {
return [
{
name: _prefixS3,
insertValue: _prefixS3,
},
];
}
return stdout.split("\n").map((line) => {
const parts = line.split(/\s+/);
// sub prefix
if (!parts.length) {
return [];
}
return {
name: parts[parts.length - 1],
};
}) as Fig.Suggestion[];
} catch (error) {
console.error(error);
}
return [];
}custom: async function (tokens, executeShellCommand) {
try {
const bucketIdx = tokens.indexOf("--s3-bucket");
const objectIdx = tokens.indexOf("--s3-key");
const args = [
"s3api",
"list-object-versions",
"--bucket",
tokens[bucketIdx + 1],
"--prefix",
tokens[objectIdx + 1],
];
const { stdout } = await executeShellCommand({
command: "aws",
args,
});
if (stdout == "") {
return [];
}
if (stdout.trim() === _prefixS3) {
return [
{
name: _prefixS3,
insertValue: _prefixS3,
},
];
}
const list = JSON.parse(stdout)["Versions"];
return list
.filter((elm) => elm["VersionId"] !== "null")
.map((elm) => {
return {
name: elm["VersionId"],
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
}URLs:
src/kubecolor.ts:Info:src/hub.ts:Info:src/rustrover.ts:Info:src/pycharm.ts:Info:src/rubymine.ts:Info:src/j.ts:Info:src/pre-commit.ts:Info:src/redwood.ts:Info:URLs:
src/rsync.ts:Info:src/gcc.ts:Info:src/preset.ts:Info:src/scp.ts:Info:src/sam.ts:Info:src/pip3.ts:Info:src/deno.ts:Info:src/sta.ts:Info:src/sls.ts:Info:src/phpstorm.ts:Info:src/nrm.ts:Info:src/rush.ts:Info:Single Functions:postProcess: function (out: string) {
const suggestions = [];
try {
if (!out) {
return suggestions;
}
const rushConfigurationJson: IRushConfigurationJson = JSON.parse(
stripJsonComments(out.trim())
);
for (const project of rushConfigurationJson.projects) {
suggestions.push({
name: project.packageName,
description: "Projects",
});
}
} catch (e: unknown) {
console.log("generate project suggestion fail: ", e);
}
return suggestions;
}src/npx.ts:Info:Single Functions:postProcess: function (out) {
const cli = [...npxSuggestions].reduce(
(acc, { name }) => [...acc, name],
[]
);
return out
.split("\n")
.filter((name) => !cli.includes(name))
.map((name) => ({
name,
icon: "fig://icon?type=command",
loadSpec: name,
}));
}URLs:
src/ts-node.ts:Info:Single Functions:filterTemplateSuggestions: function (paths) {
return paths
.filter((file) => {
return file.name.match(/.*\.json$/g) || file.name.endsWith("/");
})
.map((file) => {
const isJsFile = file.name.match(/.*\.json?$/g);
const isTsConfig = file.name.match(/tsconfig.json$/g);
return {
...file,
priority: isTsConfig ? 100 : isJsFile && 76,
};
});
}src/tsh.ts:Info:src/ubuntu-advantage.ts:Info:src/task.ts:Info:src/tccutil.ts:Info:src/cap.ts:Info:src/webstorm.ts:Info:src/nr.ts:Info:src/st2.ts:Info:src/turbo.ts:Info:URLs:
src/unix2dos.ts:Info:src/mgnl.ts:Info:URLs:
src/ua.ts:Info:src/mosh.ts:Info:src/pipenv.ts:Info:src/vsce.ts:Info:src/tns.ts:Info:src/nativescript.ts:Info:src/ni.ts:Info:src/rushx.ts:Info:src/zig.ts:Info:src/yarn.ts:Info:Single Functions:postProcess: function (out) {
if (out.trim() == "") {
return [];
}
try {
const startIndex = out.indexOf("{");
const endIndex = out.indexOf("}");
let output = out.substring(startIndex, endIndex + 1);
// TODO: fix hacky code
// reason: JSON parse was not working without double quotes
output = output
.replace(/\'/gi, '"')
.replace("lastUpdateCheck", '"lastUpdateCheck"')
.replace("registry", '"lastUpdateCheck"');
const configObject = JSON.parse(output);
if (configObject) {
return Object.keys(configObject).map((key) => ({ name: key }));
}
} catch (e) {}
return [];
}postProcess: function (out, context = []) {
if (out.trim() === "") {
return [];
}
try {
const packageContent = JSON.parse(out);
const dependencies = packageContent["dependencies"] ?? {};
const devDependencies = packageContent["devDependencies"];
const optionalDependencies = packageContent["optionalDependencies"] ?? {};
Object.assign(dependencies, devDependencies, optionalDependencies);
return Object.keys(dependencies)
.filter((pkgName) => {
const isListed = context.some((current) => current === pkgName);
return !isListed;
})
.map((pkgName) => ({
name: pkgName,
icon: "📦",
description: dependencies[pkgName]
? "dependency"
: optionalDependencies[pkgName]
? "optionalDependency"
: "devDependency",
}));
} catch (e) {
console.error(e);
return [];
}
}script: function (context) {
if (context[context.length - 1] === "") return undefined;
const searchTerm = "create-" + context[context.length - 1];
return [
"curl",
"-s",
"-H",
"Accept: application/json",
`https://api.npms.io/v2/search?q=${searchTerm}&size=20`,
];
}postProcess: function (out) {
try {
return JSON.parse(out).results.map(
(item) =>
({
name: item.package.name.substring(7),
description: item.package.description,
}) as Fig.Suggestion
) as Fig.Suggestion[];
} catch (e) {
return [];
}
}postProcess: function (out: string) {
if (out.trim() == "") {
return [];
}
try {
const packageContent = JSON.parse(out);
const scripts = packageContent["scripts"];
if (scripts) {
return Object.keys(scripts).map((script) => ({
name: script,
}));
}
} catch (e) {}
return [];
}URLs:
src/pnpm.ts:Info:Single Functions:postProcess: function (out) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((elm) => {
let name = elm.trim();
const parts = elm.match(/\S+/g);
if (parts.length > 1) {
if (parts[0] == "*") {
// Current branch.
return {
name: elm.replace("*", "").trim(),
description: "Current branch",
icon: "⭐️",
};
} else if (parts[0] == "+") {
// Branch checked out in another worktree.
name = elm.replace("+", "").trim();
}
}
return {
name,
description: "Branch",
icon: "fig://icon?type=git",
};
});
}postProcess: function (out) {
/**
* out
* @example
* ```
* Legend: production dependency, optional only, dev only
*
* /xxxx/xxxx/<package-name> (PRIVATE)
*
* dependencies:
* lodash 4.17.21
* foo link:packages/foo
*
* devDependencies:
* typescript 4.7.4
* ```
*/
if (out.includes("ERR_PNPM")) {
return [];
}
const output = out
.split("\n")
.slice(3)
// remove empty lines, "*dependencies:" lines, local workspace packages (eg: "foo":"workspace:*")
.filter(
(item) =>
!!item &&
!item.toLowerCase().includes("dependencies") &&
!item.includes("link:")
)
.map((item) => item.replace(/\s/, "@")); // typescript 4.7.4 -> typescript@4.7.4
return output.map((pkg) => {
return {
name: pkg,
icon: "fig://icon?type=package",
};
});
}src/sftp.ts:Info:src/heroku/8.6.0.ts:Info:URLs:
src/heroku/8.0.0.ts:Info:URLs:
|
Contributor
|
Hello @grant0417,
Please add a 👍 as a reaction to this comment to show that you read this. |
13eb3bb to
04b4a43
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.