Skip to content

Commit

Permalink
Swap arguments around
Browse files Browse the repository at this point in the history
  • Loading branch information
Sijmen Mulder authored and Sijmen Mulder committed Mar 22, 2012
1 parent 7dde688 commit a8b42e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ Command-line utility to perform XPath queries on HTML or XML documents.
Example
-------

$ htmlpath //a/@href somefile.html
$ htmlpath somefile.html //a/@href
http://foo.example.com

Usage
-----

usage: htmlpath [-h] expression [file]
usage: htmlpath [-h] [file] expression

positional arguments:
expression an XPath expression
file an HTML or XML file (defaults to stdin)
expression an XPath expression

optional arguments:
-h, --help show this help message and exit
Expand Down
4 changes: 2 additions & 2 deletions htmlpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from scrapy.selector import XPathSelector

parser = ArgumentParser(description = "Perform an XPath query on an HTML or XML document.")
parser.add_argument("expression",
help = "an XPath expression")
parser.add_argument("file",
help = "an HTML or XML file (defaults to stdin)",
nargs = "?",
type = FileType('r'),
default = sys.stdin)
parser.add_argument("expression",
help = "an XPath expression")

args = parser.parse_args()
response = TextResponse(args.file.name, body = args.file.read(), encoding = "utf-8")
Expand Down

0 comments on commit a8b42e6

Please sign in to comment.