Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit65a073c

Browse files
authored
feat(cargo-make): add cargo-make autocompletion and Makefile.toml support (#2180)
1 parent126ae0d commit65a073c

File tree

1 file changed

+193
-0
lines changed

1 file changed

+193
-0
lines changed

‎src/cargo.ts‎

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,34 @@ const featuresGenerator: Fig.Generator = {
208208
},
209209
};
210210

211+
constmakeTasksGenerator:Fig.Generator={
212+
custom:asyncfunction(tokens,executeCommand){
213+
letmakefileLocation="Makefile.toml";
214+
215+
constmakefileFlagIdx=tokens.findIndex((param)=>param==="--makefile");
216+
if(makefileFlagIdx!==-1&&tokens.length>makefileFlagIdx+1)
217+
makefileLocation=tokens[makefileFlagIdx+1];
218+
219+
constargs=[makefileLocation];
220+
const{ stdout}=awaitexecuteCommand({
221+
command:"cat",
222+
args,
223+
});
224+
225+
consttaskRegex=/\[tasks\.([^\]]+)\]/g;
226+
letmatch;
227+
consttasks=[];
228+
229+
while((match=taskRegex.exec(stdout))!==null){
230+
tasks.push({
231+
name:match[1],
232+
});
233+
}
234+
235+
returntasks;
236+
},
237+
};
238+
211239
typeCrateSearchResults={
212240
crates:Crate[];
213241
};
@@ -7357,6 +7385,171 @@ const completionSpec: (toolchain?: boolean) => Fig.Spec = (
73577385
subcommands.push(insta);
73587386
}
73597387

7388+
if(commands.includes("make")){
7389+
constmake:Fig.Subcommand={
7390+
name:"make",
7391+
icon:"🛠",
7392+
description:"Rust cargo-make task runner and build tool",
7393+
args:{
7394+
name:"TASK",
7395+
filterStrategy:"fuzzy",
7396+
isVariadic:true,
7397+
isOptional:true,
7398+
generators:makeTasksGenerator,
7399+
},
7400+
options:[
7401+
{
7402+
name:["--help","-h"],
7403+
description:"Print help information",
7404+
},
7405+
{
7406+
name:["--version","-V"],
7407+
description:"Print version information",
7408+
},
7409+
{
7410+
name:"--makefile",
7411+
description:
7412+
"The optional toml file containing the tasks definitions",
7413+
args:{name:"FILE",template:"filepaths"},
7414+
},
7415+
{
7416+
name:["--task","-t"],
7417+
description:"The task name to execute",
7418+
args:{
7419+
name:"TASK",
7420+
filterStrategy:"fuzzy",
7421+
isVariadic:true,
7422+
isOptional:true,
7423+
generators:makeTasksGenerator,
7424+
},
7425+
},
7426+
{
7427+
name:["--profile","-p"],
7428+
description:"The profile name",
7429+
args:{name:"PROFILE",default:"development"},
7430+
},
7431+
{
7432+
name:"--cwd",
7433+
description:"Set the current working directory",
7434+
args:{name:"DIRECTORY",template:"folders"},
7435+
},
7436+
{
7437+
name:"--no-workspace",
7438+
description:"Disable workspace support",
7439+
},
7440+
{
7441+
name:"--no-on-error",
7442+
description:
7443+
"Disable on error flow even if defined in config sections",
7444+
},
7445+
{
7446+
name:"--allow-private",
7447+
description:"Allow invocation of private tasks",
7448+
},
7449+
{
7450+
name:"--skip-init-end-tasks",
7451+
description:"If set, init and end tasks are skipped",
7452+
},
7453+
{
7454+
name:"--skip-tasks",
7455+
description:"Skip all tasks that match the provided regex",
7456+
args:{name:"SKIP_TASK_PATTERNS"},
7457+
},
7458+
{
7459+
name:"--env-file",
7460+
description:"Set environment variables from provided file",
7461+
args:{name:"FILE",template:"filepaths"},
7462+
},
7463+
{
7464+
name:["--env","-e"],
7465+
description:"Set environment variables",
7466+
args:{name:"ENV"},
7467+
},
7468+
{
7469+
name:["--loglevel","-l"],
7470+
description:"The log level",
7471+
args:{
7472+
name:"LOG LEVEL",
7473+
suggestions:["verbose","info","error","off"],
7474+
},
7475+
},
7476+
{
7477+
name:["--verbose","-v"],
7478+
description:"Sets the log level to verbose",
7479+
},
7480+
{
7481+
name:"--quiet",
7482+
description:"Sets the log level to error",
7483+
},
7484+
{
7485+
name:"--silent",
7486+
description:"Sets the log level to off",
7487+
},
7488+
{
7489+
name:"--no-color",
7490+
description:"Disables colorful output",
7491+
},
7492+
{
7493+
name:"--time-summary",
7494+
description:"Print task level time summary at end of flow",
7495+
},
7496+
{
7497+
name:"--experimental",
7498+
description:
7499+
"Allows access to unsupported experimental predefined tasks",
7500+
},
7501+
{
7502+
name:"--disable-check-for-updates",
7503+
description:"Disables the update check during startup",
7504+
},
7505+
{
7506+
name:"--output-format",
7507+
description:"The print/list steps format",
7508+
args:{
7509+
name:"OUTPUT FORMAT",
7510+
suggestions:[
7511+
"default",
7512+
"short-description",
7513+
"markdown",
7514+
"markdown-single-page",
7515+
"markdown-sub-section",
7516+
"autocomplete",
7517+
],
7518+
},
7519+
},
7520+
{
7521+
name:"--output-file",
7522+
description:"The list steps output file name",
7523+
args:{name:"OUTPUT_FILE",template:"filepaths"},
7524+
},
7525+
{
7526+
name:"--hide-uninteresting",
7527+
description:"Hide any minor tasks such as pre/post hooks",
7528+
},
7529+
{
7530+
name:"--print-steps",
7531+
description:
7532+
"Only prints the steps of the build in the order they will be invoked but without invoking them",
7533+
},
7534+
{
7535+
name:"--list-all-steps",
7536+
description:"Lists all known steps",
7537+
},
7538+
{
7539+
name:"--list-category-steps",
7540+
description:"List steps for a given category",
7541+
args:{name:"CATEGORY"},
7542+
},
7543+
{
7544+
name:"--diff-steps",
7545+
description:
7546+
"Runs diff between custom flow and prebuilt flow (requires git)",
7547+
},
7548+
],
7549+
};
7550+
subcommands.push(make);
7551+
}
7552+
73607553
return{
73617554
name:"cargo",
73627555
subcommands,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp