ImTerm
ImTerm copied to clipboard
missing imports and command outputs not showing up
when I tried to include your project into mine, I couldn't compile it since you used std::shared_ptr without including the memory header (I have no idea if it's because you used C++17 and that I'm using C++23) so I just took the headers and put them into my project to fix them manually and after I got it working, when I enter commands, nothing appears and when I try to click any of the checkboxes (autoscroll and autowrap) or if I try to select any of the log level options, it doesn't do anything I used the ImGui docking branch.
The main loop
ImTerm::terminal<Command> terminal_log;
terminal_log.set_min_log_level(ImTerm::message::severity::info);
terminal_log.set_flags(ImGuiWindowFlags_NoResize |
ImGuiWindowFlags_NoCollapse |
ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoSavedSettings |
ImGuiWindowFlags_NoBringToFrontOnFocus |
ImGuiWindowFlags_NoNavFocus |
ImGuiWindowFlags_NoDocking |
ImGuiWindowFlags_NoSavedSettings);
terminal_log.set_size(ImVec2((float)g_width, (float)g_height - 20));
terminal_log.show();
the Command class
#include "../imterm/terminal.hpp"
#include "../imterm/terminal_helpers.hpp"
class Command : public ImTerm::basic_terminal_helper<Command, void> {
public:
Command() {
for (const command_type& cmd : local_command_list) {
add_command_(cmd);
}
}
static std::vector<std::string> no_completion(argument_type&) { return {}; }
static void clear(argument_type&);
static void echo(argument_type&);
static void help(argument_type&);
static void whoami(argument_type&);
private:
constexpr static std::array<command_type, 5> local_command_list = {
command_type{"clear", "Clear the terminal", &Command::clear, &Command::no_completion},
command_type{"echo", "Echo the input", &Command::echo, &Command::no_completion},
command_type{"help", "Display help", &Command::help, &Command::no_completion},
command_type{"whoami", "Display the current user", &Command::whoami, &Command::no_completion}
};
};
each commands are defined in a separate C++ file