Open
Conversation
ArtyomLobanov
suggested changes
Mar 20, 2019
ArtyomLobanov
left a comment
There was a problem hiding this comment.
- Интересная характеристика
В целом все прикольно
- Сообщения об ошибках можно было бы и информативнее сделать
>cd olo
File not found error
>cd build.gradle
File not found error- Адаптируйте внешние команды к своему пониманию рабочей директории
>cd ../../..
>pwd
C:\practice
# В этой папке нет git репозитория
>git status
On branch cdls
Your branch is up-to-date with 'origin/cdls'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
bash.iml
nothing added to commit but untracked files present (use "git add" to track)| * @return full path | ||
| */ | ||
| fun getPath(path: String): String { | ||
| return getFile(path).canonicalPath |
There was a problem hiding this comment.
Работать с путями как со строками в 2k19 довольно странно - есть Path
| File(path).canonicalFile | ||
| } else { | ||
| File(curDir, path).canonicalFile | ||
| } |
There was a problem hiding this comment.
А в Path эта логика уже реализована (Path.resolve)
| val path = arguments.getOrElse(0) { "./" } | ||
|
|
||
| if (!env.updateDir(path)) { | ||
| output.write("File not found error") |
There was a problem hiding this comment.
Не надо смешивать вывод команд и сообщения об ошибках. Бросайте исключения
| return | ||
| } | ||
|
|
||
| val path = arguments.getOrElse(0) { "./" } |
There was a problem hiding this comment.
В bash если cd не передать аргументов, то рабочая директория меняется на домашнюю
Author
|
@ArtyomLobanov подправил, работает |
|
Добавьте зависимость от JUint в build.gradle |
Author
|
Хм, у меня заработало, я наверное подумал что он есть в исходнике |
Author
|
добавил |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
В целом все прикольно, пришлось добавить смену директории в окружении, но это действительно не требовалось в исходной задаче, можно было бы до бесконечности бы писать "на всякий случай".
Но раз это добавилось, то легко увидеть, что на самом деле почти все команды(кроме echo, и то это только в рамках задачи опять же), должны иметь возможность обращаться к своему окружению, поэтому я не делал бы дополнительную абстракцию с environment command.
Понравилось, что команду делать легко - добавить в фабрику и дописать класс, также понравилось что есть отдельный класс для окружения и предусмотрено, что команды должны о нем знать.
Моментов, которые не понравились, нет в общем то, у меня добавление команд затруднений и лишней работы не вызвало, разве что в cat есть какие-то проблемы кажется.