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

chore(completion) - generate shell script in a much more automated way #3981

Closed

Conversation

catull
Copy link
Contributor

@catull catull commented Jan 13, 2017

All the options are taken straight from the commands, aliases as well.

The ng generate command is not fully supported yet.
It is being considered for the main ng options, however since it does not have avaliableOptions but rather an aliasMap, it requires more work.

…ntirely. The options and aliases are generated dynamically. There are options to only produce bash- or zsh-specific code.
@catull catull mentioned this pull request Jan 15, 2017
@catull
Copy link
Contributor Author

catull commented Jan 15, 2017

PR is large, it introduces command options.
Would like to get some feed-back.

catull and others added 2 commits January 18, 2017 22:55
…is no reason we should capture std error and stuff it into .bashrc / .zshrc. Let's just capture std output instead.
@catull catull changed the title Completion.sh is generated in a much more automated way. chore(completion) - generate shell script in a much more automated way Jan 28, 2017
README.md Outdated
@@ -289,19 +289,19 @@ To turn on auto completion use the following commands:

For bash:
```bash
ng completion 1>> ~/.bashrc 2>>&1
ng completion --bash 1>> ~/.bashrc
Copy link
Contributor

Choose a reason for hiding this comment

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

Drop the 1 in 1>>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, changed it in completion.ts, too.

Copy link
Contributor

@hansl hansl left a comment

Choose a reason for hiding this comment

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

A few nits, should take you all of 5 minutes. Please note that README is being moved to wiki.

cc @Brocco

caseBlock +
' *) opts="" ;;';

console.log(`###-begin-ng-completion###
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use stripIndent from common-tags and indent the whole string? Look at other places where we use it for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


if (commandOptions.all || commandOptions.bash) {
console.log(`_ng_completion() {
local cword pword opts
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here; use stripIndent so we keep the indentation in the code (I don't care much about the generated files).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, too.

@hansl
Copy link
Contributor

hansl commented Jan 31, 2017

LGTM. Awesome!

@hansl
Copy link
Contributor

hansl commented Jan 31, 2017

Waiting for the e2e tests to complete then I'll merge this in time for the beta

@Brocco
Copy link
Contributor

Brocco commented Feb 1, 2017

I have a request (which can be a separate PR) to extract the availableOptions into a separate file so it can be used by other things than just completion. And with that add the ability to parse out the availableOptions from blueprints as well.

@catull
Copy link
Contributor Author

catull commented Feb 1, 2017

@Brocco @hansl
Does this mean this PR is put on hold until the factoring out has happened and the PR is updated accordingly ?

@hansl
Copy link
Contributor

hansl commented Feb 1, 2017

No I'm fine with this PR as it is today. Mike does that impede your work?

@catull
Copy link
Contributor Author

catull commented Feb 1, 2017

I can open a new issue to introduce a separation of availableOptions / blueprints into, say _.options.ts.

@hansl hansl closed this in d2f8ca7 Feb 3, 2017
@catull catull deleted the enhancement-automation-of-completion-script branch February 3, 2017 04:31
@catull
Copy link
Contributor Author

catull commented Feb 3, 2017

@Brocco New PR #4267 has the separated options / blueprints.

MRHarrison pushed a commit to MRHarrison/angular-cli that referenced this pull request Feb 9, 2017
It requires little tweaking in the case-block.

Now the completion shell script is generated out of TypeScript code entirely.  The options and aliases are generated dynamically.  There are options to only produce bash- or zsh-specific code.

Closes angular#3981.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 11, 2019
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.

5 participants