ncls getopt skeleton #693

pull/1158/head
nick black 4 years ago committed by Nick Black
parent b01113941d
commit de3944b114

@ -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})

@ -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…
Cancel
Save