Name
jjcli - python module for command-line filter
Synopsys
jjcli skel ## a initial filter skeleton
jjcli ## manual
.
from jjcli import * ## re.* functions also imported
c=clfilter(opt="do:") ## options in c.opt (...if "-d" in c.opt:)
## autostrip (def=True)
## inplace (def=False)
## fs (for csvrow()) (def=",")
for line in c.input():... ## process one rstriped line at the time
for txt in c.slurp():... ## process one striped text at the time
## process txt ## (end of line spaces and \r also removed)
for par in c.paragraph():... ## process one striped paragraph at the time
for tup in c.csvrow():... ## process one csv row at the time
for tup in c.tsvrow():... ## process one tsv row at the time
c.lineno() ## line number
c.filelineno()
c.parno() ## paragraph number
c.fileparno()
c.filename() ## filename or "<stdin>"
c.nextfile()
c.isfirstline()
Description
jjcli is a opinied python module that tries to simplify the creation of unix filters. It is based on:
- getopt (for command line options and args)
- fileinput (for [files/stdin] arguments)
- re (regular expressions should be native)
- csv (for csv and tsv inputs)
- urllib.request (to deal with input argumens that are url)
- subprocess
Regular expressions
imports all functions from re.*
Use re.I re.X re.S for regexp flags
Subprocesses (qx, qxlines, qxsystem)
a=qx( "ls" )
for x in qxlines("find | grep '\.jpg$'"):
...
qxsystem("vim myfile")
Execute command return its stdout
qx(*x) : return subprocess.getoutput(x)
Execute command return its stdout lines
qxlines(*x) : return subprocess.getoutput(x).splitlines()
Execute command -- system
qxsystem(*x): subprocess.call(x,shell=True)
Other functions
slurpurlutf8(self,f)
filename = lambda s : F.filename() # inherited from fileinput
lineno = lambda s : F.lineno()
filelineno = lambda s : F.filelineno()
parno = lambda s : s.parno_ # paragraph number
fileparno = lambda s : s.fileparno_
nextfile = lambda s : F.nextfile()
isfirstline = lambda s : F.isfirstline()
close = lambda s : F.close()
Metadata
Release files for jjcli 0.1.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jjcli-0.1.14.tar.gz | 3.1 kB | Without provenance | Details for jjcli-0.1.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jjcli-0.1.14-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for jjcli-0.1.14-py2.py3-none-any.whl |
Total release size: 7.1 kB
Release files / jjcli-0.1.14.tar.gz
| Download URL | jjcli-0.1.14.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6859dbaee0e9b8c98903873a349b22af558aa1f6bbd9bef1005265eea2495ca3
|
|
BLAKE2b-256 checksum How to use checksums |
a5eef1d01b260eeeee3c28c09d709ee223ca365cc81114e3c10b22f2b247b21c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.23.0
|
Release files / jjcli-0.1.14-py2.py3-none-any.whl
| Download URL | jjcli-0.1.14-py2.py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7e1cc5d545c3358488240590a85fa413c8c646228df8386b0ca8741d2546d441
|
|
BLAKE2b-256 checksum How to use checksums |
edd48edb13bd14fe54f27beb78b8a1663848ed3273ca2ddd3637f7a2e705c181
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.23.0
|
Security for jjcli 0.1.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.