docs: Update some arguments, and documentation (#214)

Some more updates to arguments and documentation.
This commit is contained in:
Clement Tsang 2020-08-31 18:57:01 -04:00 committed by GitHub
parent 3431411215
commit 5aa7b4df08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 49 deletions

View File

@ -37,6 +37,7 @@
"crossterm", "crossterm",
"curr", "curr",
"czvf", "czvf",
"fpath",
"gotop", "gotop",
"gtop", "gtop",
"haase", "haase",

View File

@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changes ### Changes
- [#213](https://github.com/ClementTsang/bottom/pull/213), [#214](https://github.com/ClementTsang/bottom/pull/214): Updated help descriptions, added auto-complete generation.
### Bug Fixes ### Bug Fixes
- [#211](https://github.com/ClementTsang/bottom/pull/211): Fixes a bug where you could move down in the process widget even if the process widget search was closed. - [#211](https://github.com/ClementTsang/bottom/pull/211): Fixes a bug where you could move down in the process widget even if the process widget search was closed.

View File

@ -23,7 +23,6 @@ A cross-platform graphical process/system monitor with a customizable interface
- [Auto-completion](#auto-completion) - [Auto-completion](#auto-completion)
- [Usage](#usage) - [Usage](#usage)
- [Flags](#flags) - [Flags](#flags)
- [Options](#options)
- [Keybindings](#keybindings) - [Keybindings](#keybindings)
- [General](#general) - [General](#general)
- [Process bindings](#process-bindings) - [Process bindings](#process-bindings)
@ -176,37 +175,32 @@ Run using `btm`.
### Flags ### Flags
``` ```
-h, --help Prints help information, including flags and options --autohide_time Temporarily shows the time scale in graphs.
-a, --hide_avg_cpu Hides the average CPU usage -b, --basic Hides graphs and uses a more basic look.
-m, --dot-marker Uses a dot marker instead of the default braille marker --battery Shows the battery widget.
-c, --celsius Displays the temperature type in Celsius [default] -S, --case_sensitive Enables case sensitivity by default.
-f, --fahrenheit Displays the temperature type in Fahrenheit -c, --celsius Sets the temperature type to Celsius.
-k, --kelvin Displays the temperature type in Kelvin -C, --config <CONFIG PATH> Sets the location of the config file.
-l, --left_legend Displays the CPU legend to the left rather than the right -t, --default_time_value <MS> Default time value for graphs in ms.
-u, --current_usage Sets process CPU usage to be based on current total CPU usage --default_widget_count <INT> Sets the n'th selected widget type as the default.
-g, --group Groups together processes with the same name by default --default_widget_type <WIDGET TYPE> Sets which widget type to use as the default widget.
-S, --case_sensitive Search defaults to matching cases --disable_click Disables mouse clicks.
-W, --whole Search defaults to searching for the whole word -m, --dot_marker Uses a dot marker for graphs.
-R, --regex Search defaults to using regex -f, --fahrenheit Sets the temperature type to Fahrenheit.
-s, --show_disabled_data Shows disabled CPU entries in the CPU legend -g, --group Groups processes with the same name by default.
-b, --basic Enables basic mode, removing charts and condensing data -a, --hide_avg_cpu Hides the average CPU usage.
--autohide_time Automatically hide the time scaling in graphs after being shown for a brief moment when --hide_table_gap Hides the spacing between table headers and entries.
zoomed in/out. If time is disabled via --hide_time then this will have no effect --hide_time Completely hides the time scaling.
--use_old_network_legend Use the older (pre-0.4) network legend which is separate from the network chart -k, --kelvin Sets the temperature type to Kelvin.
--hide_table_gap Hides the spacing between table headers and data -l, --left_legend Puts the CPU chart legend to the left side.
--battery Displays the battery widget for default and basic layouts -r, --rate <MS> Sets a refresh rate in ms.
--disable_click Disables mouse clicks from interacting with the program -R, --regex Enables regex by default.
``` -d, --time_delta <MS> The amount in ms changed upon zooming.
-u, --current_usage Sets process CPU% to be based on current CPU%.
### Options --use_old_network_legend DEPRECATED - uses the older network legend.
-W, --whole_word Enables whole-word matching by default.
``` -h, --help Prints help information. Use --help for more info.
-r, --rate <MS> Set the refresh rate in milliseconds [default: 1000] -V, --version Prints version information.
-C, --config <PATH> Use the specified config file; if it does not exist it is automatically created [default: see section on config files]
-t, --default_time_value <MS> Sets the default time interval for charts in milliseconds [default: 60000]
-d, --time_delta <MS> Sets the default amount each zoom in/out action changes by in milliseconds [default: 15000]
--default_widget_count <COUNT> Which number of the selected widget type to select, from left to right, top to bottom [default: 1]
--default_widget_type <TYPE> The default widget type to select by default [default: "process"]
``` ```
### Keybindings ### Keybindings
@ -466,7 +460,7 @@ Note that if a config file does not exist at either the default location or the
The following options can be set under `[flags]` to achieve the same effect as passing in a flag on runtime. Note that if a flag is given, it will override the config file. The following options can be set under `[flags]` to achieve the same effect as passing in a flag on runtime. Note that if a flag is given, it will override the config file.
These are the following supported flag config values, which correspond to the flag of the same name described in [Flags](#flags) and [Options](#options): These are the following supported flag config values, which correspond to the flag of the same name described in [Flags](#flags):
| Field | Type | | Field | Type |
| ------------------------ | ------------------------------------------------------------------------------------- | | ------------------------ | ------------------------------------------------------------------------------------- |

View File

@ -6,15 +6,13 @@ const TEMPLATE: &str = "\
{about} {about}
USAGE: USAGE:{usage}
{usage}
FLAGS: FLAGS:
{flags} {unified}";
OPTIONS: const USAGE: &str = "
{options} btm [FLAG]";
";
pub fn get_matches() -> clap::ArgMatches<'static> { pub fn get_matches() -> clap::ArgMatches<'static> {
build_app().get_matches() build_app().get_matches()
@ -198,13 +196,28 @@ time is 30s (30000), and the default is 60s (60000).\n\n\n",
let default_widget_count = Arg::with_name("DEFAULT_WIDGET_COUNT") let default_widget_count = Arg::with_name("DEFAULT_WIDGET_COUNT")
.long("default_widget_count") .long("default_widget_count")
.takes_value(true) .takes_value(true)
.requires_all(&["DEFAULT_WIDGET_TYPE"])
.value_name("INT") .value_name("INT")
.help("Sets the n'th selected widget type as the default.") .help("Sets the n'th selected widget type as the default.")
.long_help( .long_help(
"\ "\
Sets the n'th selected widget type to use as the default widget. Sets the n'th selected widget type to use as the default widget.
Goes from left to right, top to bottom.\n\n", Requires 'default_widget_type' to also be set, and defaults to 1.
); //FIXME: Explain this
This reads from left to right, top to bottom. For example, suppose
we have a layout that looks like:
+-------------------+-----------------------+
| CPU (1) | CPU (2) |
+---------+---------+-------------+---------+
| Process | CPU (3) | Temperature | CPU (4) |
+---------+---------+-------------+---------+
And we set our default widget type to 'CPU'. If we set
'--default_widget_count 1', then it would use the CPU (1) as
the default widget. If we set '--default_widget_count 3', it would
use CPU (3) as the default instead.
\n\n",
);
let default_widget_type = Arg::with_name("DEFAULT_WIDGET_TYPE") let default_widget_type = Arg::with_name("DEFAULT_WIDGET_TYPE")
.long("default_widget_type") .long("default_widget_type")
.takes_value(true) .takes_value(true)
@ -213,8 +226,37 @@ Goes from left to right, top to bottom.\n\n",
.long_help( .long_help(
"\ "\
Sets which widget type to use as the default widget. Sets which widget type to use as the default widget.
Acceptable widget types are...\n\n", For the default layout, this defaults to the 'process' widget.
); //FIXME: Expand For a custom layout, it defaults to the first widget it sees.
For example, suppose we have a layout that looks like:
+-------------------+-----------------------+
| CPU (1) | CPU (2) |
+---------+---------+-------------+---------+
| Process | CPU (3) | Temperature | CPU (4) |
+---------+---------+-------------+---------+
Setting '--default_widget_type Temp' will make the Temperature
widget selected by default.
Supported widget types:
+--------------------------+
| cpu |
+--------------------------+
| mem, memory |
+--------------------------+
| net, network |
+--------------------------+
| proc, process, processes |
+--------------------------+
| temp, temperature |
+--------------------------+
| disk |
+--------------------------+
| batt, battery |
+--------------------------+
\n\n",
);
let rate = Arg::with_name("RATE_MILLIS") let rate = Arg::with_name("RATE_MILLIS")
.short("r") .short("r")
.long("rate") .long("rate")
@ -239,10 +281,12 @@ The minimum is 1s (1000), and defaults to 15s (15000).\n\n\n",
); );
App::new(crate_name!()) App::new(crate_name!())
.setting(AppSettings::UnifiedHelpMessage)
.version(crate_version!()) .version(crate_version!())
.author(crate_authors!()) .author(crate_authors!())
.about(crate_description!()) .about(crate_description!())
.template(TEMPLATE) .template(TEMPLATE)
.usage(USAGE)
.help_message("Prints help information. Use --help for more info.") .help_message("Prints help information. Use --help for more info.")
.version_message("Prints version information.") .version_message("Prints version information.")
.arg(kelvin) .arg(kelvin)
@ -253,6 +297,10 @@ The minimum is 1s (1000), and defaults to 15s (15000).\n\n\n",
.arg(basic) .arg(basic)
.arg(battery) .arg(battery)
.arg(case_sensitive) .arg(case_sensitive)
.arg(config)
.arg(default_time_value)
.arg(default_widget_count)
.arg(default_widget_type)
.arg(disable_click) .arg(disable_click)
.arg(dot_marker) .arg(dot_marker)
.arg(group) .arg(group)
@ -260,14 +308,10 @@ The minimum is 1s (1000), and defaults to 15s (15000).\n\n\n",
.arg(hide_table_gap) .arg(hide_table_gap)
.arg(hide_time) .arg(hide_time)
.arg(left_legend) .arg(left_legend)
.arg(rate)
.arg(regex) .arg(regex)
.arg(time_delta)
.arg(current_usage) .arg(current_usage)
.arg(use_old_network_legend) .arg(use_old_network_legend)
.arg(whole_word) .arg(whole_word)
.arg(config)
.arg(default_time_value)
.arg(default_widget_count)
.arg(default_widget_type)
.arg(rate)
.arg(time_delta)
} }