Skip to content

dlavila/treepp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 

Repository files navigation

Modern C++ Challenge:

The purpose of this challenge is to write a small application to demonstrate the usage of Modern C++ features and libraries. What better to learn some of the concepts introduced in C++17 than solving a real problem?

The challenge is to write a simple and portable version of the Linux command line tool tree:

tree

tree is a recursive directory listing program that produces a depth indented listing of files. With no arguments, tree lists the files in the current directory. When a directory argument is given, tree lists all the files and/or directories found in the given directory. Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.

The output takes a graphical form which will resemble the following example:

.
├── config.xml
├── config.json
├── data
│   ├── data1.bin
│   ├── data2.sql
│   └── data3.inf
├── code
│   ├── templates.h
│   ├── nullptr.rs
│   └── monad.hs
├── program.exe
├── lib1.so
└── lib2.dll

2 directories, 11 files

By default folders and files are sorted in alphabetical order as shown in the example. For simplicity you can assume only folders and files in the path.

Your implementation of tree should understands the following command line switches (one at the time):

-d: List directories only.
-t: Sort the output by last modification time.
--dirsfirst: List directories before files.
-L level: Max display depth of the directory tree.

You are free to use any C++17/14 feature, and open source library from this list. The solution should be limited to one source file and must include the command to compile (no make/ninja/etc files) in a comment.

To submit your solution send us an email with a link to a place where we can find your code (we recommend using something like Wandbox, Coliru or doing a pull request direclty to the challenge repo).

The challenge runs from Wednesday the 8th of November through Monday the 13th November 2017. We will announce the winner(s) on this page on Friday the 17th of November at 11:00 AM. To encourage discussion and learning all the solutions are going to be made public after announcing the winner(s).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published