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: add autocomplete feature in cli #1724

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

AayushSaini101
Copy link
Collaborator

@AayushSaini101 AayushSaini101 commented Mar 14, 2025

Proof of working:
Screenshot 2025-03-14 at 8 29 06 AM
Resolves: #1685

Copy link

changeset-bot bot commented Mar 14, 2025

⚠️ No Changeset found

Latest commit: e0b0234

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@AayushSaini101 AayushSaini101 marked this pull request as draft March 14, 2025 03:04
@AayushSaini101
Copy link
Collaborator Author

/u

@AayushSaini101
Copy link
Collaborator Author

/u

@AayushSaini101 AayushSaini101 marked this pull request as ready for review March 17, 2025 17:22
@Shurtu-gal
Copy link
Collaborator

@AayushSaini101 I don't think this is ths way autocomplete should be done can we run it as part of installation process?

@AayushSaini101
Copy link
Collaborator Author

@AayushSaini101 I don't think this is ths way autocomplete should be done can we run it as part of installation process?

Sure. Let me check during the installation process

@Souvikns
Copy link
Member

Souvikns commented Mar 18, 2025

Awesome feature in my opinion, I am always forgetting commands 😆

@AayushSaini101
Copy link
Collaborator Author

1 test case is failing, checking the cause
Here is the outcome of adding script and a new plugin for autocomplete
Screenshot 2025-03-18 at 11 25 07 AM

@@ -163,6 +165,7 @@
"pretest": "npm run build",
"pretest:coverage": "npm run build",
"posttest": "rimraf ./test.asyncapi-cli",
"postinstall": "node ./scripts/enableAutoComplete.js",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this script runs after packaging as well?
Also what about docker image. Does this still work there?
Same question for chocolatey.

const fs = require('fs');
const path = require('path');

const shellConfigs = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about their derivatives?

},
fish: {
rcFile: path.join(os.homedir(), '.config', 'fish', 'completions', 'asyncapi.fish'),
detectFile: path.join(os.homedir(), '.config', 'fish', 'config.fish'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Detection using $SHELL or some other way would be better. Not everyone has their config like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After running the npm install
Here is the result
image
The process.env.SHELL returning /bin/sh the because many system use by default to run these kind of scripts.

but if we use the same concept as in the PR, we can easily detect the default shell of the os. Result
image

@AayushSaini101
Copy link
Collaborator Author

/u

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

Successfully merging this pull request may close these issues.

[FEATURE] Add Command-line Tab Completion to AsyncAPI CLI
5 participants