misc/json-tui: New port: JSON terminal UI made in C++

This commit is contained in:
Yuri Victorovich 2023-01-14 18:00:55 -08:00
parent 2d00178fd4
commit 1c0f318b76
5 changed files with 138 additions and 0 deletions

View File

@ -195,6 +195,7 @@
SUBDIR += jargon
SUBDIR += jbidwatcher
SUBDIR += jojodiff
SUBDIR += json-tui
SUBDIR += kbdscan
SUBDIR += kcd
SUBDIR += kde-thumbnailer-chm

25
misc/json-tui/Makefile Normal file
View File

@ -0,0 +1,25 @@
PORTNAME= json-tui
DISTVERSIONPREFIX= v
DISTVERSION= 1.3.0-13
DISTVERSIONSUFFIX= -g6b38aba
CATEGORIES= misc
MAINTAINER= yuri@FreeBSD.org
COMMENT= JSON terminal UI made in C++
WWW= https://github.com/ArthurSonzogni/json-tui
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= args>0:devel/args \
nlohmann-json>0:devel/nlohmann-json
LIB_DEPENDS= libftxui-component.so:devel/ftxui
USES= cmake compiler:c++20-lang
USE_GITHUB= yes
GH_ACCOUNT= ArthurSonzogni
PLIST_FILES= bin/json-tui
.include <bsd.port.mk>

3
misc/json-tui/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1673746734
SHA256 (ArthurSonzogni-json-tui-v1.3.0-13-g6b38aba_GH0.tar.gz) = dd7f9af11d9cf43418aad4ef79c3cf45c25565ddee6167423c14cc5b11e6df31
SIZE (ArthurSonzogni-json-tui-v1.3.0-13-g6b38aba_GH0.tar.gz) = 353029

View File

@ -0,0 +1,97 @@
--- CMakeLists.txt.orig 2023-01-15 01:39:31 UTC
+++ CMakeLists.txt
@@ -1,47 +1,53 @@
cmake_minimum_required (VERSION 3.11)
+enable_language(CXX)
+
# Dependencies -----------------------------------------------------------------
-include(FetchContent)
-set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
-set(FETCHCONTENT_QUIET FALSE)
+#include(FetchContent)
+#set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
+#set(FETCHCONTENT_QUIET FALSE)
-FetchContent_Declare(ftxui
- GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
- GIT_TAG b56afce48ccd472cd2c3a53e619de0db1e7227a4
- GIT_PROGRESS TRUE
- GIT_SHALLOW FALSE
-)
+#FetchContent_Declare(ftxui
+# GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
+# GIT_TAG b56afce48ccd472cd2c3a53e619de0db1e7227a4
+# GIT_PROGRESS TRUE
+# GIT_SHALLOW FALSE
+#)
-FetchContent_Declare(json
- URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz
-)
+#FetchContent_Declare(json
+# URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz
+#)
-FetchContent_Declare(args
- GIT_REPOSITORY https://github.com/Taywee/args
- GIT_TAG a48e1f880813b367d2354963a58dedbf2b708584
- GIT_PROGRESS TRUE
- GIT_SHALLOW FALSE
-)
+#FetchContent_Declare(args
+# GIT_REPOSITORY https://github.com/Taywee/args
+# GIT_TAG a48e1f880813b367d2354963a58dedbf2b708584
+# GIT_PROGRESS TRUE
+# GIT_SHALLOW FALSE
+#)
-FetchContent_GetProperties(ftxui)
-if(NOT ftxui_POPULATED)
- FetchContent_Populate(ftxui)
- add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
-endif()
+#FetchContent_GetProperties(ftxui)
+#if(NOT ftxui_POPULATED)
+# FetchContent_Populate(ftxui)
+# add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
+#endif()
-FetchContent_GetProperties(json)
-if(NOT json_POPULATED)
- FetchContent_Populate(json)
- add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
-endif()
+#FetchContent_GetProperties(json)
+#if(NOT json_POPULATED)
+# FetchContent_Populate(json)
+# add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
+#endif()
-FetchContent_GetProperties(args)
-if(NOT args_POPULATED)
- FetchContent_Populate(args)
- add_subdirectory(${args_SOURCE_DIR} ${args_BINARY_DIR} EXCLUDE_FROM_ALL)
-endif()
+#FetchContent_GetProperties(args)
+#if(NOT args_POPULATED)
+# FetchContent_Populate(args)
+# add_subdirectory(${args_SOURCE_DIR} ${args_BINARY_DIR} EXCLUDE_FROM_ALL)
+#endif()
+find_package(args REQUIRED)
+find_package(ftxui REQUIRED)
+find_package(nlohmann_json REQUIRED)
+
# Build ------------------------------------------------------------------------
configure_file(
@@ -83,7 +89,6 @@ target_link_libraries(json-tui-lib
target_link_libraries(json-tui
PRIVATE json-tui-lib
- PRIVATE args
)
include(cmake/options.cmake)

12
misc/json-tui/pkg-descr Normal file
View File

@ -0,0 +1,12 @@
json-tui is a JSON terminal UI made in C++.
Features:
* Interactive: Use keyboard or mouse to scroll/expand objects.
* Colors
* Responsive: Adapt to the terminal dimensions. Very long text values are
wrapped on several lines.
* Cross-platform
* The output is displayed inline with the previous commands. Meaning you can
still see the json after leaving json-tui.
* (Vim users): Also support j/k for navigation.
* Table view: Turn arrays of objects into tables.