Describe the bug
A clear and concise description of what the bug is.
Setup
Please complete the following information along with version numbers, if applicable.
- OS Ubuntu 20.04
- Shell Bash (/bin/bash)
- Terminal Emulator MobaxTerm (lastest)
- Terminal Multiplexer None Utilized
Note: you might encounter rendering issues if your locale does not use
UTF-8 encoding. Please check your locale (locale on POSIX systems) to
see what encoding is being used by your system.
To Reproduce
Steps to reproduce the behavior:
- Create a bash array, in my case the array is initialized in the top level and declare -g.
- Push to the array via for loop using +=
- Utilize separator in my case I am using |
- Specify --header.foreground="###"
Source Code
Please include a minimum reproducible example to reproduce the behavior.
#!/bin/bash
# This was created as a means to reporting a bug to charm-bracelet/gum
# This will not include any sensitive data from the org.
# To be deleted after bug report resolved.
# First create/initialize array
declare -g gum_array
gum_array=()
# There are a couple of different ways we define the header, either by making it the first entry or by explicit --columns flag
function generate_gum_table() {
method="$1"
case $method in
"first")
printf "%s\n" "${gum_array[@]}" | gum table --separator="|" --print --columns="Account,User ID,Home Directory,Shell,Status" --border.foreground="240" --border="rounded" --header.background="240"
;;
"second")
printf "%s\n" "${gum_array[@]}" | printf "%s\n" "${gum_array[@]}" | gum table --separator="|" --print --border.foreground="240" --border="rounded" --header.background="240"
;;
*)
printf "%s\n" "${gum_array[@]}" | printf "%s\n" "${gum_array[@]}" | gum table --separator="|" --print --border.foreground="240" --border="rounded"
;;
esac
}
#
#
# Not sure what to use for sample data lets just make a passwd parser
thefile=$(cat /etc/passwd)
while IFS= read -r line; do
# Eval is the user currently locked? (as by their shell set to nologin)
if [[ $(echo $line | grep "/usr/sbin/nologin") ]]; then
gum_array+=( "$(echo "$line"| awk -F ':' '{print $1"|"$4"|"$6"|"$7"|Locked"}' | gum style --foreground="009")" )
else
gum_array+=( "$(echo "$line"| awk -F ':' '{print $1"|"$4"|"$6"|"$7"|Active"}' | gum style --foreground="002")" )
fi
done <<< $thefile
# Now we printout our arrays value and pipe it in as standard input to the gum table command structure.
# Bug #1 Header is set as the first row of the table, whereby traditionally it is (atleast in 99% of programs) what defines the columns..
gum style --foreground="006" "Here is the first table, as you can see I have set the columns explicitly, both in color and in location but they do not go where expected."
generate_gum_table "first" # The first method is where we define the columns for the table explicitly
# Set headers via stin, by shifting the tables definition +1 whilst also injecting thje header.
gum_array=(
"Account|User ID|Home Directory|Shell|Status"
"${gum_array[@]}"
)
gum style --foreground="006" "Here is the second table, as you can see I have relied on stin, both in color and in location but they do not go where expected."
generate_gum_table "second" # here we're going to rely on first entry.
# Bug #2, this is in bug #1 but we want to make sure it is adequately identified. The first row despite the clearly defined out color as 002 or 009 will show brighter with no header flags at all.
gum style --foreground="006" "Here is the third table, what I am trying show here is the color for the first row in the table is lighter, but I have not set the color to be brighter."
generate_gum_table # There will be a lighter shade of a color even through I defined it before stin.
gum style --foreground="006" "Thank you for your time, and looking forward to what you cook up!"
Please paste your example as a code block on the issue. Do not link to an external project. Your example should fit in a single file. Take a look at Bubble Tea examples for an idea on writing a small, but runnable program.
Expected behavior
A clear and concise description of what you expected to happen.
The headers are never correctly setup, for some reason the command is using row 1 as its header row instead of the actual header row.
The color for the first row is adjusted even through it was defined before hand.
Screenshots
Add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Looking forward to your response!
Describe the bug
A clear and concise description of what the bug is.
Setup
Please complete the following information along with version numbers, if applicable.
Note: you might encounter rendering issues if your locale does not use
UTF-8encoding. Please check your locale (localeon POSIX systems) tosee what encoding is being used by your system.
To Reproduce
Steps to reproduce the behavior:
Source Code
Please include a minimum reproducible example to reproduce the behavior.
Please paste your example as a code block on the issue. Do not link to an external project. Your example should fit in a single file. Take a look at Bubble Tea examples for an idea on writing a small, but runnable program.
Expected behavior
A clear and concise description of what you expected to happen.
The headers are never correctly setup, for some reason the command is using row 1 as its header row instead of the actual header row.
The color for the first row is adjusted even through it was defined before hand.
Screenshots
Add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Looking forward to your response!