Skip to content

Add a new command, Grep.#2

Open
natalymr wants to merge 4 commits intomasterfrom
grep
Open

Add a new command, Grep.#2
natalymr wants to merge 4 commits intomasterfrom
grep

Conversation

@natalymr
Copy link
Owner

Add a realization for grep.
Add tests for this command.

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Надо ешё обоснование выбора библиотеки --- какие рассматривались и почему выбрана именно эта.

И ещё шелл вообще заканчивает работу, если ввести что-нить вроде grep -A grep grep.py. Надо выдавать сообщение об ошибке и давать ввести следующую команду.

from colored_text import ANSI_RED, color_range


def grep(args: [str]) -> output_stream:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут тоже нужны комментарии

@natalymr
Copy link
Owner Author

@yurii-litvinov , поправила замечания. Посмотрите, пожалуйста.

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ага, теперь всё ок, зачтена

+ имеет необходимый набор функций для решения поставленной задачи, а именно
* есть возможность указания различных видов флагов (с аргументами и без)
* возможность указания переменного числа агрументов (ресурсы)
* неименнованные (позиционные) аргументы для паттерна и файлов No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если никаких больше библиотек не смотрели, это что-то вроде антипаттерна "Золотой молоток". Хотя для Питона выбор действительно более-менее очевиден.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants