-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgoogleterm
More file actions
27 lines (22 loc) · 889 Bytes
/
Copy pathgoogleterm
File metadata and controls
27 lines (22 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
import sys
from optparse import OptionParser
parser = OptionParser(
version=" %prog V0.1 Hari Poudel",
description = "%prog - google results in the terminal.",
usage = "%prog [-vr] [--view] [--results][--help] [--version]")
parser.add_option("-r","--results",action="store",type = "int",dest="results",help="display specified number of results, default is 10." )
parser.add_option("-v","--view",action="store",type = "int",dest="view",help="view page by index number." )
(options,args) = parser.parse_args()
if options.view != None: #opens selected entry in browser, then exit
file = open("/tmp/google",'r')
text = file.readlines()
counter = 1
for lines in text:
if counter == options.view:
from subprocess import call
call("w3m %s" % lines, shell = True)
sys.exit(0)
counter += 1
print "loading..."
option = ""