-
Notifications
You must be signed in to change notification settings - Fork 2
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
adding color #4
base: main
Are you sure you want to change the base?
adding color #4
Conversation
added images showing output with colors
Thanks, this is interesting, but I want to make colours optional so that |
@@ -3,6 +3,10 @@ | |||
# | |||
# See functions "_usage" and "_help" for more details. | |||
|
|||
## COLOR | |||
GREEN="\033[0;32m" | |||
NORMAL="\033[0;00m" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0;00
is redundant. Just use 0
## COLOR | ||
GREEN="\033[0;32m" | ||
NORMAL="\033[0;00m" | ||
RED="\033[0;31m" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On source, these will be in the environment and could easily be overwritten. I would obfuscate them like the functions: _What_GREEN
etc
@@ -38,7 +43,8 @@ function _What_alias { ( | |||
if [[ $print_definition == true ]]; then | |||
# Print the *current* definition. | |||
_What_indent 2 | |||
printf "definition: " | |||
# shellcheck disable=SC2059 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason to do this when you can use %b
instead: printf "%bdefinition%b: " "$GREEN" "$NORMAL"
@@ -228,19 +236,20 @@ function _What_function { ( | |||
read -r _ attrs _ <<< "$(declare -pF -- "$function")" | |||
|
|||
# Find the source by turning on extended debugging. | |||
# Looping not required because only one definition exists at a time. | |||
# Looping not required because only one exists at a time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove? Is this just a typo?
so can i add a option like |
Yeah, that'd work. Although, (Sorry for the delay. I missed your reply somehow.) |
okay |
dded color RED for: keyword, builtin, alias/file, function, multiple
files/absolute symlinks, relative symlink
and color GREEN for the rest.
added output example with color for the README file.