Releases: anki-code/xontrib-pipeliner
Releases · anki-code/xontrib-pipeliner
0.5.0
Presets update.
Usage: <command> | <command> | ... | pl "<Python code or preset name>"
Example: echo "123" | pl "line[::-1]"
Example: echo " 123 " | pl strip
Presets:
drop: Drop empty lines.
len: 'len(line)'
strip: 'line.strip()'
lstrip: 'line.lstrip()'
rstrip: 'line.rstrip()'
split: func
fromlist: Read python list representation and return the element by index.
lower: 'line.lower()'
upper: 'line.upper()'
title: 'line.title()'
startswith: func
endswith: func
0.4.5
0.4.4
0.4.3
Better help:
pl
# Error: Python code not found
# Usage: <command> | <command> | ... | pl "<Python code>"
# Example: echo "123" | pl "line[::-1]"
# Example: echo " 123 " | pl strip
# Presets:
# len: 'len(line)'
# strip: 'line.strip()'
# lstrip: 'line.lstrip()'
# rstrip: 'line.rstrip()'
# split: func
# list: func
# lower: 'line.lower()'
# upper: 'line.upper()'
# title: 'line.title()'
# startswith: func
# endswith: func
0.4.2
New preset list:
_default_presets = {
"len": "len(line)",
"strip": "line.strip()",
"lstrip": "line.lstrip()",
"rstrip": "line.rstrip()",
"split": lambda args: f"line.split({repr(args[0])})",
"list": lambda args: f"eval(line)[int({repr(args[0])})]",
"lower": "line.lower()",
"upper": "line.upper()",
"title": "line.title()",
"startswith": lambda args: f"line.startswith({repr(args[0])})",
"endswith": lambda args: f"line.endswith({repr(args[0])})",
}
0.4.1
Added presets.
Presets
There are default presets:
echo " 1" | pl strip
# 1
echo "1,2,3" | pl split ,
['1', '2', '3']
echo "a,b,c" | pl split , | pl list 0
# a
You can set your own presets:
$XONTRIB_PIPELINER_PRESETS = {
"upper": "line.upper()",
"repeat": lambda args: f"line*int({repr(args[0])})"
}
echo 'hello' | pl upper
# HELLO
echo 'hey \nhi ' | pl repeat 3
# hey hey hey
# hi hi hi