Skip to content

Commit

Permalink
Formatting & coding style format
Browse files Browse the repository at this point in the history
  • Loading branch information
thmahe committed Sep 18, 2024
1 parent 9f5b4ca commit fe17498
Showing 1 changed file with 38 additions and 39 deletions.
77 changes: 38 additions & 39 deletions uuu/uuu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,32 +177,32 @@ void print_help(bool detail = false)
{
const char help[] =
"uuu [-d -m -v -V -bmap -no-bmap] <" "bootloader|cmdlists|cmd" ">\n\n"
" bootloader download bootloader to board by usb\n"
" cmdlist run all commands in cmdlist file\n"
" If it is path, search uuu.auto in dir\n"
" If it is zip, search uuu.auto in zip\n"
" cmd Run one command, use -H see detail\n"
" example: SDPS: boot -f flash.bin\n"
" -d Daemon mode, wait for forever.\n"
" -v -V verbose mode, -V enable libusb error\\warning info\n"
" -dry Dry run mode, check if script or cmd correct \n"
" -bmap Try using .bmap files even if flash commands do not specify them\n"
" -no-bmap Ignore .bmap files even if flash commands specify them\n"
" -m USBPATH Only monitor these paths.\n"
" -m 1:2 -m 1:3\n\n"
" -ms serial_no Monitor the serial number prefix of the device using 'serial_no'.\n"
" -t Timeout second for wait known usb device appeared\n"
" -T Timeout second for wait next known usb device appeared at stage switch\n"
" -e set environment variable key=value\n"
" -pp usb polling period in milliseconds\n"
" -dm disable small memory\n"
"uuu -s Enter shell mode. uuu.inputlog record all input commands\n"
" you can use \"uuu uuu.inputlog\" next time to run all commands\n\n"
"uuu -udev linux: show udev rule to avoid sudo each time \n"
"uuu -lsusb List connected know devices\n"
"\tbootloader download bootloader to board by usb\n"
"\tcmdlist\t run all commands in cmdlist file\n"
"\t\t\t\tIf it is path, search uuu.auto in dir\n"
"\t\t\t\tIf it is zip, search uuu.auto in zip\n"
"\tcmd\t\t Run one command, use -H see detail\n"
"\t\t\t\texample: SDPS: boot -f flash.bin\n"
"\t-d\t\t Daemon mode, wait for forever.\n"
"\t-v -V\t verbose mode, -V enable libusb error\\warning info\n"
"\t-dry\t\tDry run mode, check if script or cmd correct \n"
"\t-bmap\t Try using .bmap files even if flash commands do not specify them\n"
"\t-no-bmap\tIgnore .bmap files even if flash commands specify them\n"
"\t-m\t\t USBPATH Only monitor these paths.\n"
"\t\t\t\t\t-m 1:2 -m 1:3\n\n"
"\t-ms\t\t serial_no Monitor the serial number prefix of the device using 'serial_no'.\n"
"\t-t\t\t Timeout second for wait known usb device appeared\n"
"\t-T\t\t Timeout second for wait next known usb device appeared at stage switch\n"
"\t-e\t\t set environment variable key=value\n"
"\t-pp\t\t usb polling period in milliseconds\n"
"\t-dm\t\t disable small memory\n"
"uuu -s\t\t Enter shell mode. uuu.inputlog record all input commands\n"
"\t\t\t\tyou can use \"uuu uuu.inputlog\" next time to run all commands\n\n"
"uuu -udev\t linux: show udev rule to avoid sudo each time \n"
"uuu -lsusb\t List connected know devices\n"
"uuu -IgSerNum Set windows registry to ignore USB serial number for known uuu devices\n"
"uuu -h show general help\n"
"uuu -H show general help and detailed help for commands\n\n";
"uuu -h\t\t show general help\n"
"uuu -H\t\t show general help and detailed help for commands\n\n";
printf("%s", help);
printf("uuu [-d -m -v -bmap -no-bmap] -b[run] ");
g_BuildScripts.ShowCmds();
Expand Down Expand Up @@ -315,7 +315,7 @@ string build_process_bar(size_t width, size_t pos, size_t total)

string_ex per;
per.format("%d%%", pos * 100 / total);

size_t start = (width - per.size()) / 2;
str.replace(start, per.size(), per);
str.insert(start, g_vt_yellow);
Expand All @@ -325,8 +325,8 @@ string build_process_bar(size_t width, size_t pos, size_t total)

void print_auto_scroll(string str, size_t len, size_t start)
{
g_max_process_width = max(str.size(), g_max_process_width);
g_max_process_width = min(g_max_process_width, len);
g_max_process_width = max(str.size(), g_max_process_width);
g_max_process_width = min(g_max_process_width, len);
if (str.size() <= len)
{
str.resize(g_max_process_width, ' ');
Expand All @@ -339,12 +339,12 @@ void print_auto_scroll(string str, size_t len, size_t start)
else
start = 0;

if (str.size() >= len){
str.resize(len - 1);
str[str.size() - 1] = '.';
str[str.size() - 2] = '.';
str[str.size() - 3] = '.';
}
if (str.size() >= len){
str.resize(len - 1);
str[str.size() - 1] = '.';
str[str.size() - 2] = '.';
str[str.size() - 3] = '.';
}

string s = str.substr(start, len);
s.resize(len, ' ');
Expand Down Expand Up @@ -445,7 +445,7 @@ class ShowNotify
m_trans_pos = nt.index;
return true;
}

if ((nt.index - m_trans_pos) < (m_trans_size / 100)
&& nt.index != m_trans_size)
return false;
Expand Down Expand Up @@ -602,10 +602,9 @@ void print_oneline(string str)
if (w <= 3)
return;

if (g_max_process_width == 0){
g_max_process_width = str.size();
g_max_process_width = min(g_max_process_width, w);
}
if (g_max_process_width == 0){
g_max_process_width = min(str.size(), w);
}

if (str.size() >= w)
{
Expand Down

0 comments on commit fe17498

Please sign in to comment.