diff --git a/doc/man/man1/ncls.1.md b/doc/man/man1/ncls.1.md new file mode 100644 index 000000000..a40cfc7fd --- /dev/null +++ b/doc/man/man1/ncls.1.md @@ -0,0 +1,43 @@ +% ncls(1) +% nick black +% v2.0.2 + +# NAME + +ncls - List paths with rendering of multimedia + +# SYNOPSIS + +**ncls** [**-h**] [**-d**] [**-l**] [**-R**] [ paths ] + +# DESCRIPTION + +**ncls** uses a multimedia-enabled notcurses to list paths, similarly to the +**ls(1)** command, rendering images and videos to a terminal. + +# OPTIONS + +**-d**: list directories themselves, not their contents. + +**-l**: use a long listing format. + +**-R**: list subdirectories recursively. + +**-h**: Print help information, and exit with success. + +paths: Run on the specified paths. If none are supplied, run on the current +directory. + +# NOTES + +Optimal display requires a terminal advertising the **rgb** terminfo(5) +capability, or that the environment variable **COLORTERM** is defined to +**24bit** (and that the terminal honors this variable), along with a +fixed-width font with good coverage of the Unicode Block Drawing Characters. + +# SEE ALSO + +**notcurses(3)**, +**notcurses_visual(3)**, +**terminfo(5)**, +**unicode(7)** diff --git a/src/ls/main.cpp b/src/ls/main.cpp index dc7e2561f..751d164d3 100644 --- a/src/ls/main.cpp +++ b/src/ls/main.cpp @@ -5,16 +5,31 @@ static void usage(std::ostream& os, const char* name, int code){ - os << "usage: " << name << " -h | paths...\n"; + os << "usage: " << name << " -h | [ -lR ] paths...\n"; + os << " -d: list directories themselves, not their contents\n"; + os << " -l: use a long listing format\n"; + os << " -R: list subdirectories recursively\n"; os << " -h: print usage information\n"; os << std::flush; exit(code); } int main(int argc, char** argv){ + bool longlisting = false; + bool recursedirs = false; + bool directories = false; int c; - while((c = getopt(argc, argv, "h")) != -1){ + while((c = getopt(argc, argv, "dhlR")) != -1){ switch(c){ + case 'd': + directories = true; + break; + case 'l': + longlisting = true; + break; + case 'R': + recursedirs = true; + break; case 'h': usage(std::cout, argv[0], EXIT_SUCCESS); break; @@ -23,6 +38,7 @@ int main(int argc, char** argv){ break; } } + // FIXME if argv[optind] == nullptr, pass "." while(argv[optind]){ std::cout << "arg: " << argv[optind] << std::endl; ++optind;