git: 1c0f318b7613 - main - misc/json-tui: New port: JSON terminal UI made in C++

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 15 Jan 2023 03:14:00 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1c0f318b761394f2ee0ea17bb6df7124f901ae47

commit 1c0f318b761394f2ee0ea17bb6df7124f901ae47
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-01-15 02:00:55 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-01-15 03:13:58 +0000

    misc/json-tui: New port: JSON terminal UI made in C++
---
 misc/Makefile                            |  1 +
 misc/json-tui/Makefile                   | 25 ++++++++
 misc/json-tui/distinfo                   |  3 +
 misc/json-tui/files/patch-CMakeLists.txt | 97 ++++++++++++++++++++++++++++++++
 misc/json-tui/pkg-descr                  | 12 ++++
 5 files changed, 138 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index 6603fa0ecfe4..33e6f49aa1db 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -195,6 +195,7 @@
     SUBDIR += jargon
     SUBDIR += jbidwatcher
     SUBDIR += jojodiff
+    SUBDIR += json-tui
     SUBDIR += kbdscan
     SUBDIR += kcd
     SUBDIR += kde-thumbnailer-chm
diff --git a/misc/json-tui/Makefile b/misc/json-tui/Makefile
new file mode 100644
index 000000000000..619a95e04ce3
--- /dev/null
+++ b/misc/json-tui/Makefile
@@ -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>
diff --git a/misc/json-tui/distinfo b/misc/json-tui/distinfo
new file mode 100644
index 000000000000..2603f6e7c10f
--- /dev/null
+++ b/misc/json-tui/distinfo
@@ -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
diff --git a/misc/json-tui/files/patch-CMakeLists.txt b/misc/json-tui/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..afefde952465
--- /dev/null
+++ b/misc/json-tui/files/patch-CMakeLists.txt
@@ -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)
diff --git a/misc/json-tui/pkg-descr b/misc/json-tui/pkg-descr
new file mode 100644
index 000000000000..d552040289ab
--- /dev/null
+++ b/misc/json-tui/pkg-descr
@@ -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.