mirror of
https://review.haiku-os.org/haiku
synced 2025-02-22 21:48:35 +01:00
Added basic verbosity support, and initial UdfBuilder creation and execution.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5466 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5e4cddfd9e
commit
2c8a6eec09
@ -14,18 +14,28 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ConsoleListener.h"
|
||||
#include "Debug.h"
|
||||
#include "UdfBuilder.h"
|
||||
|
||||
Shell::Shell()
|
||||
: fVerbosityLevel(VERBOSITY_HIGH)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
status_t
|
||||
Shell::Run(int argc, char *argv[])
|
||||
{
|
||||
DEBUG_INIT("Shell");
|
||||
_ProcessArguments(argc, argv);
|
||||
PRINT(("finished\n"));
|
||||
status_t error = _ProcessArguments(argc, argv);
|
||||
if (!error) {
|
||||
ConsoleListener listener(fVerbosityLevel);
|
||||
UdfBuilder builder(listener);
|
||||
builder.Build();
|
||||
} else {
|
||||
_PrintHelp();
|
||||
}
|
||||
RETURN(error);
|
||||
}
|
||||
|
||||
status_t
|
||||
@ -35,7 +45,7 @@ Shell::_ProcessArguments(int argc, char *argv[]) {
|
||||
// If we're given no parameters, the default settings
|
||||
// will do just fine
|
||||
if (argc < 2)
|
||||
return B_OK;
|
||||
RETURN(B_OK);
|
||||
|
||||
// Handle each command line argument (skipping the first
|
||||
// which is just the app name)
|
||||
@ -54,13 +64,29 @@ status_t
|
||||
Shell::_ProcessArgument(std::string arg, int argc, char *argv[]) {
|
||||
DEBUG_INIT_ETC("Shell", ("arg: `%s'", arg.c_str()));
|
||||
if (arg == "--help") {
|
||||
_PrintHelp();
|
||||
RETURN(B_ERROR);
|
||||
}
|
||||
RETURN(B_ERROR);
|
||||
} else if (arg == "-v0") {
|
||||
fVerbosityLevel = VERBOSITY_NONE;
|
||||
} else if (arg == "-v1") {
|
||||
fVerbosityLevel = VERBOSITY_LOW;
|
||||
} else if (arg == "-v2") {
|
||||
fVerbosityLevel = VERBOSITY_HIGH;
|
||||
} else {
|
||||
printf("ERROR: invalid argument `%s'\n", arg.c_str());
|
||||
printf("\n");
|
||||
RETURN(B_ERROR);
|
||||
}
|
||||
RETURN(B_OK);
|
||||
}
|
||||
|
||||
void
|
||||
Shell::_PrintHelp() {
|
||||
printf("usage: makeudfimage\n");
|
||||
printf("usage: makeudfimage [options]\n");
|
||||
printf("\n");
|
||||
printf("VALID ARGUMENTS:\n");
|
||||
printf(" --help: Displays this help text\n");
|
||||
printf(" -v0: Sets verbosity level to 0 (silent)\n");
|
||||
printf(" -v1: Sets verbosity level to 1 (low)\n");
|
||||
printf(" -v2: Sets verbosity level to 2 (high, *default*)\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -12,17 +12,21 @@
|
||||
#define _SHELL_H
|
||||
|
||||
#include <string>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include "SupportDefs.h"
|
||||
#include "ProgressListener.h"
|
||||
|
||||
class Shell {
|
||||
public:
|
||||
Shell();
|
||||
void Run(int argc, char *argv[]);
|
||||
status_t Run(int argc, char *argv[]);
|
||||
|
||||
private:
|
||||
status_t _ProcessArguments(int argc, char *argv[]);
|
||||
status_t _ProcessArgument(std::string arg, int argc, char *argv[]);
|
||||
void _PrintHelp();
|
||||
|
||||
VerbosityLevel fVerbosityLevel;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user