mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
updated uuid libs
This commit is contained in:
@@ -51,16 +51,6 @@ size_t Shell::printf(const char * format, ...) {
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t Shell::printf(const __FlashStringHelper * format, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
size_t len = vprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t Shell::printfln(const char * format, ...) {
|
||||
va_list ap;
|
||||
|
||||
@@ -72,17 +62,6 @@ size_t Shell::printfln(const char * format, ...) {
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t Shell::printfln(const __FlashStringHelper * format, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
size_t len = vprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
len += println();
|
||||
return len;
|
||||
}
|
||||
|
||||
size_t Shell::vprintf(const char * format, va_list ap) {
|
||||
size_t print_len = 0;
|
||||
va_list copy_ap;
|
||||
@@ -101,64 +80,26 @@ size_t Shell::vprintf(const char * format, va_list ap) {
|
||||
return print_len;
|
||||
}
|
||||
|
||||
size_t Shell::vprintf(const __FlashStringHelper * format, va_list ap) {
|
||||
size_t print_len = 0;
|
||||
va_list copy_ap;
|
||||
|
||||
va_copy(copy_ap, ap);
|
||||
|
||||
int format_len = ::vsnprintf_P(nullptr, 0, reinterpret_cast<PGM_P>(format), ap);
|
||||
if (format_len > 0) {
|
||||
std::string text(static_cast<std::string::size_type>(format_len), '\0');
|
||||
|
||||
::vsnprintf_P(&text[0], text.capacity() + 1, reinterpret_cast<PGM_P>(format), copy_ap);
|
||||
print_len = print(text);
|
||||
}
|
||||
|
||||
va_end(copy_ap);
|
||||
return print_len;
|
||||
}
|
||||
|
||||
// modified by proddy
|
||||
void Shell::print_all_available_commands() {
|
||||
/*
|
||||
commands_->for_each_available_command(*this, [this](std::vector<std::string> & name, std::vector<std::string> & arguments) {
|
||||
CommandLine command_line{name, arguments};
|
||||
// TODO add back sorting of commands?
|
||||
|
||||
command_line.escape_initial_parameters(name.size());
|
||||
name.clear();
|
||||
arguments.clear();
|
||||
for (auto & available_command : available_commands()) {
|
||||
CommandLine command_line{available_command.name(), available_command.arguments()};
|
||||
|
||||
command_line.escape_initial_parameters(available_command.name().size());
|
||||
println(command_line.to_string(maximum_command_line_length()));
|
||||
});
|
||||
*/
|
||||
|
||||
// changed by proddy - sort the help commands
|
||||
std::list<std::string> sorted_cmds;
|
||||
|
||||
commands_->for_each_available_command(*this, [&](std::vector<std::string> & name, std::vector<std::string> & arguments) {
|
||||
CommandLine command_line{name, arguments};
|
||||
command_line.escape_initial_parameters(name.size());
|
||||
name.clear();
|
||||
arguments.clear();
|
||||
sorted_cmds.push_back(command_line.to_string(maximum_command_line_length()));
|
||||
});
|
||||
|
||||
sorted_cmds.sort();
|
||||
for (auto & cl : sorted_cmds) {
|
||||
// print(" ");
|
||||
println(cl);
|
||||
}
|
||||
}
|
||||
|
||||
void Shell::erase_current_line() {
|
||||
print(F("\033[0G\033[K"));
|
||||
print("\033[0G\033[K");
|
||||
}
|
||||
|
||||
void Shell::erase_characters(size_t count) {
|
||||
print(std::string(count, '\x08'));
|
||||
print(F("\033[K"));
|
||||
print("\033[K");
|
||||
}
|
||||
|
||||
} // namespace console
|
||||
|
||||
} // namespace uuid
|
||||
} // namespace uuid
|
||||
Reference in New Issue
Block a user