Skip to content

Conversation

Var7600
Copy link

@Var7600 Var7600 commented Jul 30, 2024

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.

Var7600 and others added 2 commits July 30, 2024 17:10
@wjandrea
Copy link
Owner

wjandrea commented Aug 7, 2024

Thanks, this is interesting, but I want to make colours optional so that what still works properly on terminals that don't support colour.


## COLOR
GREEN="\033[0;32m"
NORMAL="\033[0;00m"
Copy link
Owner

@wjandrea wjandrea Aug 7, 2024

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"
Copy link
Owner

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

# Print the *current* definition.
_What_indent 2
printf "definition: "
# shellcheck disable=SC2059
Copy link
Owner

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"


# 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.
Copy link
Owner

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?

@Var7600
Copy link
Author

Var7600 commented Aug 11, 2024

Thanks, this is interesting, but I want to make colours optional so that what still works properly on terminals that don't support colour.

so can i add a option like --color to output with colors?

@wjandrea
Copy link
Owner

so can i add a option like --color to output with colors?

Yeah, that'd work. Although, what uses getopts, so it'd have to be a single character like -c.

(Sorry for the delay. I missed your reply somehow.)

@Var7600
Copy link
Author

Var7600 commented Aug 20, 2024

so can i add a option like --color to output with colors?

Yeah, that'd work. Although, what uses getopts, so it'd have to be a single character like -c.

(Sorry for the delay. I missed your reply somehow.)

okay -c option i'm going to try base on your suggestions and reviews.

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