-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Prompt before listing all repos when running bower search
without a query param
#2074
Prompt before listing all repos when running bower search
without a query param
#2074
Conversation
Hey, thank you 😊
|
Could we also leave it as it is when |
@sheerun, I'm willing to add in the help screen in this case, but I just noticed the current behavior for the other commands that "require" an argument, such as Wouldn't it be better to create a seperate, more general issue to add an easy way to default to the help screen inside a command, and then we could make the behavior of all of these commands consistent. It would be odd to just do one at a time, with potentially different solutions for showing the help screen from inside the command. |
Yes, it would be odd :) Could you open another issues about it? But for now let's implement it at least for |
Will do. |
I guess people don't respect the asignees in Github... I found this bug and assigned myself the issue and was working on it in my spare time, oh well time to scrap my work |
I'm sorry to hear it :( It's probably better to write a comment. Often people assign issues on them by mistake. Or assign, abandon work, and forget to unassign. |
@heinst I apologize. This is my first contribution to an open source project, and my first time using Github (I'm familiar with Stash/Jira, but not Github for issues/PRs). I hadn't seen an assignee field at all, but going back now, I see your self-assignment. This was my mistake for sure. I will agree that it is harder to see the assignment field/notification than I would've expected, though that's not your fault. |
To give an update here, I'm having some trouble calling the help display when command argument parsing fails. This is because we don't have an official way to deal with command argument parsing, as well as some bad coupling between the logger and commands. There's this from
Note the However, we always return a valid logger, so there is no way for From
So My plan is to at least decouple the argument checking from the command being run, so that we can check the params synchronously (using The only problem I see is that other places using the |
search term. Keep current behavior when running with config.json enabled, or in non-interactive mode. Rewrite bower search tests to cover the different cases of using the command without a query parameter (interactive w/o config.json, interactive w/ config.json, and non-interactive)
Let's make changes as small as possible. Fortunately we have integration tests for most of the commands. |
@sheerun I ended up just making it possible for commands to exit by throwing an exception whenever there is a syntax error (i.e. missing parameter) on the CLI, and the bower script then defaults to I did not have to change anything to get the other commands' integration tests to pass locally. I had to rewrite the tests for the search command though, and it looks I missed testing a new exception in search.readOptions(). |
@eppeters Looks good to me, so I'm accepting this PR, great job :) Are you on our Discord chat? |
…ting-all Prompt before listing all repos when running `bower search` without a query param
@sheerun I am now! |
It turns out you show help message even if someone passes |
Yeah I see that now. It's just showing the json version of whatever command |
I'm working on a fix |
Sounds good :) Sorry for the trouble. |
While I was waiting for your response, I made these changes, but I understand fully if you want to go ahead and fix it. |
Description
This PR aims to address issue #2066 by warning the user before attempting to list all packages when using
bower search
with no query parameter.In interactive mode
When running
bower search
with no additional params, the user should see the following:If they confirm the action, the search will be performed. If they deny the action,
No results.
will be printed and they will be returned to their prompt.In non-interactive (programmatic mode)
The search will just be performed without any prompt.
Tests
The PR includes tests that no prompt occurs in non-interactive mode (no prompt, just like it was before the PR), and tests that the full listing is generated in interactive mode if and only if the user agrees to continue past the warning.
Note
This is my first PR to an open source project, and therefore my first to bower as well, so let me know if I'm doing something incorrectly.