Skip to content

Commit

Permalink
Merge pull request #1 from gautamkrishnar/master
Browse files Browse the repository at this point in the history
merge_update#1
  • Loading branch information
kumarankit0411 authored Nov 27, 2016
2 parents e65ad7f + 591aa9e commit 89f72eb
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dist/
socli.egg-info/
socli/__pycache__/
docs/
*.pyc
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SoCLI [![PyPI version](https://badge.fury.io/py/socli.svg)](https://badge.fury.io/py/socli) [![Build Status](https://travis-ci.org/gautamkrishnar/socli.svg?branch=master)](https://travis-ci.org/gautamkrishnar/socli)
# SoCLI [![PyPI version](https://badge.fury.io/py/socli.svg)](https://badge.fury.io/py/socli) [![Build Status](https://travis-ci.org/gautamkrishnar/socli.svg?branch=master)](https://travis-ci.org/gautamkrishnar/socli)
Stack overflow command line written in python. Using SoCLI you can search and browse stack overflow without leaving the terminal. Just use the **socli** command:

![SoCLI in action](https://cloud.githubusercontent.com/assets/8397274/16355211/ae134c66-3acd-11e6-807f-adb8f3bbcf44.gif)
Expand All @@ -20,6 +20,11 @@ sudo apt-get install python python-pip
sudo pip install socli
```
##### For Windows
###### Method 1 (Using Installer)
Download and install the latest release of [SoCLI-Setup.exe](https://github.com/gautamkrishnar/socli/releases/latest/) for windows. It is a self contained package with all the required dependencies.
Add SoCLI directory to windows path. See [this page](http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path) for more info. If you are running 64bit version of windows add `C:\Program Files (x86)\SoCLI` to the path, else add `C:\Program Files\SoCLI` to the path. This method doesn't support the command line updating of SoCLI, you must manually uninstall the program and reinstall the new versions.

###### Method 2 (Using PIP)
[Download and install python](https://www.python.org/downloads/). Dont forget to check the option "Add to path".

Open a command prompt with administrative privileges and use **pip** command to install **socli**:
Expand Down Expand Up @@ -99,7 +104,7 @@ Usage: socli [ Arguments] < Search Query >
| -q | --query | Used to specify the query when arguments are used. A query value must be passed to it. If it is used alone (socli -q query) then it will display the same result as "socli query". | socli -i -q query |
| -i | --interactive | Used to search interactively. It doesnt take any values. It must be followed by a -q or --query after it. | socli -i -q query |
| -r | --res | Used for manual search. It takes the question number as the argument and it must be followed by a -q or --query after it. | socli -r 4 -q query |
| -t | --tag | Specifies the tag to search for the query on stack overflow. It must be followed by a -q or --query after it. | socli -new js -q query |
| -t | --tag | Specifies the tag to search for the query on stack overflow. It must be followed by a -q or --query after it. | socli -t js -q query |
| -n | --new | Opens the web browser to create a new question on stack overflow. | socli --new |
| -h | --help | Displays the help text. | socli --help |
Expand All @@ -116,6 +121,13 @@ These are the amazing features of **socli**:
* Can open the page in a browser
* Can create a new question via the web browser
### To Do
Command line interface for:
- [ ] Stack overflow authentication
- [ ] Posting to stack overflow
- [ ] Upvote answer
- [ ] Comment on an answer
### Contributing
If you are willing to contribute to SoCLI project, You are awesome! Just follow the steps below:
Expand All @@ -142,6 +154,7 @@ Special thanks to these superheroes:
* [mwwynne](https://github.com/mwwynne) for adding links to the SoCLI
* [Carlos J. Puga Medina](https://github.com/cpu82) for finding the bug [#11](https://github.com/gautamkrishnar/socli/issues/14) on SoCLI python2 version and for making [SoCLI freshports port](https://www.freshports.org/misc/py-socli/)
* [Jon Ericson](https://github.com/jericson) (*Community Manager, Stack Overflow*) for the PR [#18](https://github.com/gautamkrishnar/socli/pull/18) and letting me know about the Stack overflow attribution policy. Thanks for the [blog post](http://jericson.github.io/2016/08/25/long_tail_docs.html)
* [Ankit Kr. Singh](https://github.com/kumarankit0411) Thanks for fixing some typos PR [#21](https://github.com/gautamkrishnar/socli/pull/21).
### Bugs
If you are experiencing any bugs, don’t forget to open a [new issue](https://github.com/gautamkrishnar/socli/issues/new).
Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# SoCLI Changelog
### 2.6
* Fixed some minor typos
* Added windows binary release

### 2.5
* Fixed some bugs due to latest windows cmd update
* Added sorting of question based on number of votes

### 2.4
* Added StackOverflow attribution

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
entry_points = {"console_scripts": ['socli = socli.socli:main']},
install_requires=['BeautifulSoup4','requests'],
requires=['BeautifulSoup4','requests'],
version='2.4',
version='2.6',
url='http://www.github.com/gautamkrishnar/socli',
keywords="stack overflow cli",
license='BSD',
Expand Down
20 changes: 11 additions & 9 deletions socli/socli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Global vars:
DEBUG = False # Set True for enabling debugging
soqurl = "http://stackoverflow.com/search?q=" # Query url
soqurl = "http://stackoverflow.com/search?tab=votes&q=" # Query url
sourl = "http://stackoverflow.com" # Site url
rn = -1 # Result number (for -r and --res)
ir = 0 # interactive mode off (for -i arg)
Expand Down Expand Up @@ -45,13 +45,15 @@ def supports_color():
plat = sys.platform
supported_platform = plat != 'Pocket PC' and (plat != 'win32' or 'ANSICON' in os.environ)
# To detect windows 10 cmd. Windows 10 cmd supports color by default
if os.name == "nt":
x = sys.getwindowsversion()[0]
if x == 10:
try:
test_shell = os.environ['SHELL'] # If running with a shell like cygwin this is set
except Exception:
return True
# Removed due to the latest windows 10 update. The command prompt no longer support color
#
# if os.name == "nt":
# x = sys.getwindowsversion()[0]
# if x == 10:
# try:
# test_shell = os.environ['SHELL'] # If running with a shell like cygwin this is set
# except Exception:
# return True
# isatty is not always implemented, #6223.
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
if not supported_platform or not is_a_tty:
Expand Down Expand Up @@ -169,7 +171,7 @@ def helpman():
print_header("\n\n< Search Query >:")
print("\n Query to search on Stack overflow")
print("\nIf no commands are specified then socli will search the stack "
"overfow and simply displays the first search result's "
"overflow and simply displays the first search result's "
"most voted answer.")
print("If a command is specified then it will work according to the "
"command.")
Expand Down

0 comments on commit 89f72eb

Please sign in to comment.