From c5fa716722d66d9156eca4292f37fd1fce9a5315 Mon Sep 17 00:00:00 2001 From: Hrishikesh Sathe Date: Fri, 27 Jun 2014 20:29:33 +0530 Subject: [PATCH 1/7] Added version as command line parameter Use -v or --version shows the version as in __init__.py --- howdoi/howdoi.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/howdoi/howdoi.py b/howdoi/howdoi.py index 7255cbb6d..79f5863fe 100755 --- a/howdoi/howdoi.py +++ b/howdoi/howdoi.py @@ -16,6 +16,7 @@ import requests import requests_cache import sys +from __init__ import __version__ try: from urllib.parse import quote as url_quote @@ -229,12 +230,17 @@ def get_parser(): parser.add_argument('-n','--num-answers', help='number of answers to return', default=1, type=int) parser.add_argument('-C','--clear-cache', help='clear the cache', action='store_true') + parser.add_argument('-v','--version',help='displays the current version of howdoi',action='store_true') return parser def command_line_runner(): parser = get_parser() args = vars(parser.parse_args()) + + if args['version']: + print(__version__) + return if args['clear_cache']: clear_cache() From 6878e3d96859d2de3a9616e1999f3fdcdf6ec1dc Mon Sep 17 00:00:00 2001 From: Hrishikesh Sathe Date: Fri, 27 Jun 2014 22:35:16 +0530 Subject: [PATCH 2/7] Added version as a command line parameter Use -v or --version --- howdoi/howdoi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/howdoi/howdoi.py b/howdoi/howdoi.py index 79f5863fe..fbd3a0886 100755 --- a/howdoi/howdoi.py +++ b/howdoi/howdoi.py @@ -16,6 +16,7 @@ import requests import requests_cache import sys +sys.path.append('howdoi') from __init__ import __version__ try: From 29e9fff7e623adf0cff2312afdacd5cb1b4f1c70 Mon Sep 17 00:00:00 2001 From: Hrishikesh Sathe Date: Fri, 27 Jun 2014 22:54:43 +0530 Subject: [PATCH 3/7] Update README.rst Added description for errors related to lxml on python 3.3+ --- README.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.rst b/README.rst index d77c9c373..ef4b221ce 100644 --- a/README.rst +++ b/README.rst @@ -138,3 +138,9 @@ Fix the error by executing the following command: :: sudo chmod -R go+w /Library/Python/2.7/site-packages/ + + +You may get a problem while installing for Python 3.3+ as an official version has not yet been released. + +:: + Try and install an unofficial binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml From ded64ed60c486f670f3307ffdac0638f865debba Mon Sep 17 00:00:00 2001 From: Hrishikesh Sathe Date: Fri, 27 Jun 2014 22:57:05 +0530 Subject: [PATCH 4/7] Update README.rst --- README.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ef4b221ce..62e5f8682 100644 --- a/README.rst +++ b/README.rst @@ -141,6 +141,8 @@ Fix the error by executing the following command: You may get a problem while installing for Python 3.3+ as an official version has not yet been released. +Try and install an unofficial binary from :: - Try and install an unofficial binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml + + http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml From 1c6eb87a95c8c382e1e36167bb8233a9839eb514 Mon Sep 17 00:00:00 2001 From: Hrishikesh Sathe Date: Sat, 28 Jun 2014 20:13:53 +0530 Subject: [PATCH 5/7] Added Usage info of -v for version Also added troubleshooting for windows and python 3.3+ lxml errors. Added the [-C](clear cache) parameter in the usage info ( it was missing ) --- README.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 62e5f8682..371909e14 100644 --- a/README.rst +++ b/README.rst @@ -86,7 +86,7 @@ Usage :: - usage: howdoi.py [-h] [-p POS] [-a] [-l] [-c] [-n NUM_ANSWERS] QUERY [QUERY ...] + usage: howdoi.py [-h] [-p POS] [-a] [-l] [-c] [-n NUM_ANSWERS] [-C] [-v] QUERY [QUERY ...] instant coding answers via the command line @@ -102,6 +102,8 @@ Usage -n NUM_ANSWERS, --num-answers NUM_ANSWERS number of answers to return -C, --clear-cache clear the cache + -v, --version displays the current version of howdoi + Author ------ @@ -140,8 +142,8 @@ Fix the error by executing the following command: sudo chmod -R go+w /Library/Python/2.7/site-packages/ -You may get a problem while installing for Python 3.3+ as an official version has not yet been released. -Try and install an unofficial binary from +An official lxml for python 3.3+ for windows has not yet been released. You may get an error while installing. +Try and install an unofficial binary for lxml from :: From 034bddd1fc66f98c37f08887ffe1217588c332e7 Mon Sep 17 00:00:00 2001 From: Hrishikesh Sathe Date: Mon, 30 Jun 2014 18:35:38 +0530 Subject: [PATCH 6/7] Update howdoi.py --- howdoi/howdoi.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/howdoi/howdoi.py b/howdoi/howdoi.py index fbd3a0886..2e5f234ff 100755 --- a/howdoi/howdoi.py +++ b/howdoi/howdoi.py @@ -16,8 +16,7 @@ import requests import requests_cache import sys -sys.path.append('howdoi') -from __init__ import __version__ +from . import __version__ try: from urllib.parse import quote as url_quote @@ -231,7 +230,7 @@ def get_parser(): parser.add_argument('-n','--num-answers', help='number of answers to return', default=1, type=int) parser.add_argument('-C','--clear-cache', help='clear the cache', action='store_true') - parser.add_argument('-v','--version',help='displays the current version of howdoi',action='store_true') + parser.add_argument('-v','--version', help='displays the current version of howdoi', action='store_true') return parser From f5c25a4bd8d03ce5de79c1bab59360ed9b9e224a Mon Sep 17 00:00:00 2001 From: Hrishikesh Sathe Date: Mon, 30 Jun 2014 19:12:46 +0530 Subject: [PATCH 7/7] Update howdoi.py Edited to keep it consistent with original style. --- howdoi/howdoi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/howdoi/howdoi.py b/howdoi/howdoi.py index 2e5f234ff..03020ba16 100755 --- a/howdoi/howdoi.py +++ b/howdoi/howdoi.py @@ -230,7 +230,8 @@ def get_parser(): parser.add_argument('-n','--num-answers', help='number of answers to return', default=1, type=int) parser.add_argument('-C','--clear-cache', help='clear the cache', action='store_true') - parser.add_argument('-v','--version', help='displays the current version of howdoi', action='store_true') + parser.add_argument('-v','--version', help='displays the current version of howdoi', + action='store_true') return parser