mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
ncls getopt skeleton #693
This commit is contained in:
parent
b01113941d
commit
de3944b114
@ -506,6 +506,19 @@ target_link_libraries(notcurses-input
|
|||||||
notcurses++
|
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
|
# notcurses-tetris
|
||||||
file(GLOB TETRISSRC CONFIGURE_DEPENDS src/tetris/*.cpp)
|
file(GLOB TETRISSRC CONFIGURE_DEPENDS src/tetris/*.cpp)
|
||||||
add_executable(notcurses-tetris ${TETRISSRC})
|
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-demo DESTINATION bin)
|
||||||
install(TARGETS notcurses-input DESTINATION bin)
|
install(TARGETS notcurses-input DESTINATION bin)
|
||||||
|
install(TARGETS ncls DESTINATION bin)
|
||||||
install(TARGETS ncneofetch DESTINATION bin)
|
install(TARGETS ncneofetch DESTINATION bin)
|
||||||
install(TARGETS notcurses-tetris DESTINATION bin)
|
install(TARGETS notcurses-tetris DESTINATION bin)
|
||||||
if(${USE_FFMPEG} OR ${USE_OIIO})
|
if(${USE_FFMPEG} OR ${USE_OIIO})
|
||||||
|
31
src/ls/main.cpp
Normal file
31
src/ls/main.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include <cstdlib>
|
||||||
|
#include <iostream>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ncpp/NotCurses.hh>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user