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(wasp): Add wasp autocomplete #2077

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Zeko369
Copy link
Contributor

@Zeko369 Zeko369 commented Sep 4, 2023

This PR adds support for Wasp CLI

  • some of the deploy commands are missing

@withfig-bot
Copy link
Collaborator

Overview

src/wasp.ts:

Info:

Script:
flyctl platform regions --json
postProcess(function):

 function (out) {
                  try {
                    const regions = JSON.parse(out);
                    return regions.map((region) => ({
                      name: `${region["Code"]} - ${region["Name"]}${
                        region["RequiresPaidPlan"] ? "🤑" : ""
                      }`,
                      insertValue: region["Code"],
                      priority: region["RequiresPaidPlan"] ? 0 : 100,
                    }));
                  } catch (e) {
                    console.log(e);
                    return [];
                  }
                }

Single Functions:

postProcess:

 function (out) {
            try {
              const templates = JSON.parse(out);
              return templates.map((template) => ({
                name: template.name,
                description: template.description,
              }));
            } catch (e) {
              console.log(e);
              return [];
            }
          }

URLs:

  • https://user-images.githubusercontent.com/1536647/77317442-78625700-6d0b-11ea-9822-0fb21e557e87.png

@withfig-bot
Copy link
Collaborator

Hello @Zeko369,
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.

Comment on lines +255 to +257
(await executeShellCommand(
`while [ ! -f "$PWD/main.wasp" ] && [ "$PWD" != "/" ]; do cd ..; done; [ -f "$PWD/main.wasp" ] && echo "true" || echo "false"`
)) == "true";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a good thing for us to abstract into @withfig/autocomplete-tools.

Comment on lines +80 to +88
subcommands: [
{
name: "generate",
description: "Generates bash completion script",
insertValue: `${"\b".repeat(
COMPLETION.length + 1
)}${COMPLETION}:generate`,
},
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you trying to do here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants