-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update types 2 #2162
Update types 2 #2162
Conversation
Overviewsrc/bat.ts:Info:Single Functions:postProcess: function (out) {
// unpack 2-dimension array
return out
.split("\n")
.map((outLine) => {
const langLine = outLine.split(":");
const descriptionString = langLine[0].trim();
return outLine
.replace(/\:/g, ",")
.split(",")
.map((item) => {
return {
name: item.trim(),
description: descriptionString + " language",
};
});
})
.flat(2);
} postProcess: function (out) {
return out
.trim()
.split("]")[0]
.split("[")[1]
.split(":")[1]
.split(",")
.map((mode) => {
return {
name: mode.trim(),
description: "Specify when to use colored output",
};
});
} postProcess: function (out) {
return out
.trim()
.split("]")[0]
.split("[")[1]
.split(":")[1]
.split(",")
.map((mode) => {
return {
name: mode.trim(),
description: "Specify when to use colored output",
};
});
} postProcess: function (out) {
return out
.trim()
.split("]")[0]
.split("[")[1]
.split(":")[1]
.split(",")
.map((mode) => {
return {
name: mode.trim(),
description:
"Specify when to use ANSI sequences for italic text in the output",
};
});
} postProcess: function (out) {
return out
.trim()
.split("]")[0]
.split("[")[1]
.split(":")[1]
.split(",")
.map((mode) => {
return {
name: mode.trim(),
description:
"Specify when to use the decorations that have been specified via '--style'",
};
});
} postProcess: function (out) {
return out
.trim()
.split("]")[0]
.split("[")[1]
.split(":")[1]
.split(",")
.map((mode) => {
return {
name: mode.trim(),
description: "Specify when to use the pager",
};
});
} postProcess: function (out) {
return out.split("\n").map((theme) => {
return { name: theme, description: "theme: " + theme };
});
} 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/black.ts:Info:src/chown.ts:Info:Single Functions:custom: async function (tokens, executeShellCommand) {
const colonAdded = tokens.find((token) => token.includes(":"));
const nFlagUsed = tokens.find((token) => /^-.*n.*/.test(token));
let shell: string;
// Using `:` as a trigger, check to see if a colon is added
// in the current command. If it is, get the system groups
// else retrieve the list of system users
if (colonAdded) {
const { stdout } = await executeShellCommand({
command: "bash",
args: [
"-c",
"dscl . -list /Groups PrimaryGroupID | tr -s ' '| sort -r",
],
});
shell = stdout;
} else {
const { stdout } = await executeShellCommand({
command: "bash",
args: ["-c", "dscl . -list /Users UniqueID | tr -s ' '| sort -r"],
});
shell = stdout;
}
return (
shell
.split("\n")
// The shell command retrieves a table
// with rows that look like `user uid`
// so each row is split again to get the
// user/group and uid/gid
.map((line) => line.split(" "))
.map((value) => {
return {
// If the user has entered the option n
// suggest the uid/gid instead of user/group
name: nFlagUsed ? value[1] : value[0],
description: colonAdded
? `Group - ${nFlagUsed ? value[0] : `gid: ${value[1]}`}`
: `User - ${nFlagUsed ? value[0] : `uid: ${value[1]}`}`,
icon: colonAdded ? "👥" : "👤",
priority: 90,
};
})
);
} src/apt.ts:Info:Single Functions:postProcess: function (a) {
return a
.trim()
.split("\n")
.map((b) => {
return {
name: b.substring(0, b.indexOf("/")),
description: "Package",
icon: "📦",
};
});
} postProcess: function (a) {
return a
.trim()
.split("\n")
.map((b) => {
return {
name: b.substring(0, b.indexOf("/")),
description: "Package",
icon: "📦",
};
});
} src/deployctl.ts:Info:URLs:
src/drush.ts:Info:src/hexo.ts:Info:URLs:
src/killall.ts:Info:src/fisher.ts:Info:src/esbuild.ts:Info:src/browser-sync.ts:Info:src/dotnet/dotnet-run.ts:Info:src/jenv.ts:Info:Single Functions:postProcess: function (out) {
return out
.split("\n")
.filter((line) => line && line.trim() !== "")
.map((command) => ({
name: command,
icon: "fig://icon?type=command",
priority: 51,
}));
} postProcess: function (out) {
return out
.split("\n")
.filter(
(line) => line && line.trim() !== "" && line.trim() !== "--version"
)
.map((command) => ({
name: command,
icon: "fig://icon?type=command",
priority: 51,
}));
} postProcess: function (out) {
return out
.split("\n")
.filter((line) => line && line.trim() !== "" && line.trim())
.map((command) => ({
name: command,
description: "Enable " + command + " plugin",
icon: "fig://icon?type=command",
priority: 51,
}));
} postProcess: function (out) {
return out
.split("\n")
.filter((line) => line && line.trim() !== "" && line.trim())
.map((command) => ({
name: command,
description: "Java Version " + command,
icon: "☕️",
priority: 51,
}));
} src/magento.ts:Info:src/kubens.ts:Info:src/goto.ts:Info:src/ignite-cli.ts:Info:src/login.ts:Info:src/mask.ts:Info:src/passwd.ts:Info:src/coda.ts:Info:URLs:
src/eslint.ts:Info:src/make.ts:Info:src/id.ts:Info:src/kill.ts:Info:src/dscl.ts:Info:src/ant.ts:Info:src/example/trigger.ts:Info:src/python3.ts:Info:src/iconv.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/deno/generators.ts:Info:URLs:
src/pre-commit.ts:Info:src/kubectx.ts:Info:src/shopify/index.ts:Info:src/doppler.ts:Info:URLs:
src/which.ts:Info:src/cordova.ts:Info:Single Functions:postProcess: function (out: string) {
const suggestions = [];
try {
if (out.trim() == "") {
return suggestions;
}
const packageJSON = JSON.parse(out);
const platforms = packageJSON["cordova"]["platforms"];
if (platforms) {
for (const platform of platforms) {
suggestions.push({
name: platform,
description: "Platform",
});
}
}
} catch (error) {
console.log(error);
}
return suggestions;
} src/wifi-password.ts:Info:src/ffmpeg.ts:Info:src/vite.ts:Info:URLs:
src/python.ts:Info:src/tldr.ts:Info:src/mkinitcpio.ts:Info:src/rails.ts:Info:URLs:
src/node.ts:Info:src/tsh.ts:Info:src/trex.ts:Info:Single Functions:postProcess: function (out) {
if (out) {
try {
const deps = JSON.parse(out);
if (deps.imports) {
const imports = Object.entries(deps.imports);
const suggestions = imports.map(([name, url]) => ({
name: name as string,
icon: "🦖",
description: url as string,
}));
return suggestions;
}
} catch (error) {
return [];
}
}
return [];
} postProcess: function (out) {
if (out) {
try {
const scriptsObj = JSON.parse(out);
if (scriptsObj.scripts) {
const scripts = Object.entries(scriptsObj.scripts);
const suggestions = scripts.map(([name, command]) => ({
name: name as string,
icon: "🚀",
description: "trex script" as string,
}));
return suggestions;
}
} catch (error) {
return [];
}
}
return [];
} URLs:
src/cf.ts:Info:URLs:
src/hugo.ts:Info:URLs:
src/fin.ts:Info:URLs:
src/docker-compose.ts:Info:src/z.ts:Info:src/conda.ts:Info:Single Functions:postProcess: function (out) {
const lines = out.split("\n");
const installedPackages = [];
for (let i = 2; i < lines.length; i++) {
installedPackages.push({
name: lines[i],
icon: "🐍",
});
}
return installedPackages;
} postProcess: function (out) {
const lines = out.split("\n");
const installedPackages: Fig.Suggestion[] = [];
for (let i = 2; i < lines.length; i++) {
var env_name = lines[i].split(" ")[0];
installedPackages.push({
name: env_name,
icon: "🐍",
});
}
return installedPackages;
} postProcess: function (out) {
const lines = out.split("\n");
const configs: Fig.Suggestion[] = [];
for (let i = 2; i < lines.length; i++) {
var config_name = lines[i].split(":")[0];
if (config_name.includes("-") == false) {
configs.push({
name: config_name,
icon: "🐍",
});
}
}
return configs;
} URLs:
src/fig/shared.ts:Info:src/yalc.ts:Info:src/scarb.ts:Info:Single Functions:postProcess: function (out) {
const jsonOut = JSON.parse(out);
const members = jsonOut.workspace.members;
return members.map((member: string) => member.split(" ")[0]);
} postProcess: function (out) {
const jsonOut = JSON.parse(out);
const members = jsonOut.workspace.members;
return members.map((member: string) => member.split(" ")[0]);
} postProcess: function (out) {
const jsonOut = JSON.parse(out);
const members = jsonOut.workspace.members;
return members.map((member: string) => member.split(" ")[0]);
} postProcess: function (out) {
const jsonOut = JSON.parse(out);
const members = jsonOut.workspace.members;
return members.map((member: string) => member.split(" ")[0]);
} postProcess: function (out) {
const jsonOut = JSON.parse(out);
const members = jsonOut.workspace.members;
return members.map((member: string) => member.split(" ")[0]);
} postProcess: function (out) {
const jsonOut = JSON.parse(out);
const members = jsonOut.workspace.members;
return members.map((member: string) => member.split(" ")[0]);
} src/dotnet/dotnet-tool.ts:Info:URLs:
src/firebase.ts:Info:src/multipass.ts:Info:src/nx.ts:Info:src/nextflow.ts:Info:src/rugby.ts:Info:URLs:
src/robot.ts:Info:src/brew.ts:Info:Single Functions:postProcess: function (out) {
return out
.split("\n")
.filter((line) => !line.includes("unbound"))
.map((line) => ({
name: line,
icon: "fig://icon?type=package",
description: `${action} ${line}`,
}));
} postProcess: function (out) {
return out
.split("\n")
.filter((line) => !line.includes("="))
.map((formula) => ({
name: formula,
icon: "🍺",
description: "Installed formula",
}));
} postProcess: function (out) {
return out.split("\n").map((formula) => ({
name: formula,
icon: "🍺",
description: "Outdated formula",
}));
} postProcess: function (out) {
return out.split("\n").map((formula) => ({
name: formula,
icon: "🍺",
description: "Formula",
priority: 51,
}));
} postProcess: function (out) {
return out.split("\n").map((cask) => ({
name: cask,
icon: "🍺",
description: "Cask",
priority: 52,
}));
} postProcess: function (out) {
return out
.split("\n")
.filter((line) => line && line.trim() !== "")
.map((line) => ({
name: line,
icon: "fig://icon?type=command",
description: `Execute alias ${line}`,
}));
} postProcess: function (out) {
return out.split("\n").map((formula) => {
return {
name: formula,
icon: "🍺",
description: "Installed formula",
};
});
} src/rustup.ts:Info: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 -> [email protected]
return output.map((pkg) => {
return {
name: pkg,
icon: "fig://icon?type=package",
};
});
} src/react-native.ts:Info:URLs:
src/youtube-dl.ts:Info:Single Functions:postProcess: function (out) {
try {
return JSON.parse(out)["entries"].map((video, index) => {
return {
name: `${index + 1} - ${video.title}`,
description: video.uploader,
insertValue: `${index + 1}`,
icon: "https://www.youtube.com/s/desktop/810941b4/img/favicon_32.png",
};
});
} catch (e) {
console.error(e);
return [];
}
} postProcess: function (out) {
const regex = new RegExp(
"^(https?://)?(www.)?(youtube.com|youtu.?be)/.+$"
);
try {
if (regex.test(out))
return [
{
name: out,
description: "Clipboard",
icon: "https://www.youtube.com/s/desktop/810941b4/img/favicon_32.png",
},
];
} catch (e) {
console.error(e);
return [];
}
} URLs:
src/m.ts:Info:src/tmux.ts:Info:src/npm.ts:Info:Single Functions:custom: async function (tokens, executeShellCommand) {
if (!tokens.includes("-g") && !tokens.includes("--global")) {
const { stdout: npmPrefix } = await executeShellCommand({
command: "npm",
// eslint-disable-next-line @withfig/fig-linter/no-useless-arrays
args: ["prefix"],
});
const { stdout: out } = await executeShellCommand({
command: "cat",
// eslint-disable-next-line @withfig/fig-linter/no-useless-arrays
args: [`${npmPrefix}/package.json`],
});
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 = tokens.some((current) => current === pkgName);
return !isListed;
})
.map((pkgName) => ({
name: pkgName,
icon: "📦",
description: dependencies[pkgName]
? "dependency"
: optionalDependencies[pkgName]
? "optionalDependency"
: "devDependency",
}));
} else {
const { stdout } = await executeShellCommand({
command: "bash",
args: ["-c", "ls -1 `npm root -g`"],
});
return stdout.split("\n").map((name) => ({
name,
icon: "📦",
description: "Global dependency",
}));
}
} postProcess: function (out, [npmClient]) {
if (out.trim() == "") {
return [];
}
try {
const packageContent = JSON.parse(out);
const scripts = packageContent["scripts"];
const figCompletions = packageContent["fig"] || {};
if (scripts) {
return Object.entries(scripts).map(([scriptName, scriptContents]) => {
const icon =
npmClient === "yarn"
? "fig://icon?type=yarn"
: "fig://icon?type=npm";
const customScripts: Fig.Suggestion = figCompletions[scriptName];
return {
name: scriptName,
icon,
description: scriptContents as string,
priority: 51,
/**
* If there are custom definitions for the scripts
* we want to override the default values
* */
...customScripts,
};
});
}
} catch (e) {
console.error(e);
}
return [];
} URLs:
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/ykman.ts:Info:Single Functions:postProcess: function (out) {
return out.split("\n").map((serial) => {
return { name: serial, description: "Yubikey serial" };
});
} postProcess: function (out) {
return out.split("\n").map((readerName) => {
return { name: readerName, description: "Yubikey name" };
});
} src/copilot.ts:Info:src/expo-cli.ts:Info:URLs:
src/aws/eks.ts:Info:Single Functions:postProcess: function (out) {
try {
const list = JSON.parse(out)["Keys"];
return list.map((key) => {
return {
name: `resources=secrets,provider={keyArn=${key["KeyArn"]}}`,
icon: "fig://icon?type=aws",
};
});
} catch (e) {
console.log(e);
}
return [];
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-addons",
["--cluster-name"],
"addons"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-fargate-profiles",
["--cluster-name"],
"fargateProfileNames"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-nodegroups",
["--cluster-name"],
"nodegroups"
);
} src/stepzen.ts:Info:URLs:
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/aws/cloudwatch.ts:Info:Single Functions:custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-metrics",
["--namespace"],
"Metrics",
"MetricName"
);
} custom: async function (tokens, executeShellCommand) {
return listDimensionTypes(
tokens,
executeShellCommand,
"list-metrics",
"--namespace",
"Metrics",
"Dimensions"
);
} custom: async function (tokens, executeShellCommand) {
return listDimensionTypes(
tokens,
executeShellCommand,
"describe-anomaly-detectors",
"--namespace",
"AnomalyDetectors",
"Dimensions"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"describe-anomaly-detectors",
["--namespace", "--metric-name"],
"AnomalyDetectors",
"Stat"
);
} custom: async function (tokens, executeShellCommand) {
// get list of stream names
const result = await getResultList(
tokens,
executeShellCommand,
["firehose", "list-delivery-streams"],
"DeliveryStreamNames"
);
// construct "query"
const objects = result.flat().map((stream) => {
return {
command: [
"firehose",
"describe-delivery-stream",
"--delivery-stream-name",
Array.isArray(stream.name) ? stream.name[0] : stream.name,
],
parentKey: "DeliveryStreamDescription",
childKey: "DeliveryStreamARN",
};
});
// Fire up multiple API calls
return MultiSuggestionsGenerator(tokens, executeShellCommand, [
...objects,
]);
} src/cargo.ts:Info:URLs:
src/aws/iam.ts:Info:Single Functions:postProcess: function (out, tokens) {
try {
const accountId = JSON.parse(out)["Account"];
return [{ name: `arn:aws:iam::${accountId}-ID:root` }];
} catch (error) {
console.error(error);
}
return [];
} postProcess: function (out) {
return postPrecessGenerator(out, "OpenIDConnectProviderList", "Arn");
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-open-id-connect-provider",
"--open-id-connect-provider-arn",
"ClientIDList"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-open-id-connect-provider",
"--open-id-connect-provider-arn",
"ThumbprintList"
);
} postProcess: function (out) {
return postPrecessGenerator(
out,
"InstanceProfiles",
"InstanceProfileName"
);
} custom: async function (tokens, executeShellCommand) {
try {
const idx = tokens.indexOf("--instance-profile-name");
if (idx < 0) {
return [];
}
const param = tokens[idx + 1];
const { stdout } = await executeShellCommand({
command: "aws",
args: [
"iam",
"get-instance-profile",
"--instance-profile-name",
param,
],
});
const policies = JSON.parse(stdout)["InstanceProfile"];
return policies["Roles"].map((elm) => {
return {
name: elm["RoleName"],
};
});
} catch (e) {
console.log(e);
}
return [];
} postProcess: function (out) {
return postPrecessGenerator(out, "Users", "UserName");
} postProcess: function (out) {
return postPrecessGenerator(out, "Users", "Arn");
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-user-policies",
"--user-name",
"PolicyNames"
);
} postProcess: function (out) {
return postPrecessGenerator(out, "Groups", "GroupName");
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"get-group",
"--group-name",
"Users",
"UserName"
);
} postProcess: function (out) {
return postPrecessGenerator(out, "Policies", "Arn");
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-policy-versions",
"--policy-arn",
"Versions",
"VersionId"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-group-policies",
"--group-name",
"PolicyNames"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-attached-group-policies",
"--group-name",
"AttachedPolicies",
"PolicyArn"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-attached-group-policies",
"--group-name",
"AttachedPolicies",
"PolicyName"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-attached-role-policies",
"--role-name",
"AttachedPolicies",
"PolicyArn"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-attached-user-policies",
"--user-name",
"AttachedPolicies",
"PolicyArn"
);
} postProcess: function (out) {
return postPrecessGenerator(out, "Roles", "RoleName");
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-role-policies",
"--role-name",
"PolicyNames"
);
} postProcess: function (out) {
return postPrecessGenerator(out, "MFADevices", "SerialNumber");
} postProcess: function (out) {
return postPrecessGenerator(out, "VirtualMFADevices", "SerialNumber");
} postProcess: function (out) {
return postPrecessGenerator(out, "AccessKeyMetadata", "AccessKeyId");
} postProcess: function (out) {
return postPrecessGenerator(out, "AccountAliases");
} postProcess: function (out) {
return postPrecessGenerator(out, "SAMLProviderList", "Arn");
} postProcess: function (out) {
return postPrecessGenerator(out, "SSHPublicKeys", "SSHPublicKeyId");
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-ssh-public-keys",
"--user-name",
"SSHPublicKeys",
"SSHPublicKeyId"
);
} postProcess: function (out) {
return postPrecessGenerator(
out,
"ServerCertificateMetadataList",
"ServerCertificateName"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-service-specific-credentials",
"--user-name",
"ServiceSpecificCredentials",
"ServiceSpecificCredentialId"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-signing-certificates",
"--user-name",
"Certificates",
"CertificateId"
);
} custom: async function (tokens, executeShellCommand) {
return MultiSuggestionsGenerator(tokens, executeShellCommand, [
...identityStruct,
{
command: ["iam", "list-policies", "--scope", "Local"],
parentKey: "Policies",
childKey: "Arn",
},
]);
} custom: async function (tokens, executeShellCommand) {
return MultiSuggestionsGenerator(
tokens,
executeShellCommand,
identityStruct
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-instance-profile-tags",
"--instance-profile-name",
"Tags",
"Key"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-mfa-device-tags",
"--serial-number",
"Tags",
"Key"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-open-id-connect-provider-tags",
"--open-id-connect-provider-arn",
"Tags",
"Key"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-policy-tags",
"--policy-arn",
"Tags",
"Key"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-role-tags",
"--role-name",
"Tags",
"Key"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-saml-provider-tags",
"--saml-provider-arn",
"Tags",
"Key"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-server-certificate-tags",
"--server-certificate-name",
"Tags",
"Key"
);
} custom: async function (tokens, executeShellCommand) {
return listCustomGenerator(
tokens,
executeShellCommand,
"list-user-tags",
"--user-name",
"Tags",
"Key"
);
} URLs:
src/git.ts:Info:Single Functions:postProcess: function (out) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((line) => {
return {
name: line.substring(0, 7),
icon: "fig://icon?type=node",
description: line.substring(7),
};
});
} postProcess: function (out) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((line) => {
return {
name: line.substring(0, 7),
icon: "fig://icon?type=node",
description: line.substring(7),
};
});
} postProcess: function (out) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((file) => {
return {
// account for conventional commit messages
name: file.split(":").slice(2).join(":"),
insertValue: file.split(":")[0],
icon: `fig://icon?type=node`,
};
});
} postProcess: function (out, tokens) {
const output = filterMessages(out);
if (output.startsWith("fatal:")) {
return [];
}
return output.split("\n").map((file) => {
return {
name: file,
insertValue: (!tokens.includes("--") ? "-- " : "") + file,
icon: `fig://icon?type=file`,
description: "Staged file",
};
});
} postProcess: function (out) {
const remoteURLs = out.split("\n").reduce((dict, line) => {
const pair = line.split("\t");
const remote = pair[0];
const url = pair[1].split(" ")[0];
dict[remote] = url;
return dict;
}, {});
return Object.keys(remoteURLs).map((remote) => {
const url = remoteURLs[remote];
let icon = "box";
if (url.includes("github.com")) {
icon = "github";
}
if (url.includes("gitlab.com")) {
icon = "gitlab";
}
if (url.includes("heroku.com")) {
icon = "heroku";
}
return {
name: remote,
icon: `fig://icon?type=${icon}`,
description: "Remote",
};
});
} postProcess: function (output) {
return output.split("\n").map((tag) => ({
name: tag,
icon: "🏷️",
}));
} script: function (context) {
if (context.includes("--staged") || context.includes("--cached")) {
return [
"bash",
"-c",
`git --no-optional-locks status --short | sed -ne '/^M /p' -e '/A /p'`,
];
} else {
return [
"bash",
"-c",
`git --no-optional-locks status --short | sed -ne '/M /p' -e '/A /p'`,
];
}
} URLs:
|
Hello @grant0417,
Please add a 👍 as a reaction to this comment to show that you read this. |
No description provided.