mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
Userland: Move Shell code to be in a library directory
This change ensures that users can use LibShell easily understand this library now, because we have an actual library directory. In addition to that, we move the test scripts to Tests/LibShell, to match the usual pattern of putting test-related files in the Tests/ directory.
This commit is contained in:
parent
c8a068496a
commit
d46be35f3f
54 changed files with 55 additions and 52 deletions
|
@ -502,6 +502,7 @@ if (BUILD_LAGOM)
|
||||||
Regex
|
Regex
|
||||||
RIFF
|
RIFF
|
||||||
SoftGPU
|
SoftGPU
|
||||||
|
Shell
|
||||||
SQL
|
SQL
|
||||||
Syntax
|
Syntax
|
||||||
TextCodec
|
TextCodec
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Shell/Shell.h>
|
#include <LibShell/Shell.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/StringView.h>
|
#include <AK/StringView.h>
|
||||||
#include <Shell/PosixParser.h>
|
#include <LibShell/PosixParser.h>
|
||||||
#include <Shell/Shell.h>
|
#include <LibShell/Shell.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ if [ "$#" -eq "0" ]; then
|
||||||
git ls-files -- \
|
git ls-files -- \
|
||||||
'*.sh' \
|
'*.sh' \
|
||||||
':!:Ports' \
|
':!:Ports' \
|
||||||
':!:Userland/Shell/Tests' \
|
':!:Tests/LibShell' \
|
||||||
':!:Base/home/anon/Tests' \
|
':!:Base/home/anon/Tests' \
|
||||||
':!:Base/root/generate_manpages.sh' \
|
':!:Base/root/generate_manpages.sh' \
|
||||||
':!:Base/usr/share/shell' \
|
':!:Base/usr/share/shell' \
|
||||||
|
|
|
@ -19,6 +19,7 @@ add_subdirectory(LibMarkdown)
|
||||||
add_subdirectory(LibPDF)
|
add_subdirectory(LibPDF)
|
||||||
add_subdirectory(LibRegex)
|
add_subdirectory(LibRegex)
|
||||||
add_subdirectory(LibSemVer)
|
add_subdirectory(LibSemVer)
|
||||||
|
add_subdirectory(LibShell)
|
||||||
add_subdirectory(LibSQL)
|
add_subdirectory(LibSQL)
|
||||||
add_subdirectory(LibTest)
|
add_subdirectory(LibTest)
|
||||||
add_subdirectory(LibTextCodec)
|
add_subdirectory(LibTextCodec)
|
||||||
|
|
7
Tests/LibShell/CMakeLists.txt
Normal file
7
Tests/LibShell/CMakeLists.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
if (NOT ENABLE_FUZZERS)
|
||||||
|
install(DIRECTORY Tests/ DESTINATION usr/Tests/Shell
|
||||||
|
PATTERN "Tests/*"
|
||||||
|
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
||||||
|
GROUP_EXECUTE GROUP_READ
|
||||||
|
WORLD_EXECUTE WORLD_READ)
|
||||||
|
endif()
|
|
@ -39,11 +39,11 @@
|
||||||
#include <LibMarkdown/Document.h>
|
#include <LibMarkdown/Document.h>
|
||||||
#include <LibMarkdown/SyntaxHighlighter.h>
|
#include <LibMarkdown/SyntaxHighlighter.h>
|
||||||
#include <LibSQL/AST/SyntaxHighlighter.h>
|
#include <LibSQL/AST/SyntaxHighlighter.h>
|
||||||
|
#include <LibShell/SyntaxHighlighter.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.h>
|
#include <LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.h>
|
||||||
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
|
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
|
||||||
#include <LibWebView/OutOfProcessWebView.h>
|
#include <LibWebView/OutOfProcessWebView.h>
|
||||||
#include <Shell/SyntaxHighlighter.h>
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
#include <Userland/Shell/Shell.h>
|
#include <LibShell/Shell.h>
|
||||||
|
|
||||||
#define ENUMERATE_UTILITIES(E, ALIAS) \
|
#define ENUMERATE_UTILITIES(E, ALIAS) \
|
||||||
ALIAS(b2sum, checksum) \
|
ALIAS(b2sum, checksum) \
|
||||||
|
|
|
@ -37,13 +37,13 @@
|
||||||
#include <LibMarkdown/Document.h>
|
#include <LibMarkdown/Document.h>
|
||||||
#include <LibMarkdown/SyntaxHighlighter.h>
|
#include <LibMarkdown/SyntaxHighlighter.h>
|
||||||
#include <LibSQL/AST/SyntaxHighlighter.h>
|
#include <LibSQL/AST/SyntaxHighlighter.h>
|
||||||
|
#include <LibShell/SyntaxHighlighter.h>
|
||||||
#include <LibSyntax/Language.h>
|
#include <LibSyntax/Language.h>
|
||||||
#include <LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.h>
|
#include <LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.h>
|
||||||
#include <LibWeb/DOM/Text.h>
|
#include <LibWeb/DOM/Text.h>
|
||||||
#include <LibWeb/HTML/HTMLHeadElement.h>
|
#include <LibWeb/HTML/HTMLHeadElement.h>
|
||||||
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
|
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
|
||||||
#include <LibWebView/OutOfProcessWebView.h>
|
#include <LibWebView/OutOfProcessWebView.h>
|
||||||
#include <Shell/SyntaxHighlighter.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
namespace HackStudio {
|
namespace HackStudio {
|
||||||
|
|
|
@ -50,6 +50,7 @@ add_subdirectory(LibRegex)
|
||||||
add_subdirectory(LibRIFF)
|
add_subdirectory(LibRIFF)
|
||||||
add_subdirectory(LibSanitizer)
|
add_subdirectory(LibSanitizer)
|
||||||
add_subdirectory(LibSemVer)
|
add_subdirectory(LibSemVer)
|
||||||
|
add_subdirectory(LibShell)
|
||||||
add_subdirectory(LibSoftGPU)
|
add_subdirectory(LibSoftGPU)
|
||||||
add_subdirectory(LibSQL)
|
add_subdirectory(LibSQL)
|
||||||
add_subdirectory(LibSymbolication)
|
add_subdirectory(LibSymbolication)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibCodeComprehension/CodeComprehensionEngine.h>
|
#include <LibCodeComprehension/CodeComprehensionEngine.h>
|
||||||
#include <Shell/Shell.h>
|
#include <LibShell/Shell.h>
|
||||||
|
|
||||||
namespace CodeComprehension::Shell {
|
namespace CodeComprehension::Shell {
|
||||||
|
|
||||||
|
|
20
Userland/Libraries/LibShell/CMakeLists.txt
Normal file
20
Userland/Libraries/LibShell/CMakeLists.txt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
set(SOURCES
|
||||||
|
AST.cpp
|
||||||
|
Builtin.cpp
|
||||||
|
Formatter.cpp
|
||||||
|
ImmediateFunctions.cpp
|
||||||
|
Job.cpp
|
||||||
|
NodeVisitor.cpp
|
||||||
|
Parser.cpp
|
||||||
|
PosixLexer.cpp
|
||||||
|
PosixParser.cpp
|
||||||
|
Shell.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
serenity_lib(LibShell shell)
|
||||||
|
target_link_libraries(LibShell PRIVATE LibCore LibRegex LibLine LibFileSystem LibSyntax LibURL)
|
||||||
|
|
||||||
|
if (SERENITYOS)
|
||||||
|
target_sources(LibShell PRIVATE SyntaxHighlighter.cpp)
|
||||||
|
target_link_libraries(LibShell PRIVATE LibCodeComprehension)
|
||||||
|
endif()
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/CharacterTypes.h>
|
#include <AK/CharacterTypes.h>
|
||||||
#include <Shell/PosixLexer.h>
|
#include <LibShell/PosixLexer.h>
|
||||||
|
|
||||||
static bool is_operator(StringView text)
|
static bool is_operator(StringView text)
|
||||||
{
|
{
|
|
@ -12,7 +12,7 @@
|
||||||
#include <AK/TemporaryChange.h>
|
#include <AK/TemporaryChange.h>
|
||||||
#include <AK/Variant.h>
|
#include <AK/Variant.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <Shell/AST.h>
|
#include <LibShell/AST.h>
|
||||||
|
|
||||||
namespace Shell::Posix {
|
namespace Shell::Posix {
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include <AK/CharacterTypes.h>
|
#include <AK/CharacterTypes.h>
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/StringUtils.h>
|
#include <AK/StringUtils.h>
|
||||||
#include <Shell/Parser.h>
|
#include <LibShell/Parser.h>
|
||||||
#include <Shell/PosixParser.h>
|
#include <LibShell/PosixParser.h>
|
||||||
|
|
||||||
#define TRY_OR_THROW_PARSE_ERROR_AT(expr, position) ({ \
|
#define TRY_OR_THROW_PARSE_ERROR_AT(expr, position) ({ \
|
||||||
/* Ignore -Wshadow to allow nesting the macro. */ \
|
/* Ignore -Wshadow to allow nesting the macro. */ \
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Shell/AST.h>
|
#include <LibShell/AST.h>
|
||||||
#include <Shell/PosixLexer.h>
|
#include <LibShell/PosixLexer.h>
|
||||||
|
|
||||||
namespace Shell::Posix {
|
namespace Shell::Posix {
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
#include <LibCore/Timer.h>
|
#include <LibCore/Timer.h>
|
||||||
#include <LibFileSystem/FileSystem.h>
|
#include <LibFileSystem/FileSystem.h>
|
||||||
#include <LibLine/Editor.h>
|
#include <LibLine/Editor.h>
|
||||||
|
#include <LibShell/PosixParser.h>
|
||||||
#include <LibURL/URL.h>
|
#include <LibURL/URL.h>
|
||||||
#include <Shell/PosixParser.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
|
@ -9,10 +9,10 @@
|
||||||
#include <AK/TemporaryChange.h>
|
#include <AK/TemporaryChange.h>
|
||||||
#include <LibGfx/Font/Font.h>
|
#include <LibGfx/Font/Font.h>
|
||||||
#include <LibGfx/Palette.h>
|
#include <LibGfx/Palette.h>
|
||||||
|
#include <LibShell/NodeVisitor.h>
|
||||||
|
#include <LibShell/Parser.h>
|
||||||
|
#include <LibShell/SyntaxHighlighter.h>
|
||||||
#include <LibSyntax/Document.h>
|
#include <LibSyntax/Document.h>
|
||||||
#include <Shell/NodeVisitor.h>
|
|
||||||
#include <Shell/Parser.h>
|
|
||||||
#include <Shell/SyntaxHighlighter.h>
|
|
||||||
|
|
||||||
namespace Shell {
|
namespace Shell {
|
||||||
|
|
|
@ -4,38 +4,11 @@ serenity_component(
|
||||||
TARGETS Shell
|
TARGETS Shell
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES
|
|
||||||
AST.cpp
|
|
||||||
Builtin.cpp
|
|
||||||
Formatter.cpp
|
|
||||||
ImmediateFunctions.cpp
|
|
||||||
Job.cpp
|
|
||||||
NodeVisitor.cpp
|
|
||||||
Parser.cpp
|
|
||||||
PosixLexer.cpp
|
|
||||||
PosixParser.cpp
|
|
||||||
Shell.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
serenity_lib(LibShell shell)
|
|
||||||
target_link_libraries(LibShell PRIVATE LibCore LibFileSystem LibLine LibSyntax LibRegex LibURL)
|
|
||||||
|
|
||||||
if (SERENITYOS)
|
|
||||||
target_sources(LibShell PRIVATE SyntaxHighlighter.cpp)
|
|
||||||
target_link_libraries(LibShell PRIVATE LibCodeComprehension)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (ENABLE_FUZZERS)
|
if (ENABLE_FUZZERS)
|
||||||
add_custom_target(Shell) # Stub target to placate serenity_component
|
add_custom_target(Shell) # Stub target to placate serenity_component
|
||||||
else()
|
else()
|
||||||
set(SOURCES main.cpp)
|
set(SOURCES main.cpp)
|
||||||
|
|
||||||
serenity_bin(Shell)
|
serenity_bin(Shell)
|
||||||
target_link_libraries(Shell PRIVATE LibCore LibFileSystem LibLine LibShell LibMain)
|
target_link_libraries(Shell PRIVATE LibCore LibShell LibFileSystem LibLine LibMain)
|
||||||
|
|
||||||
install(DIRECTORY Tests/ DESTINATION usr/Tests/Shell
|
|
||||||
PATTERN "Tests/*"
|
|
||||||
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
|
|
||||||
GROUP_EXECUTE GROUP_READ
|
|
||||||
WORLD_EXECUTE WORLD_READ)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Shell.h"
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/Event.h>
|
#include <LibCore/Event.h>
|
||||||
|
@ -12,6 +11,7 @@
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibFileSystem/FileSystem.h>
|
#include <LibFileSystem/FileSystem.h>
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
|
#include <LibShell/Shell.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
#include "AvailablePortDatabase.h"
|
#include "AvailablePortDatabase.h"
|
||||||
#include "MarkdownTableFinder.h"
|
#include "MarkdownTableFinder.h"
|
||||||
|
|
||||||
#include <Shell/AST.h>
|
#include <LibShell/AST.h>
|
||||||
#include <Shell/Formatter.h>
|
#include <LibShell/Formatter.h>
|
||||||
#include <Shell/NodeVisitor.h>
|
#include <LibShell/NodeVisitor.h>
|
||||||
#include <Shell/PosixParser.h>
|
#include <LibShell/PosixParser.h>
|
||||||
#include <Shell/Shell.h>
|
#include <LibShell/Shell.h>
|
||||||
|
|
||||||
void AvailablePortDatabase::query_details_for_package(HashMap<String, InstalledPort> const& installed_ports_map, StringView package_name, bool verbose)
|
void AvailablePortDatabase::query_details_for_package(HashMap<String, InstalledPort> const& installed_ports_map, StringView package_name, bool verbose)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue