diff options
author | Sean E. Russell <seanerussell@gmail.com> | 2020-02-13 10:15:52 -0600 |
---|---|---|
committer | Sean E. Russell <seanerussell@gmail.com> | 2020-02-13 10:15:52 -0600 |
commit | 7e5c0c969c223973335c6fae5432411afc3fb060 (patch) | |
tree | 7f785ba4f692b81806209cb5f0c959e86efdba70 | |
parent | 4bfe0251a8893ed08654d59b8a8b8182958e907f (diff) |
Fixes the directory structure.
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | cmd/gotop/main.go (renamed from main.go) | 24 | ||||
-rw-r--r-- | config.go (renamed from src/config/config.go) | 4 | ||||
-rw-r--r-- | layout/layout.go (renamed from src/layout/layout.go) | 11 | ||||
-rw-r--r-- | layout/layout_test.go (renamed from src/layout/layout_test.go) | 0 | ||||
-rw-r--r-- | layout/parser.go (renamed from src/layout/parser.go) | 0 | ||||
-rw-r--r-- | logging/logging_arm64.go (renamed from src/logging/logging_arm64.go) | 0 | ||||
-rw-r--r-- | logging/logging_other.go (renamed from src/logging/logging_other.go) | 0 | ||||
-rw-r--r-- | termui/drawille-go/LICENSE.md (renamed from src/termui/drawille-go/LICENSE.md) | 0 | ||||
-rw-r--r-- | termui/drawille-go/README.md (renamed from src/termui/drawille-go/README.md) | 0 | ||||
-rw-r--r-- | termui/drawille-go/drawille.go (renamed from src/termui/drawille-go/drawille.go) | 0 | ||||
-rw-r--r-- | termui/linegraph.go (renamed from src/termui/linegraph.go) | 2 | ||||
-rw-r--r-- | termui/sparkline.go (renamed from src/termui/sparkline.go) | 0 | ||||
-rw-r--r-- | termui/table.go (renamed from src/termui/table.go) | 0 | ||||
-rw-r--r-- | utils/bytes.go (renamed from src/utils/bytes.go) | 0 | ||||
-rw-r--r-- | utils/conversions.go (renamed from src/utils/conversions.go) | 0 | ||||
-rw-r--r-- | utils/math.go (renamed from src/utils/math.go) | 0 | ||||
-rw-r--r-- | utils/xdg.go (renamed from src/utils/xdg.go) | 0 | ||||
-rw-r--r-- | widgets/battery.go (renamed from src/widgets/battery.go) | 2 | ||||
-rw-r--r-- | widgets/cpu.go (renamed from src/widgets/cpu.go) | 2 | ||||
-rw-r--r-- | widgets/disk.go (renamed from src/widgets/disk.go) | 4 | ||||
-rw-r--r-- | widgets/help.go (renamed from src/widgets/help.go) | 0 | ||||
-rw-r--r-- | widgets/include/smc.c (renamed from src/widgets/include/smc.c) | 0 | ||||
-rw-r--r-- | widgets/include/smc.h (renamed from src/widgets/include/smc.h) | 0 | ||||
-rw-r--r-- | widgets/mem.go (renamed from src/widgets/mem.go) | 4 | ||||
-rw-r--r-- | widgets/mem_freebsd.go (renamed from src/widgets/mem_freebsd.go) | 2 | ||||
-rw-r--r-- | widgets/mem_other.go (renamed from src/widgets/mem_other.go) | 0 | ||||
-rw-r--r-- | widgets/net.go (renamed from src/widgets/net.go) | 4 | ||||
-rw-r--r-- | widgets/proc.go (renamed from src/widgets/proc.go) | 4 | ||||
-rw-r--r-- | widgets/proc_freebsd.go (renamed from src/widgets/proc_freebsd.go) | 2 | ||||
-rw-r--r-- | widgets/proc_linux.go (renamed from src/widgets/proc_linux.go) | 0 | ||||
-rw-r--r-- | widgets/proc_other.go (renamed from src/widgets/proc_other.go) | 2 | ||||
-rw-r--r-- | widgets/proc_windows.go (renamed from src/widgets/proc_windows.go) | 0 | ||||
-rw-r--r-- | widgets/scalable.go (renamed from src/widgets/scalable.go) | 0 | ||||
-rw-r--r-- | widgets/statusbar.go (renamed from src/widgets/statusbar.go) | 0 | ||||
-rw-r--r-- | widgets/temp.go (renamed from src/widgets/temp.go) | 2 | ||||
-rw-r--r-- | widgets/temp_darwin.go (renamed from src/widgets/temp_darwin.go) | 2 | ||||
-rw-r--r-- | widgets/temp_freebsd.go (renamed from src/widgets/temp_freebsd.go) | 2 | ||||
-rw-r--r-- | widgets/temp_linux.go (renamed from src/widgets/temp_linux.go) | 2 | ||||
-rw-r--r-- | widgets/temp_openbsd.go (renamed from src/widgets/temp_openbsd.go) | 2 | ||||
-rw-r--r-- | widgets/temp_windows.go (renamed from src/widgets/temp_windows.go) | 2 |
41 files changed, 42 insertions, 41 deletions
@@ -1,5 +1,3 @@ -### **NO LONGER MAINTAINED.** Future development has moved to [ytop](https://github.com/cjbassi/ytop), a Rust port of gotop. - <div align="center"> <a href="./assets/logo"> @@ -116,6 +114,8 @@ To make a custom colorscheme, check out the [template](./colorschemes/template.g `-s`, `--statusbar` Show a statusbar with the time. `-b`, `--battery` Show battery level widget (`minimal` turns off). [preview](./assets/screenshots/battery.png) `-i`, `--interface=NAME` Select network interface [default: all]. +`-l`, `--layout=NAME` Choose a layout from definitions in the \$XDG_CONFIG_HOME/gotop directory +`--layout-file=NAME` Provide a path to a layout file to use (useful for mucking about with layouts) ## Built With diff --git a/main.go b/cmd/gotop/main.go index f963f58..c3e19c4 100644 --- a/main.go +++ b/cmd/gotop/main.go @@ -17,12 +17,12 @@ import ( docopt "github.com/docopt/docopt.go" ui "github.com/gizak/termui/v3" + "github.com/cjbassi/gotop" "github.com/cjbassi/gotop/colorschemes" - "github.com/cjbassi/gotop/src/config" - "github.com/cjbassi/gotop/src/layout" - "github.com/cjbassi/gotop/src/logging" - "github.com/cjbassi/gotop/src/utils" - w "github.com/cjbassi/gotop/src/widgets" + "github.com/cjbassi/gotop/layout" + "github.com/cjbassi/gotop/logging" + "github.com/cjbassi/gotop/utils" + w "github.com/cjbassi/gotop/widgets" ) const ( @@ -34,14 +34,14 @@ const ( ) var ( - conf config.Config + conf gotop.Config help *w.HelpMenu bar *w.StatusBar statusbar bool stderrLogger = log.New(os.Stderr, "", 0) ) -func parseArgs() (config.Config, error) { +func parseArgs() (gotop.Config, error) { usage := ` Usage: gotop [options] @@ -70,7 +70,7 @@ Colorschemes: ld := utils.GetLogDir(appName) cd := utils.GetConfigDir(appName) - conf = config.Config{ + conf = gotop.Config{ ConfigDir: cd, LogDir: ld, LogPath: filepath.Join(ld, "errors.log"), @@ -164,7 +164,7 @@ func handleColorscheme(c string) (colorschemes.Colorscheme, error) { } // getCustomColorscheme tries to read a custom json colorscheme from <configDir>/<name>.json -func getCustomColorscheme(c config.Config, name string) (colorschemes.Colorscheme, error) { +func getCustomColorscheme(c gotop.Config, name string) (colorschemes.Colorscheme, error) { var cs colorschemes.Colorscheme filePath := filepath.Join(c.ConfigDir, name+".json") dat, err := ioutil.ReadFile(filePath) @@ -178,13 +178,13 @@ func getCustomColorscheme(c config.Config, name string) (colorschemes.Colorschem return cs, nil } -func setDefaultTermuiColors(c config.Config) { +func setDefaultTermuiColors(c gotop.Config) { ui.Theme.Default = ui.NewStyle(ui.Color(c.Colorscheme.Fg), ui.Color(c.Colorscheme.Bg)) ui.Theme.Block.Title = ui.NewStyle(ui.Color(c.Colorscheme.BorderLabel), ui.Color(c.Colorscheme.Bg)) ui.Theme.Block.Border = ui.NewStyle(ui.Color(c.Colorscheme.BorderLine), ui.Color(c.Colorscheme.Bg)) } -func eventLoop(c config.Config, grid *layout.MyGrid) { +func eventLoop(c gotop.Config, grid *layout.MyGrid) { drawTicker := time.NewTicker(c.UpdateInterval).C // handles kill signal sent to gotop @@ -341,7 +341,7 @@ func eventLoop(c config.Config, grid *layout.MyGrid) { } } -func setupLogfile(c config.Config) (*os.File, error) { +func setupLogfile(c gotop.Config) (*os.File, error) { // create the log directory if err := os.MkdirAll(c.LogDir, 0755); err != nil { return nil, fmt.Errorf("failed to make the log directory: %v", err) diff --git a/src/config/config.go b/config.go index d2d2a4a..84298c5 100644 --- a/src/config/config.go +++ b/config.go @@ -1,10 +1,10 @@ -package config +package gotop import ( "time" "github.com/cjbassi/gotop/colorschemes" - "github.com/cjbassi/gotop/src/widgets" + "github.com/cjbassi/gotop/widgets" ) type Config struct { diff --git a/src/layout/layout.go b/layout/layout.go index 31404fc..e918bde 100644 --- a/src/layout/layout.go +++ b/layout/layout.go @@ -5,8 +5,9 @@ import ( "log" "sort" - "github.com/cjbassi/gotop/src/config" - "github.com/cjbassi/gotop/src/widgets" + "github.com/cjbassi/gotop" + "github.com/cjbassi/gotop/widgets" + ui "github.com/gizak/termui/v3" ) @@ -28,7 +29,7 @@ type MyGrid struct { var widgetNames []string = []string{"cpu", "disk", "mem", "temp", "net", "procs", "batt"} -func Layout(wl layout, c config.Config) (*MyGrid, error) { +func Layout(wl layout, c gotop.Config) (*MyGrid, error) { rowDefs := wl.Rows uiRows := make([]ui.GridItem, 0) numRows := countNumRows(wl.Rows) @@ -57,7 +58,7 @@ func Layout(wl layout, c config.Config) (*MyGrid, error) { // if there's a row span widget in the row; in this case, it'll consume as many // rows as the largest row span object in the row, and produce an uber-row // containing all that stuff. It returns a slice without the consumed elements. -func processRow(c config.Config, numRows int, rowDefs [][]widgetRule) (ui.GridItem, [][]widgetRule) { +func processRow(c gotop.Config, numRows int, rowDefs [][]widgetRule) (ui.GridItem, [][]widgetRule) { // Recursive function #3. See the comment in deepFindProc. if len(rowDefs) < 1 { return ui.GridItem{}, [][]widgetRule{} @@ -104,7 +105,7 @@ func processRow(c config.Config, numRows int, rowDefs [][]widgetRule) (ui.GridIt return ui.NewRow(1.0/float64(numRows), uiColumns...), rowDefs } -func makeWidget(c config.Config, widRule widgetRule) interface{} { +func makeWidget(c gotop.Config, widRule widgetRule) interface{} { var w interface{} switch widRule.Widget { case "cpu": diff --git a/src/layout/layout_test.go b/layout/layout_test.go index d1f016d..d1f016d 100644 --- a/src/layout/layout_test.go +++ b/layout/layout_test.go diff --git a/src/layout/parser.go b/layout/parser.go index 024fabb..024fabb 100644 --- a/src/layout/parser.go +++ b/layout/parser.go diff --git a/src/logging/logging_arm64.go b/logging/logging_arm64.go index 2b7a25f..2b7a25f 100644 --- a/src/logging/logging_arm64.go +++ b/logging/logging_arm64.go diff --git a/src/logging/logging_other.go b/logging/logging_other.go index 382baca..382baca 100644 --- a/src/logging/logging_other.go +++ b/logging/logging_other.go diff --git a/src/termui/drawille-go/LICENSE.md b/termui/drawille-go/LICENSE.md index 58777e3..58777e3 100644 --- a/src/termui/drawille-go/LICENSE.md +++ b/termui/drawille-go/LICENSE.md diff --git a/src/termui/drawille-go/README.md b/termui/drawille-go/README.md index b2ea77c..b2ea77c 100644 --- a/src/termui/drawille-go/README.md +++ b/termui/drawille-go/README.md diff --git a/src/termui/drawille-go/drawille.go b/termui/drawille-go/drawille.go index f9954d0..f9954d0 100644 --- a/src/termui/drawille-go/drawille.go +++ b/termui/drawille-go/drawille.go diff --git a/src/termui/linegraph.go b/termui/linegraph.go index fb98cca..86179a2 100644 --- a/src/termui/linegraph.go +++ b/termui/linegraph.go @@ -4,7 +4,7 @@ import ( "image" "sort" - drawille "github.com/cjbassi/gotop/src/termui/drawille-go" + drawille "github.com/cjbassi/gotop/termui/drawille-go" . "github.com/gizak/termui/v3" ) diff --git a/src/termui/sparkline.go b/termui/sparkline.go index 2f27d9e..2f27d9e 100644 --- a/src/termui/sparkline.go +++ b/termui/sparkline.go diff --git a/src/termui/table.go b/termui/table.go index eeb82af..eeb82af 100644 --- a/src/termui/table.go +++ b/termui/table.go diff --git a/src/utils/bytes.go b/utils/bytes.go index b06cf8c..b06cf8c 100644 --- a/src/utils/bytes.go +++ b/utils/bytes.go diff --git a/src/utils/conversions.go b/utils/conversions.go index 5d86ac4..5d86ac4 100644 --- a/src/utils/conversions.go +++ b/utils/conversions.go diff --git a/src/utils/math.go b/utils/math.go index b710ee6..b710ee6 100644 --- a/src/utils/math.go +++ b/utils/math.go diff --git a/src/utils/xdg.go b/utils/xdg.go index 8489042..8489042 100644 --- a/src/utils/xdg.go +++ b/utils/xdg.go diff --git a/src/widgets/battery.go b/widgets/battery.go index 706daf6..b6cab39 100644 --- a/src/widgets/battery.go +++ b/widgets/battery.go @@ -9,7 +9,7 @@ import ( "github.com/distatus/battery" - ui "github.com/cjbassi/gotop/src/termui" + ui "github.com/cjbassi/gotop/termui" ) type BatteryWidget struct { diff --git a/src/widgets/cpu.go b/widgets/cpu.go index 3d75dda..66da81c 100644 --- a/src/widgets/cpu.go +++ b/widgets/cpu.go @@ -8,7 +8,7 @@ import ( psCpu "github.com/shirou/gopsutil/cpu" - ui "github.com/cjbassi/gotop/src/termui" + ui "github.com/cjbassi/gotop/termui" ) type CpuWidget struct { diff --git a/src/widgets/disk.go b/widgets/disk.go index 6379284..f8b305b 100644 --- a/src/widgets/disk.go +++ b/widgets/disk.go @@ -9,8 +9,8 @@ import ( psDisk "github.com/shirou/gopsutil/disk" - ui "github.com/cjbassi/gotop/src/termui" - "github.com/cjbassi/gotop/src/utils" + ui "github.com/cjbassi/gotop/termui" + "github.com/cjbassi/gotop/utils" ) type Partition struct { diff --git a/src/widgets/help.go b/widgets/help.go index 54ddfbc..54ddfbc 100644 --- a/src/widgets/help.go +++ b/widgets/help.go diff --git a/src/widgets/include/smc.c b/widgets/include/smc.c index 0c200d6..0c200d6 100644 --- a/src/widgets/include/smc.c +++ b/widgets/include/smc.c diff --git a/src/widgets/include/smc.h b/widgets/include/smc.h index d837e11..d837e11 100644 --- a/src/widgets/include/smc.h +++ b/widgets/include/smc.h diff --git a/src/widgets/mem.go b/widgets/mem.go index a346f8f..5b4a82c 100644 --- a/src/widgets/mem.go +++ b/widgets/mem.go @@ -7,8 +7,8 @@ import ( psMem "github.com/shirou/gopsutil/mem" - ui "github.com/cjbassi/gotop/src/termui" - "github.com/cjbassi/gotop/src/utils" + ui "github.com/cjbassi/gotop/termui" + "github.com/cjbassi/gotop/utils" ) type MemWidget struct { diff --git a/src/widgets/mem_freebsd.go b/widgets/mem_freebsd.go index b3773c9..f3dd983 100644 --- a/src/widgets/mem_freebsd.go +++ b/widgets/mem_freebsd.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) func convert(s []string) (MemoryInfo, error) { diff --git a/src/widgets/mem_other.go b/widgets/mem_other.go index 6b78acb..6b78acb 100644 --- a/src/widgets/mem_other.go +++ b/widgets/mem_other.go diff --git a/src/widgets/net.go b/widgets/net.go index 3042a10..d90669f 100644 --- a/src/widgets/net.go +++ b/widgets/net.go @@ -7,8 +7,8 @@ import ( psNet "github.com/shirou/gopsutil/net" - ui "github.com/cjbassi/gotop/src/termui" - "github.com/cjbassi/gotop/src/utils" + ui "github.com/cjbassi/gotop/termui" + "github.com/cjbassi/gotop/utils" ) const ( diff --git a/src/widgets/proc.go b/widgets/proc.go index d48ed9a..29ad19c 100644 --- a/src/widgets/proc.go +++ b/widgets/proc.go @@ -10,8 +10,8 @@ import ( psCPU "github.com/shirou/gopsutil/cpu" - ui "github.com/cjbassi/gotop/src/termui" - "github.com/cjbassi/gotop/src/utils" + ui "github.com/cjbassi/gotop/termui" + "github.com/cjbassi/gotop/utils" ) const ( diff --git a/src/widgets/proc_freebsd.go b/widgets/proc_freebsd.go index dc4399b..a8b213d 100644 --- a/src/widgets/proc_freebsd.go +++ b/widgets/proc_freebsd.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) type processList struct { diff --git a/src/widgets/proc_linux.go b/widgets/proc_linux.go index 0045234..0045234 100644 --- a/src/widgets/proc_linux.go +++ b/widgets/proc_linux.go diff --git a/src/widgets/proc_other.go b/widgets/proc_other.go index 6e7c6a8..c0d13e7 100644 --- a/src/widgets/proc_other.go +++ b/widgets/proc_other.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) const ( diff --git a/src/widgets/proc_windows.go b/widgets/proc_windows.go index adc49e9..adc49e9 100644 --- a/src/widgets/proc_windows.go +++ b/widgets/proc_windows.go diff --git a/src/widgets/scalable.go b/widgets/scalable.go index e87de6d..e87de6d 100644 --- a/src/widgets/scalable.go +++ b/widgets/scalable.go diff --git a/src/widgets/statusbar.go b/widgets/statusbar.go index f610081..f610081 100644 --- a/src/widgets/statusbar.go +++ b/widgets/statusbar.go diff --git a/src/widgets/temp.go b/widgets/temp.go index 3a3add9..dea5430 100644 --- a/src/widgets/temp.go +++ b/widgets/temp.go @@ -8,7 +8,7 @@ import ( ui "github.com/gizak/termui/v3" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) type TempScale int diff --git a/src/widgets/temp_darwin.go b/widgets/temp_darwin.go index 28046a1..fb845b3 100644 --- a/src/widgets/temp_darwin.go +++ b/widgets/temp_darwin.go @@ -6,7 +6,7 @@ import "C" import ( "log" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) type TemperatureStat struct { diff --git a/src/widgets/temp_freebsd.go b/widgets/temp_freebsd.go index 2990123..5442268 100644 --- a/src/widgets/temp_freebsd.go +++ b/widgets/temp_freebsd.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) var sensorOIDS = map[string]string{ diff --git a/src/widgets/temp_linux.go b/widgets/temp_linux.go index 6901b6b..f73426c 100644 --- a/src/widgets/temp_linux.go +++ b/widgets/temp_linux.go @@ -6,7 +6,7 @@ import ( psHost "github.com/shirou/gopsutil/host" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) func (self *TempWidget) update() { diff --git a/src/widgets/temp_openbsd.go b/widgets/temp_openbsd.go index 8665c03..f04657c 100644 --- a/src/widgets/temp_openbsd.go +++ b/widgets/temp_openbsd.go @@ -12,7 +12,7 @@ import ( "syscall" "unsafe" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) func (self *TempWidget) getTemp(mib []C.int, mlen int, snsrdev *C.struct_sensordev, index int) { diff --git a/src/widgets/temp_windows.go b/widgets/temp_windows.go index a1cd47c..4486292 100644 --- a/src/widgets/temp_windows.go +++ b/widgets/temp_windows.go @@ -5,7 +5,7 @@ import ( psHost "github.com/shirou/gopsutil/host" - "github.com/cjbassi/gotop/src/utils" + "github.com/cjbassi/gotop/utils" ) func (self *TempWidget) update() { |