Xontrib-pipeliner

Latest version: v0.5.0

Safety actively analyzes 688215 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 5

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

Remove traceback

0.4.4

Print repr line.

0.4.3

Better help:
xsh
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:
xsh
_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:
xsh
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:
xsh
$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

Page 1 of 5

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.