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 nativescript completion spec #563

Merged
merged 6 commits into from
Sep 10, 2021
Merged

Conversation

pekevski
Copy link
Contributor

@pekevski pekevski commented Sep 6, 2021

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature: added the NativeScript completion spec

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?
ns, tns and nativescript autocompletion specs have been introduced to Fig

Additional info:
fixes #553

@withfig-bot
Copy link
Collaborator

withfig-bot commented Sep 6, 2021

Overview

dev/ns.ts:

Info:

Single Scripts:

  • curl https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages

URLs:

  • http:https://127.0.0.1:8888.
  • https://api.github.com/repos/NativeScript/nativescript-app-templates/contents/packages

dev/nativescript.ts:

Info:

dev/tns.ts:

Info:

@withfig-bot
Copy link
Collaborator

Hello @pekevski,
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 have the arg property (arg: {})?
  • 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.

dev/ns.ts Outdated Show resolved Hide resolved
dev/ns.ts Outdated Show resolved Hide resolved
dev/ns.ts Outdated Show resolved Hide resolved
dev/ns.ts Outdated Show resolved Hide resolved
dev/ns.ts Outdated Show resolved Hide resolved
dev/ns.ts Outdated Show resolved Hide resolved
@pekevski
Copy link
Contributor Author

pekevski commented Sep 7, 2021

I will apply the recommendations later tonight. Thanks for the review 🚀

dev/nativescript.ts Show resolved Hide resolved
@pekevski
Copy link
Contributor Author

pekevski commented Sep 7, 2021

Just a note: this will resolve #553

@fedeci
Copy link
Contributor

fedeci commented Sep 7, 2021

Can you add it in the description of the PR, autoclose does not work when written in comments.

dev/ns.ts Outdated Show resolved Hide resolved
insertValue: "--device {cursor}",
args: {
name: "device id",
// TODO: create a generator of ns device <platform> --available-devices
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to tackle the generators in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I attempted to however my generator script was throwing an exception in the fig logs. I posted about it on the dev-help channel here, it hasn't gotten a response yet so I thought I would tackle it later?

https://discord.com/channels/837809111248535583/839904703214649345/883695652243128330

Copy link
Member

Choose a reason for hiding this comment

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

@QuiiBz I think it is best practice for the completion spec skeleton to be it's own PR. (Not a hard fast rule, especially for smaller specs, but it just makes things easier to review!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

running my generator i get the following error. I think i'll just fix it in the future?

About to run the following command cd <dir>/forks/fig-autocomplete && ns devices --json | cat: {options: undefined}
we had an error with the script generator
Error: pty execute promise timed out. Running cmd + c in pseudo terminal just in case

Copy link
Contributor

Choose a reason for hiding this comment

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

About to run the following command cd <dir>/forks/fig-autocomplete && ns devices --json | cat: {options: undefined}
we had an error with the script generator
Error: pty execute promise timed out. Running cmd + c in pseudo terminal just in case

Could you try running this command manually (ns devices --json)? There is a timeout of 10 seconds for each command, so that might be why you see this error in the console.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

timing the command with time ns devices --json, i get

ns device --json  1.95s user 1.18s system 31% cpu 9.860 total

i think it might just be timing out, is there a way to extend it?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not currently possible to extend this default timeout - but looks like the command doesn't exceed 10 seconds, that's strange.

dev/ns.ts Show resolved Hide resolved
dev/ns.ts Outdated Show resolved Hide resolved
dev/ns.ts Show resolved Hide resolved
dev/ns.ts Outdated Show resolved Hide resolved
dev/ns.ts Show resolved Hide resolved
dev/ns.ts Show resolved Hide resolved
@pekevski
Copy link
Contributor Author

pekevski commented Sep 8, 2021

Pushed fixes for the previous set of feedback.

dev/ns.ts Outdated
/**
* Plaform options used across many commands of the CLI
*/
const iosGeneralOptions: Fig.Option[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any missing options for ios? If they are none, we can safely remove this!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was just a placeholder for future options if they ever got introduced. I can remove it now if you like

Copy link
Contributor

Choose a reason for hiding this comment

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

It was just a placeholder for future options if they ever got introduced. I can remove it now if you like

Thanks for the clarification!

Copy link
Contributor

@QuiiBz QuiiBz left a comment

Choose a reason for hiding this comment

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

Thank you so much for this amazing contribution! LGTM 🚀

@QuiiBz QuiiBz merged commit 9d52409 into withfig:master Sep 10, 2021
@pekevski
Copy link
Contributor Author

Huge! Thanks for creating such a simple api 😎

What should we do about the generator timeouts in the meantime?

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.

[ns] Nativescript CLI completion spec
5 participants