Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Use different color for command usage examples within messages #243

Open
nikochiko opened this issue Jan 2, 2020 · 5 comments

Comments

@nikochiko
Copy link
Contributor

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

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

As red, yellow, white and green are used for other types by convention, I think cyan (as shown above) can be a good choice.

@ShubhamPandey28
Copy link

I would like to do this if you alllow.

@ShubhamPandey28
Copy link

@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.

@nikochiko
Copy link
Contributor Author

nikochiko commented Jan 5, 2020

@ShubhamPandey28 I think these changes should go either along with or after the enhancements proposed in #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

@nikochiko
Copy link
Contributor Author

nikochiko commented Jan 5, 2020

@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.

@hkmatsumoto
Copy link
Contributor

hkmatsumoto commented Jan 5, 2020

For printing things in multiple colors, @nikochiko's edit on proposal #234 looks reasonable. Sounds good to me👍

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

No branches or pull requests

3 participants