Skip to content
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

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

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

beeinger
Copy link
Contributor

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

@withfig-bot
Copy link
Collaborator

withfig-bot commented Nov 20, 2023

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

@beeinger
Copy link
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
Collaborator

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
Collaborator

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
5 checks passed
@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