diff --git a/CMakeLists.txt b/CMakeLists.txt index d594cb64d..4be2db4c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -506,6 +506,19 @@ target_link_libraries(notcurses-input notcurses++ ) +# ncls +file(GLOB LSSRC CONFIGURE_DEPENDS src/ls/*.cpp) +add_executable(ncls ${LSSRC}) +target_include_directories(ncls + PRIVATE + include + "${PROJECT_BINARY_DIR}/include" +) +target_link_libraries(ncls + PRIVATE + notcurses++ +) + # notcurses-tetris file(GLOB TETRISSRC CONFIGURE_DEPENDS src/tetris/*.cpp) add_executable(notcurses-tetris ${TETRISSRC}) @@ -665,6 +678,7 @@ install(FILES ${MARKDOWN} DESTINATION ${CMAKE_INSTALL_DOCDIR}) install(TARGETS notcurses-demo DESTINATION bin) install(TARGETS notcurses-input DESTINATION bin) +install(TARGETS ncls DESTINATION bin) install(TARGETS ncneofetch DESTINATION bin) install(TARGETS notcurses-tetris DESTINATION bin) if(${USE_FFMPEG} OR ${USE_OIIO}) diff --git a/src/ls/main.cpp b/src/ls/main.cpp new file mode 100644 index 000000000..dc7e2561f --- /dev/null +++ b/src/ls/main.cpp @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +static void +usage(std::ostream& os, const char* name, int code){ + os << "usage: " << name << " -h | paths...\n"; + os << " -h: print usage information\n"; + os << std::flush; + exit(code); +} + +int main(int argc, char** argv){ + int c; + while((c = getopt(argc, argv, "h")) != -1){ + switch(c){ + case 'h': + usage(std::cout, argv[0], EXIT_SUCCESS); + break; + default: + usage(std::cerr, argv[0], EXIT_FAILURE); + break; + } + } + while(argv[optind]){ + std::cout << "arg: " << argv[optind] << std::endl; + ++optind; + } + return EXIT_SUCCESS; +}