Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions CommandLine.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ static void printHelpFlag(const char* name) {
"-C --no-color Use a monochrome color scheme\n"
"-d --delay=DELAY Set the delay between updates, in tenths of seconds\n"
"-F --filter=FILTER Show only the commands matching the given filter\n"
" --no-function-bar Hide the function bar\n"
"-h --help Print this help screen\n"
"-H --highlight-changes[=DELAY] Highlight new and old processes\n", name);
#ifdef HAVE_GETMOUSE
printf("-M --no-mouse Disable the mouse\n");
#endif
printf("-n --max-iterations=NUMBER Exit htop after NUMBER iterations/frame updates\n"
printf(" --no-meters Hide meters\n"
"-n --max-iterations=NUMBER Exit htop after NUMBER iterations/frame updates\n"
"-p --pid=PID[,PID,PID...] Show only the given PIDs\n"
" --readonly Disable all system and process changing features\n"
"-s --sort-key=COLUMN Sort by COLUMN in list view (try --sort-key=help for a list)\n"
Expand Down Expand Up @@ -91,6 +93,8 @@ typedef struct CommandLineSettings_ {
bool highlightChanges;
int highlightDelaySecs;
bool readonly;
bool hideMeters;
bool hideFunctionBar;
} CommandLineSettings;

static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettings* flags) {
Expand All @@ -111,6 +115,8 @@ static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettin
.highlightChanges = false,
.highlightDelaySecs = -1,
.readonly = false,
.hideMeters = false,
.hideFunctionBar = false,
};

const struct option long_opts[] =
Expand All @@ -125,9 +131,12 @@ static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettin
{"no-colour", no_argument, 0, 'C'},
{"no-mouse", no_argument, 0, 'M'},
{"no-unicode", no_argument, 0, 'U'},
{"no-meters", no_argument, 0, 129},
{"tree", no_argument, 0, 't'},
{"pid", required_argument, 0, 'p'},
{"filter", required_argument, 0, 'F'},
{"no-functionbar", no_argument, 0, 130},
{"no-function-bar", no_argument, 0, 130},
{"highlight-changes", optional_argument, 0, 'H'},
{"readonly", no_argument, 0, 128},
PLATFORM_LONG_OPTIONS
Expand Down Expand Up @@ -224,6 +233,9 @@ static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettin
case 'U':
flags->allowUnicode = false;
break;
case 129:
flags->hideMeters = true;
break;
case 't':
flags->treeView = true;
break;
Expand Down Expand Up @@ -255,6 +267,9 @@ static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettin
}
free_and_xStrdup(&flags->commFilter, optarg);
break;
case 130:
flags->hideFunctionBar = true;
break;
case 'H': {
const char* delay = optarg;
if (!delay && optind < argc && argv[optind] != NULL &&
Expand Down Expand Up @@ -364,6 +379,8 @@ int CommandLine_run(int argc, char** argv) {
}
ScreenSettings_setSortKey(settings->ss, flags.sortKey);
}
if (flags.hideFunctionBar)
settings->hideFunctionBar = 2;

host->iterationsRemaining = flags.iterationsRemaining;
CRT_init(settings, flags.allowUnicode, flags.iterationsRemaining != -1);
Expand All @@ -380,7 +397,7 @@ int CommandLine_run(int argc, char** argv) {
.failedUpdate = NULL,
.pauseUpdate = false,
.hideSelection = false,
.hideMeters = false,
.hideMeters = flags.hideMeters,
};

MainPanel_setState(panel, &state);
Expand Down
6 changes: 6 additions & 0 deletions htop.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ in monochrome mode
Filter processes by terms matching the commands. The terms are matched
case-insensitive and as fixed strings (not regexs). You can separate multiple terms with "|".
.TP
\fB\-\-no-function-bar\fR
Hide the function bar
.TP
\fB\-h \-\-help
Display a help message and exit
.TP
Expand All @@ -73,6 +76,9 @@ Do not use unicode but ASCII characters for graph meters
\fB\-M \-\-no-mouse\fR
Disable support of mouse control
.TP
\fB\-\-no-meters\fR
Hide graph meters
.TP
\fB\-\-readonly\fR
Disable all system and process changing features
.TP
Expand Down
Loading