summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-04-06 11:04:08 -0500
committerSean E. Russell <ser@ser1.net>2020-04-06 11:04:08 -0500
commit73a36212ac066733a7c8c505808d42b79b309b0c (patch)
tree56b4db266daf2b1ef57a95fbe9ac7c8654ea35a2
parent025527730fb350c42e106507c6b5d239258687bf (diff)
Fixes #75DELETED
-rw-r--r--README.md51
-rw-r--r--cmd/gotop/main.go12
-rw-r--r--config.go1
3 files changed, 41 insertions, 23 deletions
diff --git a/README.md b/README.md
index 0c18b38..5345005 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
Another terminal based graphical activity monitor, inspired by [gtop](https://github.com/aksakalli/gtop) and [vtop](https://github.com/MrRio/vtop), this time written in [Go](https://golang.org/)!
-The original author of gotop has re-implemented the application in Rust, as [ytop](https://github.com/cjbassi/ytop). This is a fork of original gotop project with a new maintainer.
+Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([matrix clients](https://matrix.to/#/#gotop:matrix.org)).
<img src="./assets/screenshots/demo.gif" />
<img src="./assets/screenshots/kitchensink.gif" />
@@ -21,6 +21,8 @@ The original author of gotop has re-implemented the application in Rust, as [yto
Working and tested on Linux, FreeBSD and MacOS. Windows binaries are provided, but have limited testing. OpenBSD works with some caveats; cross-compiling is difficult and binaries are not provided.
+If you install gotop by hand, or you download or create new layouts or colorschemes, you will need to put the layout files where gotop can find them. To see the list of directories gotop looks for files, run `gotop -h`. The first directory is always the directory from which gotop is run.
+
### Arch
AUR contains entries for `gotop` and `gotop-bin`. `gotop-git` still points at the old, unmaintained, repository for the moment.
@@ -43,7 +45,7 @@ gotop can be installed with [Homebrew](https://brew.sh/); you'll need to tap the
brew uninstall gotop # If previously installed
brew untap cjbassi/gotop # If previously tapped
brew tap xxxserxxx/gotop
-brew install xxxserxxx/gotop
+brew install xxxserxxx/gotop/gotop
```
### Prebuilt binaries
@@ -141,10 +143,7 @@ and these are separated by spaces.
3. Spaces are compressed (so you can do limited visual formatting)
4. Legal widget names are: cpu, disk, mem, temp, batt, net, procs
5. Widget names are not case sensitive
-4. The simplest row is a single widget, by name, e.g.
- ```
- cpu
- ```
+4. The simplest row is a single widget, by name, e.g. `cpu`
5. **Weights**
1. Widgets with no weights have a weight of 1.
2. If multiple widgets are put on a row with no weights, they will all have
@@ -152,29 +151,35 @@ and these are separated by spaces.
3. Weights are integers
4. A widget will have a width proportional to its weight divided by the
total weight count of the row. E.g.,
+
```
cpu net
disk/2 mem/4
```
+
The first row will have two widgets: the CPU and network widgets; each
will be 50% of the total width wide. The second row will have two
widgets: disk and memory; the first will be 2/6 ~= 33% wide, and the
second will be 5/7 ~= 67% wide (or, memory will be twice as wide as disk).
-9. If prefixed by a number and colon, the widget will span that number of
- rows downward. E.g.
- ```
- mem 2:cpu
- net
- ```
- Here, memory and network will be in the same row as CPU, one over the other,
- and each half as high as CPU; it'll look like this:
- ```
- +------+------+
- | Mem | |
- +------+ CPU |
- | Net | |
- +------+------+
- ```
+9. If prefixed by a number and colon, the widget will span that number of
+ rows downward. E.g.
+
+ ```
+ mem 2:cpu
+ net
+ ```
+
+ Here, memory and network will be in the same row as CPU, one over the other,
+ and each half as high as CPU; it'll look like this:
+
+ ```
+ +------+------+
+ | Mem | |
+ +------+ CPU |
+ | Net | |
+ +------+------+
+ ```
+
10. Negative, 0, or non-integer weights will be recorded as "1". Same for row
spans.
11. Unrecognized widget names will cause the application to abort.
@@ -229,6 +234,10 @@ Interfaces can also be ignored using `!`
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
- [distatus/battery](https://github.com/distatus/battery)
+## History
+
+The original author of gotop started a new tool in Rust, called [ytop](https://github.com/cjbassi/ytop). This repository is a fork of original gotop project with a new maintainer.
+
## Stargazers over time
[![Stargazers over time](https://starcharts.herokuapp.com/xxxserxxx/gotop.svg)](https://starcharts.herokuapp.com/xxxserxxx/gotop)
diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go
index 1533d74..52da589 100644
--- a/cmd/gotop/main.go
+++ b/cmd/gotop/main.go
@@ -53,7 +53,12 @@ var (
// TODO: Virtual devices from Prometeus metrics @feature
// TODO: Abstract out the UI toolkit. mum4k/termdash, VladimirMarkelov/clui, gcla/gowid, rivo/tview, marcusolsson/tui-go might work better for some OS/Archs. Performance/memory use comparison would be interesting.
func parseArgs(conf *gotop.Config) error {
- usage := `
+ cds := conf.ConfigDir.QueryFolders(configdir.All)
+ cpaths := make([]string, len(cds))
+ for i, p := range cds {
+ cpaths[i] = p.Path
+ }
+ usage := fmt.Sprintf(`
Usage: gotop [options]
Options:
@@ -76,6 +81,9 @@ Options:
--print-paths List out the paths that gotop will look for gotop.conf, layouts, color schemes, and extensions
--print-keys Show the keyboard bindings
+Colorschemes and layouts that are not built-in are searched for (in order) in:
+%s
+The first path in this list is always the cwd.
Built-in layouts:
default
@@ -91,7 +99,7 @@ Colorschemes:
solarized16-light
monokai
vice
-`
+`, strings.Join(cpaths, ", "))
var err error
conf.Colorscheme, err = colorschemes.FromName(conf.ConfigDir, "default")
diff --git a/config.go b/config.go
index de543d3..41b5278 100644
--- a/config.go
+++ b/config.go
@@ -42,6 +42,7 @@ func (conf *Config) Load() error {
cfn := "gotop.conf"
folder := conf.ConfigDir.QueryFolderContainsFile(cfn)
if folder != nil {
+ // FIXME: Shouldn't this be looking in folder??
if cf, err := os.Open(cfn); err == nil {
defer cf.Close()
} else {