Skip to content

feat(cargo-make): add cargo-make autocompletion and Makefile.toml support#2180

Merged
grant0417 merged 1 commit intowithfig:masterfrom
beeinger:master
Nov 20, 2023
Merged

feat(cargo-make): add cargo-make autocompletion and Makefile.toml support#2180
grant0417 merged 1 commit intowithfig:masterfrom
beeinger:master

Conversation

@beeinger
Copy link
Copy Markdown
Contributor

Added cargo-make completion with Makefile.toml tasks resolving.

@withfig-bot
Copy link
Copy Markdown
Contributor

withfig-bot commented Nov 20, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@beeinger
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

withfig-bot added a commit that referenced this pull request Nov 20, 2023
@withfig-bot
Copy link
Copy Markdown
Contributor

Overview

src/cargo.ts:

Info:

Single Functions:

custom:

 async function (tokens, executeCommand) {
    let makefileLocation = "Makefile.toml";

    const makefileFlagIdx = tokens.findIndex((param) => param === "--makefile");
    if (makefileFlagIdx !== -1 && tokens.length > makefileFlagIdx + 1)
      makefileLocation = tokens[makefileFlagIdx + 1];

    const args = [makefileLocation];
    const { stdout } = await executeCommand({
      command: "cat",
      args,
    });

    const taskRegex = /\[tasks\.([^\]]+)\]/g;
    let match;
    const tasks = [];

    while ((match = taskRegex.exec(stdout)) !== null) {
      tasks.push({
        name: match[1],
      });
    }

    return tasks;
  }

URLs:

  • https://crates.io/api/v1/crates/
  • https://crates.io/api/v1/crates?q=

@withfig-bot
Copy link
Copy Markdown
Contributor

Hello @beeinger,
thank you very much for creating a Pull Request!
Here is a small checklist to get this PR merged as quickly as possible:

  • Do all subcommands / options which take arguments include the args property (args: {})?
  • Are all options modular? E.g. -a -u -x instead of -aux
  • Have all other checks passed?

Please add a 👍 as a reaction to this comment to show that you read this.

@grant0417 grant0417 merged commit 65a073c into withfig:master Nov 20, 2023
@withfig withfig locked and limited conversation to collaborators Nov 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants