Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shravanasati committed Jan 22, 2024
1 parent b5501eb commit 4bafc4a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 46 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# atomic

[![Continuous integration](https://github.com/Shravan-1908/atomic/actions/workflows/integrate.yml/badge.svg)](https://github.com/Shravan-1908/atomic/actions/workflows/integrate.yml)
[![Continuous integration](https://github.com/shravanasati/atomic/actions/workflows/integrate.yml/badge.svg)](https://github.com/shravanasati/atomic/actions/workflows/integrate.yml)

![bench_demo](assets/demo.png)

Expand Down Expand Up @@ -28,7 +28,7 @@
Execute the following command in bash:

```bash
curl https://raw.githubusercontent.com/Shravan-1908/atomic/master/scripts/linux_install.sh > bench_install.sh
curl https://raw.githubusercontent.com/shravanasati/atomic/master/scripts/linux_install.sh > bench_install.sh

chmod +x ./bench_install.sh

Expand All @@ -41,7 +41,7 @@ bash ./bench_install.sh
Execute the following command in bash:

```bash
curl https://raw.githubusercontent.com/Shravan-1908/atomic/master/scripts/macos_install.sh > bench_install.sh
curl https://raw.githubusercontent.com/shravanasati/atomic/master/scripts/macos_install.sh > bench_install.sh

chmod +x ./bench_install.sh

Expand All @@ -52,7 +52,7 @@ bash ./bench_install.sh

Open Powershell **as Admin** and execute the following command:
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; (Invoke-WebRequest -Uri https://raw.githubusercontent.com/Shravan-1908/atomic/master/scripts/windows_install.ps1 -UseBasicParsing).Content | powershell -
Set-ExecutionPolicy Bypass -Scope Process -Force; (Invoke-WebRequest -Uri https://raw.githubusercontent.com/shravanasati/atomic/master/scripts/windows_install.ps1 -UseBasicParsing).Content | powershell -
```

To verify the installation of *atomic*, open a new shell and execute `atomic -v`. You should see output like this:
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Shravan-1908/atomic
module github.com/shravanasati/atomic

go 1.21

Expand All @@ -8,14 +8,14 @@ require (
)

require (
github.com/Shravan-1908/clapper v0.0.0-20240106171030-4cb053440d78 // indirect
github.com/shravanasati/clapper v0.0.0-20240106171030-4cb053440d78 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
github.com/rivo/uniseg v0.4.4 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/term v0.14.0 // indirect
)

require (
github.com/Shravan-1908/commando v1.0.5-0.20240106171728-b783c987b625
github.com/shravanasati/commando v1.0.5-0.20240106171728-b783c987b625
github.com/schollz/progressbar/v3 v3.14.1
)
29 changes: 0 additions & 29 deletions go.sum

This file was deleted.

2 changes: 1 addition & 1 deletion internal/check_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func CheckForUpdates(currentVersion string, updateCh *chan string) {
return
}

url := "https://api.github.com/repos/Shravan-1908/atomic/releases/latest"
url := "https://api.github.com/repos/shravanasati/atomic/releases/latest"
releaseInfo := releaseInfo{}
resp, err := http.Get(url)
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions internal/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ func FilterFunc[T any, Ts ~[]T](function func(T) bool, slice Ts) Ts {
return filtered
}

// ReduceFunc reduces the given slice to a single value by repeatedly applying the given function over the slice.
// func ReduceFunc[S ~[]T, T any, O any](function func(T, T) O, slice S, initial O) T {
// var accumulated O = initial
// for _, v := range slice {
// accumulated = function(accumulated, v)
// }
// return accumulated
// }

// writeToFile writes text string to the given filename.
func writeToFile(text, filename string) (err error) {
f, err := os.Create(filename)
Expand Down
12 changes: 6 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"strings"
"time"

"github.com/Shravan-1908/atomic/internal"
"github.com/Shravan-1908/commando"
"github.com/shravanasati/atomic/internal"
"github.com/shravanasati/commando"

Check failure on line 19 in main.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/shravanasati/commando (imported by github.com/shravanasati/atomic); to add:
"github.com/google/shlex"

Check failure on line 20 in main.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/google/shlex (imported by github.com/shravanasati/atomic); to add:
"github.com/mitchellh/colorstring"

Check failure on line 21 in main.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/mitchellh/colorstring (imported by github.com/shravanasati/atomic); to add:
"github.com/schollz/progressbar/v3"

Check failure on line 22 in main.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/schollz/progressbar/v3 (imported by github.com/shravanasati/atomic); to add:
Expand Down Expand Up @@ -205,7 +205,6 @@ var MinDuration = (3 * time.Second).Microseconds()
// 1. Minimum number of runs to be performed: 10
// 2. Minimum duration the benchmark should last: 3s
func determineRuns(singleRuntime time.Duration) int {
// todo adjust runs based on running average
if (singleRuntime.Microseconds() * int64(MinRuns)) > MinDuration {
return MinRuns
} else {
Expand Down Expand Up @@ -390,7 +389,8 @@ func Benchmark(opts BenchmarkOptions) ([]*RunResult, bool) {
cleanupResult := emptyRunResult()

// automatically determine runs
if opts.runs < 0 {
autoRuns := opts.runs < 0
if autoRuns {
startI = 2
if opts.executePrepareCmd {
prepareResult = RunCommand(&prepareRunOpts)
Expand Down Expand Up @@ -455,7 +455,7 @@ func Benchmark(opts BenchmarkOptions) ([]*RunResult, bool) {
}
bar.Add(1)
if opts.executeCleanupCmd {
cleanupResult := RunCommand(&cleanupRunOpts)
cleanupResult = RunCommand(&cleanupRunOpts)
if errors.As(cleanupResult.err, &processErr) {
processErr.handle()
return nil, true
Expand All @@ -477,7 +477,7 @@ func main() {
commando.
SetExecutableName(NAME).
SetVersion(VERSION).
SetDescription("atomic is a simple CLI tool to benchmark commands. \nFor more info visit https://github.com/Shravan-1908/atomic.")
SetDescription("atomic is a simple CLI tool to benchmark commands. \nFor more info visit https://github.com/shravanasati/atomic.")

defaultShellValue, err := getDefaultShell()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion scripts/linux_install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

echo "Downloading atomic..."
curl -L "https://github.com/Shravan-1908/atomic/releases/latest/download/atomic-linux-amd64" -o atomic
curl -L "https://github.com/shravanasati/atomic/releases/latest/download/atomic-linux-amd64" -o atomic

echo "Adding atomic into PATH..."

Expand Down
2 changes: 1 addition & 1 deletion scripts/macos_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#!/bin/bash

echo "Downloading atomic..."
curl -L "https://github.com/Shravan-1908/atomic/releases/latest/download/atomic-darwin-amd64" -o atomic
curl -L "https://github.com/shravanasati/atomic/releases/latest/download/atomic-darwin-amd64" -o atomic

echo "Adding atomic into PATH..."

Expand Down
2 changes: 1 addition & 1 deletion scripts/windows_install.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Write-Host "Downloading atomic..."

$url = "https://github.com/Shravan-1908/atomic/releases/latest/download/atomic-windows-amd64.exe"
$url = "https://github.com/shravanasati/atomic/releases/latest/download/atomic-windows-amd64.exe"

$dir = $env:USERPROFILE + "\.atomic"
$filepath = $env:USERPROFILE + "\.atomic\atomic.exe"
Expand Down

0 comments on commit 4bafc4a

Please sign in to comment.