diff options
| author | Maxime Coste <mawww@kakoune.org> | 2025-02-19 22:03:56 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2025-02-19 23:02:03 +1100 |
| commit | f910d6cb657ff39df5c536929e4146f88acda93f (patch) | |
| tree | 451adb66d06cbb2353f0536febb01c048e6f4f24 /src/main.cc | |
| parent | eb7d34333b0698e8e1a8af4f2be908ab08cb2089 (diff) | |
Move command/filename completion logic to completion.cc
Refactor list_files to use a callback instead of returning a vector,
file.cc/hh should not know about completion logic.
Diffstat (limited to 'src/main.cc')
| -rw-r--r-- | src/main.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.cc b/src/main.cc index 0d70bd6a..e95725ec 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1154,14 +1154,16 @@ int main(int argc, char* argv[]) const bool clear_sessions = (bool)parser.get_switch("clear"); if (list_sessions or clear_sessions) { - for (auto& session : list_files(session_directory())) - { + list_files(session_directory(), [&](StringView session, auto&) { + if (session.substr(0_byte, 1_byte) == ".") + return; + const bool valid = check_session(session); if (list_sessions) write_stdout(format("{}{}\n", session, valid ? "" : " (dead)")); if (not valid and clear_sessions) unlink(session_path(session).c_str()); - } + }); return 0; } |
