diff options
author | 2014-07-25 10:08:21 -0700 | |
---|---|---|
committer | 2014-07-25 10:49:12 -0700 | |
commit | e9f870e25af2fb8bf2dfbf5c92faaff667fd4cc1 (patch) | |
tree | 9ff028b8fc75082a7b5a605ea04cbef8036a73b2 /builtin.cpp | |
parent | 317660c2fe71dbbb31c85aa313f669f55c2f8df7 (diff) |
Add support for history --merge to incorporate history changes from
other sessions.
Fixes #825
Diffstat (limited to 'builtin.cpp')
-rw-r--r-- | builtin.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin.cpp b/builtin.cpp index a7b173bb..ebfecc92 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -3512,6 +3512,7 @@ static int builtin_history(parser_t &parser, wchar_t **argv) bool search_prefix = false; bool save_history = false; bool clear_history = false; + bool merge_history = false; static const struct woption long_options[] = { @@ -3521,6 +3522,7 @@ static int builtin_history(parser_t &parser, wchar_t **argv) { L"contains", no_argument, 0, 'c' }, { L"save", no_argument, 0, 'v' }, { L"clear", no_argument, 0, 'l' }, + { L"merge", no_argument, 0, 'm' }, { L"help", no_argument, 0, 'h' }, { 0, 0, 0, 0 } }; @@ -3555,6 +3557,9 @@ static int builtin_history(parser_t &parser, wchar_t **argv) case 'l': clear_history = true; break; + case 'm': + merge_history = true; + break; case 'h': builtin_print_help(parser, argv[0], stdout_buffer); return STATUS_BUILTIN_OK; @@ -3584,6 +3589,11 @@ static int builtin_history(parser_t &parser, wchar_t **argv) return STATUS_BUILTIN_OK; } + if (merge_history) + { + history->incorporate_external_changes(); + } + if (search_history) { int res = STATUS_BUILTIN_ERROR; |