Skip to content

Commit

Permalink
Beautify the list split line
Browse files Browse the repository at this point in the history
  • Loading branch information
ophub committed Feb 18, 2023
1 parent d81d934 commit 4b6e3e8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
18 changes: 11 additions & 7 deletions build-armbian/armbian-files/common-files/usr/sbin/armbian-software
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,25 @@ show_software_list() {
# Check software status
check_software_status

# Define split line style
split_line="--------------------------------------------------------------"
# Show software list
echo "${software_database}" | awk -F ':' '{print $1,$2,$7,$8}' | while read line; do
# Add a header every 10 rows
[[ "$(echo ${line} | awk '{print $1}')" == *"1" ]] && {
printf "%-s\n" "--------------------------------------------------------------"
# Add a header for each software list category
[[ "$(echo ${line} | awk '{print $1}')" == *"01" ]] && {
printf "%-s\n" "${split_line}"
printf "%-5s %-25s %-15s %-15s\n" ID NAME STATE MANAGE
printf "%-s\n" "--------------------------------------------------------------"
printf "%-s\n" "${split_line}"
}
# Print software information
printf "%-5s %-25s %-15s %-15s\n" $(echo "${line}")
done
printf "%-s\n" "--------------------------------------------------------------"
#
# Add end split line
printf "%-s\n" "${split_line}"

# Display software options
echo -ne "${OPTIONS} Please Input Software ID: "
read software_id

# Check the validity of the selection
ret="$(search_software_model "${software_id}")"
[[ -z "${ret}" ]] && error_msg "Software ID [ ${software_id} ] was not found, exit!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,24 @@ search_aml_model() {
show_aml_model() {
echo -e "${STEPS} Start selecting device..."

printf "%-s\n" "--------------------------------------------------------------------------------------"
# Define split line style
split_line="--------------------------------------------------------------------------------------"
# Print header information
printf "%-s\n" "${split_line}"
printf "%-5s %-10s %-30s %-50s\n" ID SOC MODEL DTB
printf "%-s\n" "--------------------------------------------------------------------------------------"
printf "%-5s %-10s %-30s %-50s\n" $(echo "${model_database}" | grep -E "^[0-9]{1,3}:.*" | awk -F':' '{print $1,$3,$2,$4}')
printf "%-s\n" "${split_line}"
# Print device list
echo "${model_database}" | awk -F':' '{print $1,$3,$2,$4}' | while read line; do
# Print device information
printf "%-5s %-10s %-30s %-50s\n" $(echo "${line}")
# Add a split line every 10 lines
[[ "$(echo ${line} | awk '{print $1}')" == *"0" ]] && printf "%-s\n" "${split_line}"
done
# Print custom options and end split lines
printf "%-5s %-10s %-30s %-50s\n" 0 Other Customize Enter-custom-dtb-name
printf "%-s\n" "--------------------------------------------------------------------------------------"
printf "%-s\n" "${split_line}"

# Display device options
echo -ne "${OPTIONS} Please Input ID: "
read boxid
if [[ "${boxid}" -eq "0" ]]; then
Expand Down

0 comments on commit 4b6e3e8

Please sign in to comment.