From f1588b94f2c1be9ffdf6991de166b32e975eefac Mon Sep 17 00:00:00 2001 From: Silas Kraume Date: Mon, 19 Feb 2024 00:25:43 +0100 Subject: [PATCH] changed stdin parameter --- cat_win/cat.py | 4 ++-- cat_win/const/argconstants.py | 6 +++--- cat_win/tests/test_argconstants.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cat_win/cat.py b/cat_win/cat.py index 2b540c40..12d9396d 100644 --- a/cat_win/cat.py +++ b/cat_win/cat.py @@ -18,7 +18,7 @@ from cat_win.const.argconstants import ALL_ARGS, ARGS_EDITOR, ARGS_WORDCOUNT, ARGS_WWORDCOUNT from cat_win.const.argconstants import ARGS_HELP, ARGS_NUMBER, ARGS_ENDS, ARGS_SQUEEZE from cat_win.const.argconstants import ARGS_REVERSE, ARGS_SUM, ARGS_BLANK, ARGS_FILES -from cat_win.const.argconstants import ARGS_INTERACTIVE, ARGS_NOCOL, ARGS_BINVIEW, ARGS_FILE_PREFIX +from cat_win.const.argconstants import ARGS_STDIN, ARGS_NOCOL, ARGS_BINVIEW, ARGS_FILE_PREFIX from cat_win.const.argconstants import ARGS_CLIP, ARGS_CHECKSUM, ARGS_DEC, ARGS_HEX, ARGS_BIN from cat_win.const.argconstants import ARGS_VERSION, ARGS_DEBUG, ARGS_CUT, ARGS_REPLACE, ARGS_DATA from cat_win.const.argconstants import ARGS_CCONFIG, ARGS_LLENGTH, ARGS_ONELINE, ARGS_PEEK @@ -1112,7 +1112,7 @@ def main(): for valid_url in valid_urls]) known_files.extend(list(temp_files.keys())) holder.set_temp_files_url(temp_files) - if holder.args_id[ARGS_INTERACTIVE]: + if holder.args_id[ARGS_STDIN]: piped_input = ''.join(stdinhelper.get_stdin_content(holder.args_id[ARGS_ONELINE])) temp_file = stdinhelper.write_file(piped_input, tmp_file_helper.generate_temp_file_name(), arg_parser.file_encoding) diff --git a/cat_win/const/argconstants.py b/cat_win/const/argconstants.py index 40b977f5..153d1d21 100644 --- a/cat_win/const/argconstants.py +++ b/cat_win/const/argconstants.py @@ -19,7 +19,7 @@ def __init__(self, short_form: str, long_form: str, arg_help: str, arg_id: int, ARGS_HELP, ARGS_NUMBER, ARGS_ENDS, ARGS_EDITOR, ARGS_SQUEEZE = range(0, 5) -ARGS_REVERSE, ARGS_SUM, ARGS_BLANK, ARGS_FILES, ARGS_INTERACTIVE = range(5, 10) +ARGS_REVERSE, ARGS_SUM, ARGS_BLANK, ARGS_FILES, ARGS_STDIN = range(5, 10) ARGS_CLIP, ARGS_CHECKSUM, ARGS_DEC, ARGS_HEX, ARGS_BIN = range(10, 15) ARGS_VERSION, ARGS_DEBUG, ARGS_CUT, ARGS_REPLACE, ARGS_DATA = range(15, 20) ARGS_CCONFIG, ARGS_LLENGTH, ARGS_ONELINE, ARGS_PEEK, ARGS_NOCOL = range(20, 25) @@ -75,8 +75,8 @@ def __init__(self, short_form: str, long_form: str, arg_help: str, arg_id: int, # different content types ArgConstant('-E', '--echo', 'handle every following parameter as stdin', ARGS_ECHO, show_arg_on_shell=False, section=4), - ArgConstant('-i', '--interactive', 'use stdin', - ARGS_INTERACTIVE, show_arg_on_shell=False, section=4), + ArgConstant('-', '--stdin', 'use stdin', + ARGS_STDIN, show_arg_on_shell=False, section=4), ArgConstant('-o', '--oneline', 'take only the first stdin-line', ARGS_ONELINE, section=4), ArgConstant('-U', '--url', 'display the contents of any provided url', diff --git a/cat_win/tests/test_argconstants.py b/cat_win/tests/test_argconstants.py index 9f6caf29..688e18fa 100644 --- a/cat_win/tests/test_argconstants.py +++ b/cat_win/tests/test_argconstants.py @@ -22,5 +22,5 @@ def test_no_concats(self): parameters = parameters_short_form + parameters_long_form for param in parameters: self.assertEqual(param[:1], '-') - if not param.startswith('--'): + if not param.startswith('--') and param != '-': self.assertEqual(len(param), 2)