Open nikochiko opened 4 years ago
I would like to do this if you alllow.
@nikochiko Is it okay if I make a new interface.py in evalai/util containing the parsed echo function or can you please suggest me the way it is wanted.
@ShubhamPandey28 I think these changes should go either along with or after the enhancements proposed in https://github.com/Cloud-CV/evalai-cli/issues/234 as this can make use of the additions proposed there. So it would be better if that issue is resolved first, and then we come to this.
For example, I was thinking of having a syntax like:
def error_style(message): # from 234 !?
return style(message, bold=True, fg="red")
def command_style(command): # from 234 !?
return style(command, bold=True, fg="cyan")
def prettify_error_with_command(message):
## incorporate both above methods here ##
# Usage:
echo(prettify_error_with_command(MESSAGE))
The approach mentioned in issue#234 recommends directly echoing the messages, which would make it harder to use both side-by-side.
What do you think? @ShubhamPandey28 @takitsuse cc: @vkartik97 @RishabhJain2018
@ShubhamPandey28 Yes, you are on the right track. Both changes should be made in the same file like interface.py
I think the mentors can help with the naming here. I was thinking formatting.py
or text_styling.py
. Something that can give a more clear idea of what we are trying to achieve here.
For printing things in multiple colors, @nikochiko's edit on proposal #234 looks reasonable. Sounds good to me👍
Current Behaviour:
When a command is to be shown in a message as a usage example, the current way is to use backticks (`) to enclose it. This is hard to read as the rest of the message is of the same color.![current-message](https://user-images.githubusercontent.com/37668193/71675237-59ef5e00-2da3-11ea-87d7-bb1901503b05.PNG)
Expected Behavior:
Use a different color for the commands and a different color for the rest of the message. This should be done by using a function to parse the string, fetch the substring within the backticks (`) and return a complete message as expected with the part in backticks being shown in a different color. That is:![proposed-behaviour](https://user-images.githubusercontent.com/37668193/71675388-ae92d900-2da3-11ea-8277-ea23d5a04c19.PNG)
As red, yellow, white and green are used for other types by convention, I think cyan (as shown above) can be a good choice.