-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[GIT] feat: prioritise suggestions based on if they are already an argument #208
Conversation
Overviewdev/git.ts:Info:Script: function (out) {
if (out.startsWith("fatal:")) {
return [];
}
return out.split("\n").map((line) => {
return {
name: line.substring(0, 7),
icon: "fig://icon?type=node",
description: line.substring(7),
};
});
} Script: function (out) {
if (out.startsWith("fatal:")) {
return [];
}
return out.split("\n").map((file) => {
return {
name: file.split(":")[2],
insertValue: file.split(":")[0],
icon: `fig://icon?type=node`,
};
});
} Script: function (out) {
if (out.startsWith("fatal:")) {
return [];
}
return out.split("\n").map((file) => {
return {
name: file,
insertValue: "-- " + file,
icon: `fig://icon?type=file`,
description: "staged file",
};
});
} Script: function (out) {
if (out.startsWith("fatal:")) {
return [];
}
return out.split("\n").map((elm) => {
// current branch
if (elm.includes("*")) {
return {
name: elm.replace("*", "").trim(),
description: "current branch",
icon: "⭐️",
// priority: 100,
};
}
return {
name: elm.trim(),
description: "branch",
icon: "fig://icon?type=git",
};
});
} Script: function (out) {
const remoteURLs = out.split("\n").reduce((dict, line) => {
const pair = line.split("\t");
const remote = pair[0];
console.log(remote, pair);
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",
};
});
} Single Scripts:
|
Hello @cstrnt,
Please add a 👍 as a reaction to this comment to show that you read this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So long as you change it back to script and postprocess, this seems good. Please test it yourself though!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and working fine on mac too, cool addition!
Good stuff! |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature
What is the current behavior? (You can also link to an open issue here)
See #81
What is the new behavior (if this is a feature change)?
Files which are already added with
git add
will have lower priorityAdditional info: