Skip to content

Commit

Permalink
Merge pull request #32 from earlephilhower/vers
Browse files Browse the repository at this point in the history
Add more info to --version
  • Loading branch information
earlephilhower authored Jan 29, 2023
2 parents 3380fc9 + 669cbfe commit 4aca452
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,37 @@ int actionList() {
return 0;
}

#define PRINT_INT_MACRO(def_name) \
std::cout << " " # def_name ": " << def_name << std::endl;

class CustomOutput : public TCLAP::StdOutput
{
public:
virtual void version(TCLAP::CmdLineInterface& c)
{
std::cout << "mklittlefs ver. " VERSION << std::endl;
const char* configName = BUILD_CONFIG_NAME;
if (configName[0] == '-') {
configName += 1;
}
std::cout << "Build configuration name: " << configName << std::endl;
std::cout << "LittleFS ver. " << LITTLEFS_VERSION << std::endl;
const char* buildConfig = BUILD_CONFIG;
std::cout << "Extra build flags: " << (strlen(buildConfig) ? buildConfig : "(none)") << std::endl;
std::cout << "LittleFS configuration:" << std::endl;
PRINT_INT_MACRO(LFS_NAME_MAX);
PRINT_INT_MACRO(LFS_FILE_MAX);
PRINT_INT_MACRO(LFS_ATTR_MAX);
}
};

#undef PRINT_INT_MACRO

void processArgs(int argc, const char** argv) {
TCLAP::CmdLine cmd("", ' ', VERSION);
CustomOutput output;
cmd.setOutput(&output);

TCLAP::ValueArg<std::string> packArg( "c", "create", "create littlefs image from a directory", true, "", "pack_dir");
TCLAP::ValueArg<std::string> unpackArg( "u", "unpack", "unpack littlefs image to a directory", true, "", "dest_dir");
TCLAP::SwitchArg listArg( "l", "list", "list files in littlefs image", false);
Expand Down

0 comments on commit 4aca452

Please sign in to comment.