Replace clipext.resolve with pipeable.input(split_lines=False).
This commit is contained in:
parent
f2003beabf
commit
02518a96a3
5 changed files with 11 additions and 19 deletions
2
cup.py
2
cup.py
|
@ -2,5 +2,5 @@ import pyperclip
|
|||
|
||||
from voussoirkit import pipeable
|
||||
|
||||
text = '\n'.join(pipeable.input('!i'))
|
||||
text = pipeable.input('!i', split_lines=False)
|
||||
pyperclip.copy(text)
|
||||
|
|
|
@ -7,11 +7,10 @@ Repeat the input as many times as you want.
|
|||
import argparse
|
||||
import sys
|
||||
|
||||
from voussoirkit import clipext
|
||||
from voussoirkit import pipeable
|
||||
|
||||
def repeat_argparse(args):
|
||||
text = clipext.resolve(args.text)
|
||||
text = pipeable.input(args.text, split_lines=False)
|
||||
if args.times == 'inf':
|
||||
try:
|
||||
while True:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import argparse
|
||||
import inspect
|
||||
import itertools
|
||||
import os
|
||||
import re
|
||||
|
@ -10,7 +11,6 @@ try:
|
|||
except ImportError:
|
||||
winshell = None
|
||||
|
||||
from voussoirkit import clipext
|
||||
from voussoirkit import expressionmatch
|
||||
from voussoirkit import pathclass
|
||||
from voussoirkit import pipeable
|
||||
|
@ -38,7 +38,6 @@ class HeaderedText:
|
|||
def with_header(self):
|
||||
return f'{self.header}: {self.text}'
|
||||
|
||||
|
||||
def all_terms_match(search_text, terms, match_function):
|
||||
matches = (
|
||||
(not terms['yes_all'] or all(match_function(search_text, term) for term in terms['yes_all'])) and
|
||||
|
@ -170,7 +169,7 @@ def search(
|
|||
recurse=not local_only,
|
||||
yield_directories=True,
|
||||
)
|
||||
elif isinstance(text, (list, tuple)):
|
||||
elif isinstance(text, (list, tuple)) or inspect.isgenerator(text):
|
||||
search_objects = text
|
||||
else:
|
||||
search_objects = text.splitlines()
|
||||
|
@ -217,9 +216,9 @@ def search(
|
|||
def argparse_to_dict(args):
|
||||
text = args.text
|
||||
if text is not None:
|
||||
text = clipext.resolve(text)
|
||||
text = pipeable.input(text)
|
||||
elif STDIN_MODE == 'pipe':
|
||||
text = clipext.resolve('!i')
|
||||
text = pipeable.multi_line_input()
|
||||
|
||||
if hasattr(args, 'content_args') and args.content_args is not None:
|
||||
content_args = argparse_to_dict(args.content_args)
|
||||
|
|
|
@ -69,7 +69,9 @@ def tempeditor(initial_text=None):
|
|||
raise BadStatus(subproctools.format_command(command), status)
|
||||
|
||||
def tempeditor_argparse(args):
|
||||
initial_text = '\n'.join(pipeable.input(args.initial_text)) if args.initial_text else None
|
||||
if args.initial_text is not None:
|
||||
initial_text = pipeable.input(args.initial_text, split_lines=False)
|
||||
|
||||
try:
|
||||
text = tempeditor(initial_text=initial_text)
|
||||
pipeable.stdout(text)
|
||||
|
|
|
@ -6,9 +6,8 @@ import threading
|
|||
import time
|
||||
|
||||
from voussoirkit import bytestring
|
||||
from voussoirkit import clipext
|
||||
from voussoirkit import downloady
|
||||
|
||||
from voussoirkit import pipeable
|
||||
|
||||
def clean_url_list(urls):
|
||||
for url in urls:
|
||||
|
@ -108,14 +107,7 @@ def threaded_dl(
|
|||
time.sleep(0.1)
|
||||
|
||||
def threaded_dl_argparse(args):
|
||||
if os.path.isfile(args.url_file):
|
||||
f = open(args.url_file, 'r')
|
||||
with f:
|
||||
urls = f.read()
|
||||
else:
|
||||
urls = clipext.resolve(args.url_file)
|
||||
urls = urls.replace('\r', '').split('\n')
|
||||
|
||||
urls = pipeable.input(args.url_file, read_files=True, skip_blank=True, strip=True)
|
||||
urls = [u.split(' ', 1) if ' ' in u else u for u in urls]
|
||||
|
||||
headers = args.headers
|
||||
|
|
Loading…
Reference in a new issue