mirror of
https://github.com/withfig/autocomplete.git
synced 2025-12-13 20:36:48 +01:00
changed withfig.com to fig.io
This commit is contained in:
8
.github/ISSUE_TEMPLATE/bug.md
vendored
8
.github/ISSUE_TEMPLATE/bug.md
vendored
@@ -8,7 +8,7 @@ labels: "Bug"
|
||||
Please fill out each section below, otherwise, your issue will be closed. This info allows Fig maintainers to diagnose (and fix!) your issue as quickly as possible.
|
||||
|
||||
Useful Links:
|
||||
- Documentation: https://withfig.com/docs/autocomplete/getting-started
|
||||
- Documentation: https://fig.io/docs/autocomplete/getting-started
|
||||
|
||||
Before opening a new issue, please search existing issues: https://github.com/withfig/autocomplete/issues
|
||||
-->
|
||||
@@ -35,11 +35,11 @@ What happened.
|
||||
|
||||
### System Information
|
||||
|
||||
*Fig Version:*
|
||||
_Fig Version:_
|
||||
|
||||
*OS:*
|
||||
_OS:_
|
||||
|
||||
*Device:*
|
||||
_Device:_
|
||||
|
||||
### Potential Solution
|
||||
|
||||
|
||||
16
.github/ISSUE_TEMPLATE/config.yml
vendored
16
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,19 +1,15 @@
|
||||
---
|
||||
---
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
-
|
||||
about: "Create a new issue in the withfig/fig repo to be directed to the right place"
|
||||
contact_links:
|
||||
- about: "Create a new issue in the withfig/fig repo to be directed to the right place"
|
||||
name: Not an autocomplete issue?
|
||||
url: "https://github.com/withfig/fig/issues/new/choose"
|
||||
-
|
||||
about: "Fig's support knowledge base"
|
||||
- about: "Fig's support knowledge base"
|
||||
name: "💬 Forum"
|
||||
url: "https://forum.withfig.com"
|
||||
-
|
||||
about: "Get instant support from the Fig Community Slack"
|
||||
- about: "Get instant support from the Fig Community Slack"
|
||||
name: "👋 Slack"
|
||||
url: "https://waitlist.withfig.com/waitlist"
|
||||
-
|
||||
about: "Get support from the Fig team at hello@withfig.com"
|
||||
- about: "Get support from the Fig team at hello@fig.io"
|
||||
name: "📩 Email"
|
||||
url: "https://tinyurl.com/y4m9zqlw"
|
||||
|
||||
2
.github/workflows/update-docs.yml
vendored
2
.github/workflows/update-docs.yml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
|
||||
curl https://docs-generator.cstrnt.workers.dev/ > autocomplete/api.md
|
||||
|
||||
git config user.email "hello@withfig.com"
|
||||
git config user.email "hello@fig.io"
|
||||
git config user.name "Figbot"
|
||||
|
||||
git add autocomplete/api.md
|
||||
|
||||
@@ -32,7 +32,7 @@ This Code of Conduct applies within all project spaces, and it also applies when
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@withfig.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@fig.io. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ We want to make contributing to Fig as easy and transparent as possible, whether
|
||||
- Submitting feature requests
|
||||
|
||||
- Contributing content or feature changes
|
||||
|
||||
|
||||
## Our repos
|
||||
|
||||
@@ -19,18 +18,19 @@ Here are some of our primary repos.
|
||||
|
||||
[withfig/fig](https://github.com/withfig/fig): The central repo. All issues taken here.
|
||||
|
||||
[withfig/autocomplete](https://github.com/withfig/autocomplete): Collection of all specs for [autocomplete](https://docs.withfig.com/autocomplete). Contribute new specs and update old specs here.
|
||||
[withfig/autocomplete](https://github.com/withfig/autocomplete): Collection of all specs for [autocomplete](https://fig.io/docs/autocomplete). Contribute new specs and update old specs here.
|
||||
|
||||
[withfig/config](https://github.com/withfig/config): Fig's default configuration at install. Contains apps, installation, and update scripts.
|
||||
|
||||
## Contributing your own spec
|
||||
|
||||
The [autocomplete docs](https://docs.withfig.com/autocomplete) should get you up to speed on how to write a spec and serve as a good reference.
|
||||
The [autocomplete docs](https://fig.io/docs/autocomplete) should get you up to speed on how to write a spec and serve as a good reference.
|
||||
|
||||
A few things to keep in mind when writing your spec:
|
||||
|
||||
- Ensure that the argument field is filled for subcommands and options when an argument is required.
|
||||
- Make sure all generators are written with valid JavaScript.
|
||||
- [Test your spec](https://docs.withfig.com/autocomplete#testing-your-completion-spec) before submitting a pull request.
|
||||
- [Test your spec](https://fig.io/docs/autocomplete#testing-your-completion-spec) before submitting a pull request.
|
||||
|
||||
**Git Commit Messages**
|
||||
|
||||
@@ -39,19 +39,16 @@ A few things to keep in mind when writing your spec:
|
||||
- Limit the first line to 72 characters or less
|
||||
- Reference issues and pull requests liberally after the first line
|
||||
|
||||
|
||||
## Bug reports and feature requests
|
||||
|
||||
We use GitHub issues to track public bugs as well as new feature requests. If you have any input, [open a new issue](https://github.com/withfig/fig)! Note that all issues should be filed under the [withfig/fig](https://github.com/withfig/fig) repo, not under independent feature repos.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
By contributing, you agree that your contributions will be licensed under its MIT License.
|
||||
|
||||
|
||||
## Questions and support
|
||||
|
||||
For product support, visit our [docs](https://withfig.com/docs) and join the [Fig Community](https://figcommunity.slack.com/join/shared_invite/zt-fupa9n8g-sfHm8MyBn1DBaCj8SoIxSA#/) for instant support and discussion.
|
||||
For product support, visit our [docs](https://fig.io/docs) and join the [Fig Community](https://figcommunity.slack.com/join/shared_invite/zt-fupa9n8g-sfHm8MyBn1DBaCj8SoIxSA#/) for instant support and discussion.
|
||||
|
||||
Any unanswered questions or inquiries? We're always open to chat at hello@withfig.com.
|
||||
Any unanswered questions or inquiries? We're always open to chat at hello@fig.io.
|
||||
|
||||
@@ -15,7 +15,7 @@ schedule(async () => {
|
||||
const inviteMarkdown = `
|
||||
@${username} Hey! Thanks so much for your contribution!
|
||||
|
||||
As a token of our appreciation, we've invited you to join the Fig GitHub organization. Accepting means you can display Fig's logo on your Github profile's list of member orgs. We also have a special #contributors channel in our [community Slack](https://withfig.com/community) and we'd love for you to join.
|
||||
As a token of our appreciation, we've invited you to join the Fig GitHub organization. Accepting means you can display Fig's logo on your Github profile's list of member orgs. We also have a special #contributors channel in our [community Slack](https://fig.io/community) and we'd love for you to join.
|
||||
|
||||
Excited to have you in the community!
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// To learn more about FIg's autocomplete standard visit: https://withfig.com/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// To learn more about FIg's autocomplete standard visit: https://fig.io/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// var executeShellCommand: Fig.ExecuteShellCommandFunction;
|
||||
|
||||
// The below is a dummy example for git. Make sure to change the file name!
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// To learn more about Fig's autocomplete standard visit: https://withfig.com/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// To learn more about Fig's autocomplete standard visit: https://fig.io/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
|
||||
// The below is a dummy example for git. Make sure to change the file name!
|
||||
export const completion: Fig.Spec = {
|
||||
|
||||
8
schemas/fig.d.ts
vendored
8
schemas/fig.d.ts
vendored
@@ -69,7 +69,7 @@ declare namespace Fig {
|
||||
/**
|
||||
* The icon that is rendered is based on the type, unless overwritten. Icon
|
||||
* can be a 1 character string, a URL, or Fig's icon protocol (fig://) which lets you generate
|
||||
* colorful and fun systems icons: https://withfig.com/docs/autocomplete/reference/icon-api
|
||||
* colorful and fun systems icons: https://fig.io/docs/autocomplete/reference/icon-api
|
||||
*
|
||||
* @example
|
||||
* `A`, `😊`
|
||||
@@ -174,7 +174,7 @@ declare namespace Fig {
|
||||
*
|
||||
* If your CLI tool takes another CLI command (e.g. time , builtin... ) or a script
|
||||
* (e.g. python, node) and you would like Fig to continue to provide completions for this
|
||||
* script, see `isCommand` and `isScript` in {@link {https://withfig.com/docs/autocomplete/api#arg-object | Arg}.
|
||||
* script, see `isCommand` and `isScript` in {@link {https://fig.io/docs/autocomplete/api#arg-object | Arg}.
|
||||
*/
|
||||
loadSpec?: string;
|
||||
/**
|
||||
@@ -342,7 +342,7 @@ declare namespace Fig {
|
||||
*
|
||||
* @example
|
||||
* `python` take one argument which is a `.py` file. If I have a `main.py` file on my desktop and my current working directory is my desktop, if I type `python main.py` Fig will look for a completion spec in `~/Desktop/.fig/main.py.js`
|
||||
* See our docs for more on this {@link https://withfig.com/docs/autocomplete/autocomplete-for-teams | Fig for Teams}
|
||||
* See our docs for more on this {@link https://fig.io/docs/autocomplete/autocomplete-for-teams | Fig for Teams}
|
||||
*/
|
||||
isScript?: boolean;
|
||||
|
||||
@@ -363,7 +363,7 @@ declare namespace Fig {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://withfig.com/docs/autocomplete/api#generator-object
|
||||
* @see https://fig.io/docs/autocomplete/api#generator-object
|
||||
*/
|
||||
export interface Generator {
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ else
|
||||
## Using quotes around EOF will remove expansions
|
||||
# https://superuser.com/questions/1436906/need-to-expand-a-variable-in-a-heredoc-that-is-in-quotes
|
||||
cat <<EOF >> "$(pwd)/dev/$USER_INPUT_CLI_TOOL.ts"
|
||||
// To learn more about Fig's autocomplete standard visit: https://withfig.com/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// To learn more about Fig's autocomplete standard visit: https://fig.io/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
|
||||
// The below is a dummy example for git. Make sure to change the file name!
|
||||
export const completion: Fig.Spec = {
|
||||
@@ -44,7 +44,7 @@ export const completion: Fig.Spec = {
|
||||
description: "Switch branches or restore working tree files",
|
||||
|
||||
// If a subcommand or option takes an argument, you must include the args prop, even if it's an empty object (like below)
|
||||
// If you want to build custom suggestions for arguments check out: https://withfig.com/docs/autocomplete/building-a-spec#making-advanced-suggestions
|
||||
// If you want to build custom suggestions for arguments check out: https://fig.io/docs/autocomplete/building-a-spec#making-advanced-suggestions
|
||||
args: {},
|
||||
options: [
|
||||
{
|
||||
|
||||
@@ -1,31 +1,30 @@
|
||||
// To learn more about Fig's autocomplete standard visit: https://withfig.com/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// To learn more about Fig's autocomplete standard visit: https://fig.io/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// The below is a dummy example for git. Make sure to change the file name!
|
||||
var completionSpec = {
|
||||
name: "trigger",
|
||||
description: "The stupid content tracker",
|
||||
subcommands: [
|
||||
name: "trigger",
|
||||
description: "The stupid content tracker",
|
||||
subcommands: [
|
||||
{
|
||||
name: "checkout",
|
||||
description: "Switch branches or restore working tree files",
|
||||
// If a subcommand or option takes an argument, you must include the args prop, even if it's an empty object (like below)
|
||||
// If you want to build custom suggestions for arguments check out: https://fig.io/docs/autocomplete/building-a-spec#making-advanced-suggestions
|
||||
args: {},
|
||||
options: [
|
||||
{
|
||||
name: "checkout",
|
||||
description: "Switch branches or restore working tree files",
|
||||
// If a subcommand or option takes an argument, you must include the args prop, even if it's an empty object (like below)
|
||||
// If you want to build custom suggestions for arguments check out: https://withfig.com/docs/autocomplete/building-a-spec#making-advanced-suggestions
|
||||
args: {},
|
||||
options: [
|
||||
{
|
||||
name: ["-b"],
|
||||
description: "create and checkout a new branch",
|
||||
args: {
|
||||
name: "branch",
|
||||
},
|
||||
},
|
||||
],
|
||||
name: ["-b"],
|
||||
description: "create and checkout a new branch",
|
||||
args: {
|
||||
name: "branch",
|
||||
},
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: ["-v", "--version"],
|
||||
description: "View your current git version",
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: ["-v", "--version"],
|
||||
description: "View your current git version",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -1,31 +1,30 @@
|
||||
// To learn more about Fig's autocomplete standard visit: https://withfig.com/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// To learn more about Fig's autocomplete standard visit: https://fig.io/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// The below is a dummy example for git. Make sure to change the file name!
|
||||
var completionSpec = {
|
||||
name: "trigger",
|
||||
description: "The stupid content tracker",
|
||||
subcommands: [
|
||||
name: "trigger",
|
||||
description: "The stupid content tracker",
|
||||
subcommands: [
|
||||
{
|
||||
name: "checkout",
|
||||
description: "Switch branches or restore working tree files",
|
||||
// If a subcommand or option takes an argument, you must include the args prop, even if it's an empty object (like below)
|
||||
// If you want to build custom suggestions for arguments check out: https://fig.io/docs/autocomplete/building-a-spec#making-advanced-suggestions
|
||||
args: {},
|
||||
options: [
|
||||
{
|
||||
name: "checkout",
|
||||
description: "Switch branches or restore working tree files",
|
||||
// If a subcommand or option takes an argument, you must include the args prop, even if it's an empty object (like below)
|
||||
// If you want to build custom suggestions for arguments check out: https://withfig.com/docs/autocomplete/building-a-spec#making-advanced-suggestions
|
||||
args: {},
|
||||
options: [
|
||||
{
|
||||
name: ["-b"],
|
||||
description: "create and checkout a new branch",
|
||||
args: {
|
||||
name: "branch",
|
||||
},
|
||||
},
|
||||
],
|
||||
name: ["-b"],
|
||||
description: "create and checkout a new branch",
|
||||
args: {
|
||||
name: "branch",
|
||||
},
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: ["-v", "--version"],
|
||||
description: "View your current git version",
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: ["-v", "--version"],
|
||||
description: "View your current git version",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
249
specs/mask.js
249
specs/mask.js
@@ -1,72 +1,187 @@
|
||||
// To learn more about FIg's autocomplete standard visit: https://withfig.com/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// To learn more about FIg's autocomplete standard visit: https://fig.io/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
// var executeShellCommand: Fig.ExecuteShellCommandFunction;
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
var __awaiter =
|
||||
(this && this.__awaiter) ||
|
||||
function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) {
|
||||
return value instanceof P
|
||||
? value
|
||||
: new P(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
};
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function rejected(value) {
|
||||
try {
|
||||
step(generator["throw"](value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function step(result) {
|
||||
result.done
|
||||
? resolve(result.value)
|
||||
: adopt(result.value).then(fulfilled, rejected);
|
||||
}
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator =
|
||||
(this && this.__generator) ||
|
||||
function (thisArg, body) {
|
||||
var _ = {
|
||||
label: 0,
|
||||
sent: function () {
|
||||
if (t[0] & 1) throw t[1];
|
||||
return t[1];
|
||||
},
|
||||
trys: [],
|
||||
ops: [],
|
||||
},
|
||||
f,
|
||||
y,
|
||||
t,
|
||||
g;
|
||||
return (
|
||||
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
|
||||
typeof Symbol === "function" &&
|
||||
(g[Symbol.iterator] = function () {
|
||||
return this;
|
||||
}),
|
||||
g
|
||||
);
|
||||
function verb(n) {
|
||||
return function (v) {
|
||||
return step([n, v]);
|
||||
};
|
||||
}
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_)
|
||||
try {
|
||||
if (
|
||||
((f = 1),
|
||||
y &&
|
||||
(t =
|
||||
op[0] & 2
|
||||
? y["return"]
|
||||
: op[0]
|
||||
? y["throw"] || ((t = y["return"]) && t.call(y), 0)
|
||||
: y.next) &&
|
||||
!(t = t.call(y, op[1])).done)
|
||||
)
|
||||
return t;
|
||||
if (((y = 0), t)) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
t = op;
|
||||
break;
|
||||
case 4:
|
||||
_.label++;
|
||||
return { value: op[1], done: false };
|
||||
case 5:
|
||||
_.label++;
|
||||
y = op[1];
|
||||
op = [0];
|
||||
continue;
|
||||
case 7:
|
||||
op = _.ops.pop();
|
||||
_.trys.pop();
|
||||
continue;
|
||||
default:
|
||||
if (
|
||||
!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
|
||||
(op[0] === 6 || op[0] === 2)
|
||||
) {
|
||||
_ = 0;
|
||||
continue;
|
||||
}
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
||||
_.label = op[1];
|
||||
break;
|
||||
}
|
||||
if (op[0] === 6 && _.label < t[1]) {
|
||||
_.label = t[1];
|
||||
t = op;
|
||||
break;
|
||||
}
|
||||
if (t && _.label < t[2]) {
|
||||
_.label = t[2];
|
||||
_.ops.push(op);
|
||||
break;
|
||||
}
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) {
|
||||
op = [6, e];
|
||||
y = 0;
|
||||
} finally {
|
||||
f = t = 0;
|
||||
}
|
||||
if (op[0] & 5) throw op[1];
|
||||
return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
// The below is a dummy example for git. Make sure to change the file name!
|
||||
var completionSpec = {
|
||||
name: "mask",
|
||||
generateSpec: function (context, executeShellCommand) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var maskfileLocationIdx, out;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
maskfileLocationIdx = context.indexOf("--maskfile");
|
||||
if (!(maskfileLocationIdx < 0 || maskfileLocationIdx + 3 > context.length)) return [3 /*break*/, 2];
|
||||
return [4 /*yield*/, executeShellCommand("cat maskfile.md 2> /dev/null")];
|
||||
case 1:
|
||||
out = _a.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 2: return [4 /*yield*/, executeShellCommand("cat " + context[maskfileLocationIdx + 1] + " 2> /dev/null")];
|
||||
case 3:
|
||||
out = _a.sent();
|
||||
_a.label = 4;
|
||||
case 4:
|
||||
if (!out)
|
||||
return [2 /*return*/, { name: "null" }];
|
||||
return [2 /*return*/, {
|
||||
name: "mask",
|
||||
subcommands: out.match(/##.*/g).map(function (elm) {
|
||||
return {
|
||||
name: elm.slice(3),
|
||||
};
|
||||
}),
|
||||
}];
|
||||
}
|
||||
});
|
||||
}); },
|
||||
name: "mask",
|
||||
generateSpec: function (context, executeShellCommand) {
|
||||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var maskfileLocationIdx, out;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
maskfileLocationIdx = context.indexOf("--maskfile");
|
||||
if (
|
||||
!(
|
||||
maskfileLocationIdx < 0 ||
|
||||
maskfileLocationIdx + 3 > context.length
|
||||
)
|
||||
)
|
||||
return [3 /*break*/, 2];
|
||||
return [
|
||||
4 /*yield*/,
|
||||
executeShellCommand("cat maskfile.md 2> /dev/null"),
|
||||
];
|
||||
case 1:
|
||||
out = _a.sent();
|
||||
return [3 /*break*/, 4];
|
||||
case 2:
|
||||
return [
|
||||
4 /*yield*/,
|
||||
executeShellCommand(
|
||||
"cat " + context[maskfileLocationIdx + 1] + " 2> /dev/null"
|
||||
),
|
||||
];
|
||||
case 3:
|
||||
out = _a.sent();
|
||||
_a.label = 4;
|
||||
case 4:
|
||||
if (!out) return [2 /*return*/, { name: "null" }];
|
||||
return [
|
||||
2 /*return*/,
|
||||
{
|
||||
name: "mask",
|
||||
subcommands: out.match(/##.*/g).map(function (elm) {
|
||||
return {
|
||||
name: elm.slice(3),
|
||||
};
|
||||
}),
|
||||
},
|
||||
];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
238
specs/php.js
238
specs/php.js
@@ -1,73 +1,175 @@
|
||||
// To learn more about Fig's autocomplete standard visit: https://withfig.com/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
// To learn more about Fig's autocomplete standard visit: https://fig.io/docs/autocomplete/building-a-spec#building-your-first-autocomplete-spec
|
||||
var __awaiter =
|
||||
(this && this.__awaiter) ||
|
||||
function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) {
|
||||
return value instanceof P
|
||||
? value
|
||||
: new P(function (resolve) {
|
||||
resolve(value);
|
||||
});
|
||||
}
|
||||
};
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function rejected(value) {
|
||||
try {
|
||||
step(generator["throw"](value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
}
|
||||
function step(result) {
|
||||
result.done
|
||||
? resolve(result.value)
|
||||
: adopt(result.value).then(fulfilled, rejected);
|
||||
}
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator =
|
||||
(this && this.__generator) ||
|
||||
function (thisArg, body) {
|
||||
var _ = {
|
||||
label: 0,
|
||||
sent: function () {
|
||||
if (t[0] & 1) throw t[1];
|
||||
return t[1];
|
||||
},
|
||||
trys: [],
|
||||
ops: [],
|
||||
},
|
||||
f,
|
||||
y,
|
||||
t,
|
||||
g;
|
||||
return (
|
||||
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
|
||||
typeof Symbol === "function" &&
|
||||
(g[Symbol.iterator] = function () {
|
||||
return this;
|
||||
}),
|
||||
g
|
||||
);
|
||||
function verb(n) {
|
||||
return function (v) {
|
||||
return step([n, v]);
|
||||
};
|
||||
}
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_)
|
||||
try {
|
||||
if (
|
||||
((f = 1),
|
||||
y &&
|
||||
(t =
|
||||
op[0] & 2
|
||||
? y["return"]
|
||||
: op[0]
|
||||
? y["throw"] || ((t = y["return"]) && t.call(y), 0)
|
||||
: y.next) &&
|
||||
!(t = t.call(y, op[1])).done)
|
||||
)
|
||||
return t;
|
||||
if (((y = 0), t)) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
t = op;
|
||||
break;
|
||||
case 4:
|
||||
_.label++;
|
||||
return { value: op[1], done: false };
|
||||
case 5:
|
||||
_.label++;
|
||||
y = op[1];
|
||||
op = [0];
|
||||
continue;
|
||||
case 7:
|
||||
op = _.ops.pop();
|
||||
_.trys.pop();
|
||||
continue;
|
||||
default:
|
||||
if (
|
||||
!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
|
||||
(op[0] === 6 || op[0] === 2)
|
||||
) {
|
||||
_ = 0;
|
||||
continue;
|
||||
}
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
||||
_.label = op[1];
|
||||
break;
|
||||
}
|
||||
if (op[0] === 6 && _.label < t[1]) {
|
||||
_.label = t[1];
|
||||
t = op;
|
||||
break;
|
||||
}
|
||||
if (t && _.label < t[2]) {
|
||||
_.label = t[2];
|
||||
_.ops.push(op);
|
||||
break;
|
||||
}
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop();
|
||||
continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) {
|
||||
op = [6, e];
|
||||
y = 0;
|
||||
} finally {
|
||||
f = t = 0;
|
||||
}
|
||||
if (op[0] & 5) throw op[1];
|
||||
return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
// The below is a dummy example for git. Make sure to change the file name!
|
||||
var completionSpec = {
|
||||
name: "php",
|
||||
description: "Run the PHP interpreter",
|
||||
generateSpec: function (context, executeShellCommand) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var subcommands;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
subcommands = [];
|
||||
return [4 /*yield*/, executeShellCommand("ls -1 artisan")];
|
||||
case 1:
|
||||
if ((_a.sent()) === "artisan") {
|
||||
subcommands.push({ name: "artisan", loadSpec: "php/artisan" });
|
||||
}
|
||||
return [2 /*return*/, {
|
||||
name: "php",
|
||||
subcommands: subcommands,
|
||||
args: {
|
||||
generators: {
|
||||
template: "filepaths",
|
||||
filterTemplateSuggestions: function (suggestions) {
|
||||
return suggestions.filter(function (suggestion) {
|
||||
return (
|
||||
// suggestion.name.endsWith(".php") ||
|
||||
suggestion.name.indexOf(".") === -1);
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
}];
|
||||
name: "php",
|
||||
description: "Run the PHP interpreter",
|
||||
generateSpec: function (context, executeShellCommand) {
|
||||
return __awaiter(void 0, void 0, void 0, function () {
|
||||
var subcommands;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
subcommands = [];
|
||||
return [4 /*yield*/, executeShellCommand("ls -1 artisan")];
|
||||
case 1:
|
||||
if (_a.sent() === "artisan") {
|
||||
subcommands.push({ name: "artisan", loadSpec: "php/artisan" });
|
||||
}
|
||||
});
|
||||
}); },
|
||||
return [
|
||||
2 /*return*/,
|
||||
{
|
||||
name: "php",
|
||||
subcommands: subcommands,
|
||||
args: {
|
||||
generators: {
|
||||
template: "filepaths",
|
||||
filterTemplateSuggestions: function (suggestions) {
|
||||
return suggestions.filter(function (suggestion) {
|
||||
return (
|
||||
// suggestion.name.endsWith(".php") ||
|
||||
suggestion.name.indexOf(".") === -1
|
||||
);
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user