Shell: rewrite the whole shell to use tokens instead of raw strings
tab completion is still running with raw strings and that has to be fixed in the future.
This commit is contained in:
36
userspace/programs/Shell/Input.h
Normal file
36
userspace/programs/Shell/Input.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <BAN/NoCopyMove.h>
|
||||
#include <BAN/String.h>
|
||||
#include <BAN/Optional.h>
|
||||
#include <BAN/Vector.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
|
||||
class Input
|
||||
{
|
||||
BAN_NON_COPYABLE(Input);
|
||||
BAN_NON_MOVABLE(Input);
|
||||
public:
|
||||
Input();
|
||||
|
||||
BAN::Optional<BAN::String> get_input(BAN::Optional<BAN::StringView> custom_prompt);
|
||||
|
||||
private:
|
||||
BAN::String parse_ps1_prompt();
|
||||
|
||||
private:
|
||||
BAN::String m_hostname;
|
||||
|
||||
BAN::Vector<BAN::String> m_buffers { 1, ""_sv };
|
||||
BAN::Vector<BAN::String> m_history;
|
||||
size_t m_buffer_index { 0 };
|
||||
size_t m_buffer_col { 0 };
|
||||
|
||||
BAN::Optional<ssize_t> m_tab_index;
|
||||
BAN::Optional<BAN::Vector<BAN::String>> m_tab_completions;
|
||||
size_t m_tab_completion_keep { 0 };
|
||||
|
||||
int m_waiting_utf8 { 0 };
|
||||
};
|
||||
Reference in New Issue
Block a user