Skip to content

Commit

Permalink
Rename plugin from 'tui' to 'explore'
Browse files Browse the repository at this point in the history
  • Loading branch information
mavam committed Jun 14, 2023
1 parent 9d59585 commit 476f4d8
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
path = libvast/aux/caf
url = https://github.com/tenzir/actor-framework
[submodule "plugins/tui/aux/ftxui"]
path = plugins/tui/aux/ftxui
path = plugins/explore/aux/ftxui
url = https://github.com/ArthurSonzogni/FTXUI.git
16 changes: 8 additions & 8 deletions plugins/tui/CMakeLists.txt → plugins/explore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
cmake_minimum_required(VERSION 3.19...3.24 FATAL_ERROR)

project(
tui
DESCRIPTION "TUI plugin for VAST"
explore
DESCRIPTION "explore plugin for VAST"
LANGUAGES CXX)

include(CTest)

find_package(VAST REQUIRED)

file(GLOB_RECURSE tui_sources CONFIGURE_DEPENDS
file(GLOB_RECURSE explore_sources CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")

VASTRegisterPlugin(
TARGET tui
TARGET explore
ENTRYPOINT src/plugin.cpp
SOURCES ${tui_sources}
SOURCES ${explore_sources}
INCLUDE_DIRECTORIES include)

option(VAST_ENABLE_BUNDLED_FTXUI "Always use the bundled ftxui" OFF)
Expand All @@ -41,6 +41,6 @@ if (NOT ftxui_FOUND)
dependency_summary("ftxui" "${CMAKE_CURRENT_SOURCE_DIR}/aux/ftxui"
"Dependencies")
endif ()
target_link_libraries(tui PUBLIC vast::libvast vast::internal)
target_link_libraries(tui PUBLIC ftxui::screen ftxui::dom ftxui::component)

target_link_libraries(explore PUBLIC vast::libvast vast::internal)
target_link_libraries(explore PUBLIC ftxui::screen ftxui::dom ftxui::component)
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

#pragma once

#include "tui/ui_state.hpp"
#include "explore/ui_state.hpp"

#include <vast/fwd.hpp>
#include <vast/view.hpp>

#include <ftxui/component/component.hpp>
#include <ftxui/dom/elements.hpp>

namespace vast::plugins::tui {
namespace vast::plugins::explore {

/// Lifts an FTXUI element into a component.
template <class T>
Expand Down Expand Up @@ -81,4 +81,4 @@ auto Catch(std::function<bool(ftxui::Event)> on_event)
auto MainWindow(ftxui::ScreenInteractive* screen, ui_state* state)
-> ftxui::Component;

} // namespace vast::plugins::tui
} // namespace vast::plugins::explore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

#include <ftxui/dom/elements.hpp>

namespace vast::plugins::tui {
namespace vast::plugins::explore {

/// Renders the VAST logo.
ftxui::Element Vee();

} // namespace vast::plugins::tui
} // namespace vast::plugins::explore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <ftxui/dom/table.hpp>
#include <ftxui/screen/color.hpp>

namespace vast::plugins::tui {
namespace vast::plugins::explore {

/// The theme colors.
struct palette {
Expand Down Expand Up @@ -91,4 +91,4 @@ auto mocha() -> theme;
/// The default theme if the user doesn't adjust one.
const theme default_theme = mocha();

} // namespace vast::plugins::tui
} // namespace vast::plugins::explore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include "tui/theme.hpp"
#include "explore/theme.hpp"

#include <vast/table_slice.hpp>
#include <vast/type.hpp>
Expand All @@ -18,7 +18,7 @@
#include <unordered_map>
#include <vector>

namespace vast::plugins::tui {
namespace vast::plugins::explore {

struct table_state;
using table_state_ptr = std::shared_ptr<table_state>;
Expand All @@ -41,4 +41,4 @@ struct ui_state {
auto add(table_slice slice) -> void;
};

} // namespace vast::plugins::tui
} // namespace vast::plugins::explore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// SPDX-FileCopyrightText: (c) 2023 The VAST Contributors
// SPDX-License-Identifier: BSD-3-Clause

#include "tui/components.hpp"
#include "explore/components.hpp"

#include "tui/elements.hpp"
#include "tui/ui_state.hpp"
#include "explore/elements.hpp"
#include "explore/ui_state.hpp"

#include <vast/collect.hpp>
#include <vast/concept/printable/to_string.hpp>
Expand All @@ -24,7 +24,7 @@

#include <unordered_set>

namespace vast::plugins::tui {
namespace vast::plugins::explore {

using namespace ftxui;

Expand Down Expand Up @@ -438,4 +438,4 @@ auto MainWindow(ScreenInteractive* screen, ui_state* state) -> Component {
return Make<Impl>(screen, state);
};

} // namespace vast::plugins::tui
} // namespace vast::plugins::explore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// SPDX-FileCopyrightText: (c) 2023 The VAST Contributors
// SPDX-License-Identifier: BSD-3-Clause

#include "tui/elements.hpp"
#include "explore/elements.hpp"

namespace vast::plugins::tui {
namespace vast::plugins::explore {

using namespace ftxui;

Expand Down Expand Up @@ -41,4 +41,4 @@ auto Vee() -> Element {
return vbox(elements);
}

} // namespace vast::plugins::tui
} // namespace vast::plugins::explore
23 changes: 11 additions & 12 deletions plugins/tui/src/plugin.cpp → plugins/explore/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// SPDX-FileCopyrightText: (c) 2023 The VAST Contributors
// SPDX-License-Identifier: BSD-3-Clause

#include "tui/components.hpp"
#include "tui/ui_state.hpp"
#include "explore/components.hpp"
#include "explore/ui_state.hpp"

#include <vast/concept/parseable/vast/option_set.hpp>
#include <vast/concept/parseable/vast/pipeline.hpp>
Expand All @@ -22,11 +22,11 @@

#include <thread>

namespace vast::plugins::tui {
namespace vast::plugins::explore {

namespace {

/// The configuration for the `tui` operator.
/// The configuration for the `explore` operator.
struct configuration {
int width = 0;
int height = 0;
Expand Down Expand Up @@ -57,10 +57,9 @@ auto make_screen(const configuration& config) -> ftxui::ScreenInteractive {
return ScreenInteractive::FitComponent();
}

/// The *terminal user interface (tui)* operator.
class tui_operator final : public crtp_operator<tui_operator> {
class explore_operator final : public crtp_operator<explore_operator> {
public:
explicit tui_operator(configuration config) : config_{std::move(config)} {
explicit explore_operator(configuration config) : config_{std::move(config)} {
}

auto
Expand Down Expand Up @@ -96,7 +95,7 @@ class tui_operator final : public crtp_operator<tui_operator> {

auto to_string() const -> std::string override {
// TODO: print configuration as well.
return fmt::format("tui");
return fmt::format("explore");
}

private:
Expand All @@ -113,7 +112,7 @@ class plugin final : public virtual operator_plugin {
}

[[nodiscard]] auto name() const -> std::string override {
return "tui";
return "explore";
};

auto make_operator(std::string_view pipeline) const
Expand Down Expand Up @@ -160,13 +159,13 @@ class plugin final : public virtual operator_plugin {
}
return {
std::string_view{f, l},
std::make_unique<tui_operator>(std::move(config)),
std::make_unique<explore_operator>(std::move(config)),
};
}
};

} // namespace

} // namespace vast::plugins::tui
} // namespace vast::plugins::explore

VAST_REGISTER_PLUGIN(vast::plugins::tui::plugin)
VAST_REGISTER_PLUGIN(vast::plugins::explore::plugin)
6 changes: 3 additions & 3 deletions plugins/tui/src/theme.cpp → plugins/explore/src/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// SPDX-FileCopyrightText: (c) 2023 The VAST Contributors
// SPDX-License-Identifier: BSD-3-Clause

#include "tui/theme.hpp"
#include "explore/theme.hpp"

#include <vast/detail/overload.hpp>

namespace vast::plugins::tui {
namespace vast::plugins::explore {

using namespace ftxui;
using namespace ftxui::literals;
Expand Down Expand Up @@ -173,4 +173,4 @@ auto mocha() -> theme {
return result;
}

} // namespace vast::plugins::tui
} // namespace vast::plugins::explore
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# tui
# explore

Renders pipeline data in a terminal user interface (TUI).

## Synopsis

```
tui [-f|--fullscreen=<bool>] [-h|--height=<int>] [-w|--width=<int>]
explore [-f|--fullscreen=<bool>] [-h|--height=<int>] [-w|--width=<int>]
```

## Description

The `tui` operator renders the data in the pipeline in a terminal user interface
(TUI).
The `explore` operator renders the data in the pipeline in a terminal user
interface (TUI).

Use the arrow keys or `j`/`k`/`h`/`l` to navigate through the cells. You can
also use the mouse to scroll vertically and horizontally, but moving the pointer
Expand Down Expand Up @@ -44,17 +44,17 @@ Defaults to 0, which means automatic detection.
Show the pipeline results in a TUI:

```bash
tui
explore
```

Show the pipeline results in a TUI, in fullscreen mode:

```bash
tui -f true
explore -f true
```

Show the pipeline results in a TUI, in a fixed window frame:

```bash
tui -w 80 -h 20
explore -w 80 -h 20
```

0 comments on commit 476f4d8

Please sign in to comment.