Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Beautify the list split line
Browse files Browse the repository at this point in the history
ophub committed Feb 18, 2023

Verified

This commit was signed with the committer’s verified signature.
jcubic Jakub T. Jankiewicz
1 parent 9962f8c commit 13b7f70
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
@@ -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!"
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 13b7f70

Please sign in to comment.