Cli: add last, first section_mode to cli

why return an int?
and the defintion of the function must be in the cpp file, we will save some recompilation this way