Skip to content
Snippets Groups Projects
Commit c41c32b4 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

maintain history file for aql

parent acea96a5
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -31,7 +31,12 @@ char * Prompt::stripwhite ( char * begin ) { ...@@ -31,7 +31,12 @@ char * Prompt::stripwhite ( char * begin ) {
return begin; return begin;
} }
   
Prompt::Prompt ( cli::Environment environment ) : m_prefix ( "> " ), m_environment ( std::move ( environment ) ) { Prompt::Prompt ( cli::Environment environment ) : m_prefix ( "> " ), m_history_file ( std::string ( std::getenv ( "HOME" ) ) + "/.aql" ), m_environment ( std::move ( environment ) ) {
read_history ( m_history_file.c_str ( ) );
}
Prompt::~Prompt ( ) {
write_history ( m_history_file.c_str ( ) );
} }
   
cli::Command::Result Prompt::run ( ) { cli::Command::Result Prompt::run ( ) {
......
...@@ -18,6 +18,7 @@ class Prompt { ...@@ -18,6 +18,7 @@ class Prompt {
Prompt & operator = ( Prompt && ) = delete; Prompt & operator = ( Prompt && ) = delete;
   
std::string m_prefix; std::string m_prefix;
std::string m_history_file;
   
cli::Environment m_environment; cli::Environment m_environment;
   
...@@ -25,6 +26,7 @@ class Prompt { ...@@ -25,6 +26,7 @@ class Prompt {
   
public: public:
Prompt ( cli::Environment environment ); Prompt ( cli::Environment environment );
~Prompt ( );
   
cli::Command::Result run ( ); cli::Command::Result run ( );
cli::Command::Result execute_line ( std::string line ); cli::Command::Result execute_line ( std::string line );
......
  • Owner

    Defaultni nazev by se mi vic libil .aql_history po vzoru souboru:

    .bash_history
    .sqlite_history
    .python_history
    .mysql_history
    .swipl-dir-history
    ...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment