-
-
Notifications
You must be signed in to change notification settings - Fork 532
Option to open in browser by entering a number #1
Conversation
Awesome change! And you read my mind in the "numbers instead if asterisks" part. Can we make this a little more user-friendly? And a few more suggestions...
|
I agree, I'll take a look.
If we make the results from 1-N, I believe it would make sense to disable the I say we make the
Sure.
Will rebase to master. |
Regarding point 2: I need to take a look why it is not going back if -s is used. Even if -s is used, I implemented with the first result as base, may be there's a glitch. Thanks for pointing it out! This is also the reason why p cannot be removed, even if the user starts at 50th result, he might want to check out the 40th results by navigating back. The N comes into picture when -n is used, for example, if '-n 15' is used, the index will range from 1 to 15, so it is not limited to 10. When the user inputs n or p, please reset the index as if the next set of results is a fresh set. This will reduce complexity of bookeeping and the user doesn't need to scrollback a lot. The idea is to treat each page of results as a new page. Thank you for the valuable insights :). |
3e4858f
to
f4af7ef
Compare
@jarun please see the changes. |
I need some pointers from you on "And right now it doesn't really go back if -s is used." in your second comment. I just checked the following: $ ./google -s 20 hello world Search URL: https://www.google.com/search?start=20&q=hello+world
new url: https://www.google.co.in/search?start=10&q=hello+world&gws_rd=cr&ei=MJjbVfHcJJSBuwTJnpCgAw
new url: https://www.google.co.in/search?start=0&q=hello+world&gws_rd=cr&ei=MJjbVfHcJJSBuwTJnpCgAw
|
Yes, you're right, it does work. I just tested again both with master and this branch. Last time I tried it looked like I was seeing the first page all over again. I must have done something wrong before. |
You'll see the first page over and over if you've already hit the first page ;). |
I could see some issues: Test 1$ ./google print restore this arun@Tux~/D/google-cli> // google-cli exits Test 2Press 'n', 'p', or number and Enter to continue... 6 I tested with Yandex browser beta. In the first test, the utility exited when it opened a new tab. In the second case, it kept working as I closed the browser each time after opening a URL. Then, continuing with second test, I pressed n and got an error: Test 3Press 'n', 'p', or number and Enter to continue... 7
Traceback (most recent call last): |
Does the following issue seem similar? Please check if the redirection solution works with Google Chrome. I can also see that Python 3.5 RC1 is available. I do have a pull request for Python 3.x support which I will test shortly. For us the browser output exit will look bad (as users would definitely use the open in browser with index feature ;)) but I would put this in the readme/man maybe if it's unavoidable. |
Another Chrome related problem:
Note that I am merging the changes for Python 3.x support from #4. But as I can see you haven't added a lot of prints in your pull request so that should be fine. |
It seems you pressed an enter here and the program exited because of empty string?
The problem is that
I cannot reproduce this. The only thing that crosses my mind is that you experienced a connection failure. But this should have nothing to do with this pull request. |
I guess I did press enter. I guess you are right about the other cases. I think making a note about using FF should be the right way. I will keep fixing the issues that I see during my tests as well. Would you mind resolving the conflicts? I believe those came from Python 3 support changes I merged this morning. |
Updated man page with numeric commands Able to open multiple links before quitting
f4af7ef
to
f028b25
Compare
You're welcome. I'd like to recommend you to use a linter such as flake8 to verify the syntax. It has sane defaults, configurable rules and makes it a lot of easier for multiple people to use the same coding style. Best of all, it automatically alerts you about syntax errors.
I believe that's it. I tested it with both python versions and it seemed to work. |
Thanks for the flake8 suggestion. Being a C/C++ dev with a customized vim I am indeed having a hard time keeping a tab on the Python syntax. ;) And thank you so much for your valuable time on this new feature! |
Option to open in browser by entering a number
Merged. |
If you're using syntastic, you an easily set your python linter via: |
I'll check it out! |
$ /usr/bin/python3 -m pyflakes google |
You're welcome. Glad you got it working! BTW I believe flake8 does more than pyflakes - see here. |
True! |
Option to open in browser by entering a number
Hi there, I added the ability to open a specific result in browser by entering an integer instead of
n
orp
.