xaizek / pipedial (License: GPLv3 only) (since 2019-01-08)
One more tool for selecting something in console.
Commit ece70b3af838304bda33b3dea61c226f96f7e103

Add prompt history saving and loading
Having it in a separate class might be useful.
Author: xaizek
Author date (UTC): 2019-03-23 11:56
Committer name: xaizek
Committer date (UTC): 2019-03-23 11:56
Parent(s): 244fc0749516e4944bf8db6034de070a2ec3d879
Signing key: 99DC5E4DB05F6BE2
Tree: cf96cbd47730ce83a6a5ae2b0913fc4b2b374e99
File Lines added Lines deleted
src/PromptRequest.cpp 12 0
src/PromptRequest.hpp 6 0
File src/PromptRequest.cpp changed (mode: 100644) (index f64c351..80efa15)
... ... private:
69 69
70 70 } }
71 71
72 void
73 PromptRequest::loadHistory(const std::string &path)
74 {
75 static_cast<void>(read_history(path.c_str()));
76 }
77
78 void
79 PromptRequest::saveHistory(const std::string &path)
80 {
81 static_cast<void>(write_history(path.c_str()));
82 }
83
72 84 PromptResult::PromptResult() : hasInput(false) PromptResult::PromptResult() : hasInput(false)
73 85 { } { }
74 86
File src/PromptRequest.hpp changed (mode: 100644) (index aa6dc60..f75531b)
... ... public:
75 75 PromptRequest & operator=(const PromptRequest &rhs) = delete; PromptRequest & operator=(const PromptRequest &rhs) = delete;
76 76 PromptRequest & operator=(PromptRequest &&rhs) = delete; PromptRequest & operator=(PromptRequest &&rhs) = delete;
77 77
78 public:
79 // Loads history from the file.
80 static void loadHistory(const std::string &path);
81 // Stores history to the file.
82 static void saveHistory(const std::string &path);
83
78 84 public: public:
79 85 // Sets callback to be invoked when input is changed. // Sets callback to be invoked when input is changed.
80 86 void setOnInputChanged(inputChangedFunc newOnInputChanged); void setOnInputChanged(inputChangedFunc newOnInputChanged);
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/pipedial

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/pipedial

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master