Skip to content

Commit 3134f5b

Browse files
committed
rough edges here and there
1 parent 2223e03 commit 3134f5b

File tree

7 files changed

+25
-24
lines changed

7 files changed

+25
-24
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
__pycache__/
2+
MANIFEST
3+
build/
4+
dist/
5+

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright Pedro (c) 2014
3+
Copyright Pedro (c) 2015
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ For a modern, user friendly http client, check httpie. Or you can just use curl,
3636
* `SELECTOR`
3737
A css selector
3838

39-
* `-a ATTRIBUTE --attr=ATTRIBUTE`
40-
Outputs only the contents of the html ATTRIBUTE.
39+
* `-a ATTRIBUTE --attr=ATTRIBUTE`
40+
Outputs only the contents of the html ATTRIBUTE.
4141

4242
* `-t, --text`
4343
Outputs only the inner text of the selected elements.

doc/tq.1

+9-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,17 @@ Perform a css query with SELECTOR on an html document passed to the standard inp
4646
curl https://news\.ycombinator\.com/news | tq \-tj "\.title a"
4747
.
4848
.SS "Download a gallery of nice forest pictures from flickr"
49-
curl \-s \'https://www\.flickr\.com/photos/tgerus/galleries/72157622468645106/\' | tq "\.gallery\-photos img"
49+
.
50+
.nf
51+
52+
curl \-s \'https://www\.flickr\.com/photos/tgerus/galleries/72157622468645106/\' \e
53+
| tq " \.pc_img" \-a src \e
54+
| wget \-i
55+
.
56+
.fi
5057
.
5158
.SH "AUTHORS"
52-
\fBtq\fR was written by Pedro \fIpedro@example\.com\fR\.
59+
\fBtq\fR was written by Pedro \fIpedroghcode@gmail\.com\fR\.
5360
.
5461
.SH "DISTRIBUTION"
5562
The latest version of tq may be downloaded from https://github\.com/plainas/tq

doc/tq.1.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ curl https://news.ycombinator.com/news | tq -tj ".title a"
4545

4646
### Download a gallery of nice forest pictures from flickr
4747

48-
curl -s 'https://www.flickr.com/photos/tgerus/galleries/72157622468645106/' | tq ".gallery-photos img"
48+
curl -s 'https://www.flickr.com/photos/tgerus/galleries/72157622468645106/' \
49+
| tq " .pc_img" -a src \
50+
| wget -i
4951

5052

5153
## AUTHORS
5254

53-
`tq` was written by Pedro <pedro@example.com>.
55+
`tq` was written by Pedro <pedroghcode@gmail.com>.
5456

5557
## DISTRIBUTION
5658
The latest version of tq may be downloaded from https://github.com/plainas/tq

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name='tq',
7-
version='0.1',
7+
version='0.1.0',
88
description='comand line css selector',
99
author='Pedro',
1010
author_email='[email protected]',

tq/__init__.py

+4-16
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
curl https://www.flashback.org/| ./tq.py -Jt ".td_forum"
44
55
Test unicode input
6-
curl https://news.ycombinator.com/news| ./tq.py -Jt ".title a"
6+
curl https://news.ycombinator.com/news | ./tq.py -Jt ".title a"
77
8-
curl https://www.flashback.org/t2494391| ./tq.py -j ".post_message"
8+
curl https://www.flashback.org/t2494391 | ./tq.py -j ".post_message"
99
1010
"""
1111

1212
#TODO: use add_mutually_exclusive_group()
13-
#TODO: help2man proved ineficient. Copy and import this script and use it. Instructions are in the source, pretty straight forward
14-
15-
#https://github.com/pwman3/pwman3/blob/d718a01fa8038893e42416b59cdfcda3935fe878/build_manpage.py
16-
1713

1814
import sys
1915
from bs4 import BeautifulSoup
@@ -22,9 +18,9 @@
2218
import codecs
2319
import io
2420

25-
version = "0.0.1"
21+
version = "0.1.0"
22+
2623

27-
#parser = argparse.ArgumentParser(description="Performs a css selection on an HTML document.", prog= "TQ", usage='curl url | tq [options]')
2824
parser = argparse.ArgumentParser(description="Performs a css selection on an HTML document.", prog= "tq")
2925
parser.add_argument("selector", help="A css selector")
3026
parser.add_argument("-t", "--text", action="store_true", help="Outputs only the inner text of the selected elements.")
@@ -37,14 +33,6 @@
3733

3834
args = parser.parse_args()
3935

40-
41-
def get_parser(formatter_class=argparse.HelpFormatter):
42-
"""
43-
this is here just to be picked up by build_manpage
44-
"""
45-
return parser
46-
47-
4836
def main():
4937

5038
if args.version:

0 commit comments

Comments
 (0)