Applied the corresponding changes to command files. AMakes it possible to declare and use additional parser inside subparsers. May be useful for tag command. Will be implemented in texnote plugin.
21 lines
553 B
Python
21 lines
553 B
Python
import webbrowser
|
|
import urllib
|
|
|
|
|
|
def parser(subparsers):
|
|
parser = subparsers.add_parser('websearch',
|
|
help="launch a search on Google Scholar")
|
|
parser.add_argument("search_string", nargs = '*',
|
|
help="the search query (anything googly is possible)")
|
|
return parser
|
|
|
|
|
|
def command(args):
|
|
|
|
ui = args.ui
|
|
search_string = args.search_string
|
|
|
|
url = ("https://scholar.google.fr/scholar?q=%s&lr="
|
|
% (urllib.quote_plus(' '.join(search_string))))
|
|
webbrowser.open(url)
|