From 18d8a08449f50f30b8436c234dca4d61fb33c3e4 Mon Sep 17 00:00:00 2001 From: sqshq Date: Sun, 28 Jul 2019 20:32:15 -0400 Subject: [PATCH] =?UTF-8?q?1.0.0=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/FUNDING.yml | 2 ++ README.md | 8 +++++--- console/console.go | 2 +- main.go | 6 +++--- metadata/statistics.go | 1 + metadata/storage.go | 7 ++++--- 6 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..28bfa97 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +patreon: sampler +custom: ['http://sampler.dev/#pricing'] \ No newline at end of file diff --git a/README.md b/README.md index 602892a..6d0da6f 100644 --- a/README.md +++ b/README.md @@ -9,16 +9,18 @@ Sampler is a tool for shell commands execution, visualization and alerting. Conf ### macOS ```bash -sudo curl -Lo /usr/local/bin/sampler https://github.com/sqshq/sampler/releases/download/v0.9.1-beta/sampler-0.9.1-darwin-amd64 +sudo curl -Lo /usr/local/bin/sampler https://github.com/sqshq/sampler/releases/download/v1.0.0/sampler-1.0.0-darwin-amd64 sudo chmod +x /usr/local/bin/sampler ``` ### Linux ```bash -sudo wget https://github.com/sqshq/sampler/releases/download/v0.9.1-beta/sampler-0.9.1-linux-amd64 -O /usr/local/bin/sampler +sudo wget https://github.com/sqshq/sampler/releases/download/v1.0.0/sampler-1.0.0-linux-amd64 -O /usr/local/bin/sampler sudo chmod +x /usr/local/bin/sampler ``` ### Windows -[download .exe](https://github.com/sqshq/sampler/releases/download/v0.9.1-beta/sampler-0.9.1-windows) +Recommended to use with advanced console emulators, e.g. [Cmder](https://cmder.net/) + +[Download .exe](https://github.com/sqshq/sampler/releases/download/v1.0.0/sampler-1.0.0-windows-amd64.exe) ## Usage You specify shell commands, Sampler executes them with a required rate. The output is used for visualization. diff --git a/console/console.go b/console/console.go index 6665f3a..7824eba 100644 --- a/console/console.go +++ b/console/console.go @@ -14,7 +14,7 @@ const ( ColumnsCount = 80 RowsCount = 40 AppTitle = "sampler" - AppVersion = "0.9.1" + AppVersion = "1.0.0" AppLicenseWarning = "UNLICENSED. FOR NON-COMMERCIAL USE ONLY. VISIT WWW.SAMPLER.DEV" ) diff --git a/main.go b/main.go index ecb7609..0d7b492 100644 --- a/main.go +++ b/main.go @@ -76,9 +76,6 @@ func main() { statistics := metadata.GetStatistics(cfg) license := metadata.GetLicense() - defer handleCrash(statistics, opt, bc) - defer updateStatistics(cfg, time.Now()) - if opt.LicenseKey != nil { registerLicense(statistics, opt, bc) } @@ -89,6 +86,9 @@ func main() { player := asset.NewAudioPlayer() defer player.Close() + defer handleCrash(statistics, opt, bc) + defer updateStatistics(cfg, time.Now()) + palette := console.GetPalette(*cfg.Theme) lout := layout.NewLayout(component.NewStatusLine(*opt.ConfigFile, palette, license), component.NewMenu(palette), component.NewIntro(palette), component.NewNagWindow(palette)) diff --git a/metadata/statistics.go b/metadata/statistics.go index 2007aa6..a211f00 100644 --- a/metadata/statistics.go +++ b/metadata/statistics.go @@ -41,6 +41,7 @@ func PersistStatistics(config *config.Config, uptime time.Duration) *Statistics statistics.ComponentsCount = countComponentsPerType(config) } + statistics.Version = console.AppVersion statistics.WindowWidth = w statistics.WindowHeight = h statistics.LaunchCount += 1 diff --git a/metadata/storage.go b/metadata/storage.go index a0db7b7..f0d0f4c 100644 --- a/metadata/storage.go +++ b/metadata/storage.go @@ -11,7 +11,7 @@ import ( const ( macOSDir = "/Library/Application Support/Sampler" linuxDir = "/.config/Sampler" - windowsDir = "%LOCALAPPDATA%\\Sampler" + windowsDir = "Sampler" ) func fileExists(filename string) bool { @@ -20,12 +20,13 @@ func fileExists(filename string) bool { } func getPlatformStoragePath(filename string) string { - home, _ := os.UserHomeDir() switch runtime.GOOS { case "darwin": + home, _ := os.UserHomeDir() return filepath.Join(home, macOSDir, filename) case "windows": - return filepath.Join(home, windowsDir, filename) + cache, _ := os.UserCacheDir() + return filepath.Join(cache, windowsDir, filename) default: return filepath.Join(linuxDir, filename) }