Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,4 @@ version: "2"
linters:
settings:
govet:
# Disable all analyzers.
# Default: false
#disable-all: true
# Enable analyzers by name.
# Default: []
#enable: []
# Enable all analyzers.
# Default: false
#enable-all: true
# Disable analyzers by name.
# Default: []
disable: [printf]
# Settings per analyzer.
#settings:
# # Analyzer name, run `go tool vet help` to see all analyzers.
# #printf:
# # # Comma-separated list of print function names to check.
# # # Default: []
# # funcs: []
# #shadow:
# # # Whether to be strict about shadowing; can be noisy.
# # # Default: false
# # #strict: true
# #unusedresult:
# # # Comma-separated list of functions whose results must be used.
# # # Default: []
# # #funcs: [pkg.MyFunc]
# # # Comma-separated list of names of methods of type func() string whose results must be used.
# # # Default: []
# # #stringmethods: [MyMethod]
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Install Release

[![Homebrew](https://img.shields.io/badge/homebrew-gray?style=flat-square&logo=homebrew)](#homebrew)
[![Bash](https://img.shields.io/badge/bash-gray?style=flat-square&logo=stackedit&logoColor=white)](#bash)
[![Bash](https://img.shields.io/badge/bash-gray?style=flat-square&logo=educative&logoColor=white)](#bash)
[![Powershell](https://img.shields.io/badge/powershell-gray?style=flat-square&logo=cashapp&logoColor=lightblue)](#powershell)
[![Go](https://img.shields.io/badge/source-gray?style=flat-square&logo=go)](#source)
[![Docker Installer](https://img.shields.io/badge/docker_installer-gray?style=flat-square&logo=docker)](#docker)
Expand Down Expand Up @@ -113,9 +113,10 @@ Install using many formats:

```shell
ir owner repo
ir owner repo tag
ir owner/repo
ir owner repo tag
ir owner/repo tag
ir owner/repo/tag
ir owner/repo:tag
ir owner/repo@tag
```
Expand Down Expand Up @@ -208,7 +209,7 @@ If you run into any issues or need help getting started, please do one of the fo

[![Features](https://img.shields.io/badge/features-brightgreen?style=for-the-badge&logo=rocket&logoColor=white)](https://github.com/smashedr/install-release/issues/new?template=1-feature.yaml)
[![Issues](https://img.shields.io/badge/issues-red?style=for-the-badge&logo=southwestairlines&logoColor=white)](https://github.com/smashedr/install-release/issues)
[![Discussions](https://img.shields.io/badge/discussions-blue?style=for-the-badge&logo=theconversation&logoColor=white)](https://github.com/smashedr/install-release/discussions)
[![Discussions](https://img.shields.io/badge/discussions-blue?style=for-the-badge&logo=livechat&logoColor=white)](https://github.com/smashedr/install-release/discussions)
[![Discord](https://img.shields.io/badge/discord-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/wXy6m2X8wY)

# Contributing
Expand All @@ -221,3 +222,11 @@ and [additional](https://cssnr.com/) open source projects.
[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cssnr)

For a full list of current projects visit: [https://cssnr.github.io/](https://cssnr.github.io/)

<a href="https://github.com/smashedr/install-release/stargazers">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=smashedr/install-release&type=date&legend=top-left&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=smashedr/install-release&type=date&legend=top-left" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=smashedr/install-release&type=date&legend=top-left" />
</picture>
</a>
55 changes: 30 additions & 25 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,23 @@ tasks:

lint:
desc: Lint
cmd: |
prettier --check .
yamllint -c .github/yamllint.yaml .
golangci-lint run
actionlint -shellcheck="-e SC2129"
hadolint Dockerfile
cmds:
- prettier --check .
- yamllint -c .github/yamllint.yaml .
- golangci-lint run
- actionlint -shellcheck="-e SC2129"
- hadolint Dockerfile
- task: pslint

pslint:
platforms: [windows]
cmd: powershell -Command "Invoke-ScriptAnalyzer -Path scripts -Recurse"

clean:
desc: Clean All
cmd: |
rm -rf dist/client
rm -rf out
cmds:
- rm -rf dist/client
- rm -rf out

build:
desc: GoReleaser Build
Expand All @@ -41,9 +46,9 @@ tasks:

docs:
desc: Zensical Docs
cmd: |
rm -rf .cache
zensical serve --open
cmds:
- rm -rf .cache
- zensical serve --open

inno:
aliases: [setup]
Expand All @@ -64,21 +69,21 @@ tasks:
vars:
TARGET_NAME: '{{.EXE}}{{if eq OS "windows"}}.exe{{end}}'
TARGET_DIR: '${HOME}{{if eq OS "windows"}}\bin\{{else}}/bin/{{end}}{{.TARGET_NAME}}'
cmd: |
go build -o {{.TARGET_NAME}}
echo "Name: {{.TARGET_NAME}}"
mv "{{.TARGET_NAME}}" "{{.TARGET_DIR}}"
echo "Path: {{.TARGET_DIR}}"
which {{.TARGET_NAME}}
{{.TARGET_NAME}} -V
cmds:
- go build -o "{{.TARGET_NAME}}"
- echo "Name {{.TARGET_NAME}}"
- mv "{{.TARGET_NAME}}" "{{.TARGET_DIR}}"
- echo Path "{{.TARGET_DIR}}"
- which "{{.TARGET_NAME}}"
- "{{.TARGET_NAME}} -V"

vhs:*:
desc: Create VHS Tape
vars:
TAPE_FILE: '{{index .MATCH 0 | default "demo"}}'
cmd: |
echo "Creating Tape - assets/{{.TAPE_FILE}}.tape"
vhs "assets/{{.TAPE_FILE}}.tape"
cmds:
- echo "Creating Tape assets/{{.TAPE_FILE}}.tape"
- vhs "assets/{{.TAPE_FILE}}.tape"

build:*:*:
desc: Build OS:ARCH
Expand All @@ -91,6 +96,6 @@ tasks:
enum: [darwin, linux, windows]
- name: ARCH
enum: [amd64, arm64, "386"]
cmd: |
echo "Building: {{.OS}} / {{.ARCH}}"
GOOS={{.OS}} GOARCH={{.ARCH}} goreleaser build --snapshot --clean --single-target {{.CLI_ARGS}}
cmds:
- echo "Building {{.OS}} / {{.ARCH}}"
- GOOS={{.OS}} GOARCH={{.ARCH}} goreleaser build --snapshot --clean --single-target {{.CLI_ARGS}}
6 changes: 3 additions & 3 deletions cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ var infoCmd = &cobra.Command{
log.Warn(err)
}

styles.PrintKV("Executable:", executable)
styles.PrintKV("Config Used:", viper.ConfigFileUsed())
styles.PrintKV("Bin Path:", binPath)
styles.PrintKV("Executable", executable)
styles.PrintKV("Config Used", viper.ConfigFileUsed())
styles.PrintKV("Bin Path", binPath)

fmt.Printf("To get package info, run:\n")
fmt.Println(styles.Command.Render("ir info owner/repo"))
Expand Down
40 changes: 25 additions & 15 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func runInstall(cmd *cobra.Command, args []string) error { // NOSONAR
tagDisplay = "latest"
}
}
styles.PrintKV("Repository:", fmt.Sprintf("%s/%s:%s", owner, repo, tagDisplay))
styles.PrintKV("Repository", fmt.Sprintf("%s/%s:%s", owner, repo, tagDisplay))

client := getClient()

Expand All @@ -74,7 +74,7 @@ func runInstall(cmd *cobra.Command, args []string) error { // NOSONAR
log.Debugf("release: %v", release)
}

//styles.PrintKV("Version:", fmt.Sprintf("%s (%s)", release.GetTagName(), release.GetName()))
//styles.PrintKV("Version", fmt.Sprintf("%s (%s)", release.GetTagName(), release.GetName()))
renderReleaseTable(release)

// Asset
Expand Down Expand Up @@ -114,7 +114,7 @@ func runInstall(cmd *cobra.Command, args []string) error { // NOSONAR

log.Infof("id: %v", asset.GetID())
log.Infof("url: %v", asset.GetBrowserDownloadURL())
styles.PrintKV("Asset Name:", asset.GetName())
styles.PrintKV("Asset Name", asset.GetName())

rc, _, err := client.Repositories.DownloadReleaseAsset(
context.Background(), owner, repo, asset.GetID(), http.DefaultClient,
Expand Down Expand Up @@ -223,7 +223,13 @@ func runInstall(cmd *cobra.Command, args []string) error { // NOSONAR

// Move it to binPath
destPath := filepath.Join(binPath, destName)
styles.PrintKV("Destination:", destPath)
log.Infof("destPath: %v", destPath)
destDisplay := destPath
log.Debugf("DOCKER: %v", os.Getenv("DOCKER"))
if os.Getenv("DOCKER") == "true" {
destDisplay = fmt.Sprintf("-v <bin>/%s", binPath)
}
styles.PrintKV("Destination", destDisplay)
if err := os.Rename(binaryFilePath, destPath); err != nil {
log.Infof("os.Rename failed (copying): %v", err)
// Read the file content
Expand All @@ -245,7 +251,7 @@ func runInstall(cmd *cobra.Command, args []string) error { // NOSONAR
log.Warnf("Bin directory not in PATH: %v", binPath)
}

styles.PrintKV("Installed:", destName)
styles.PrintKV("Installed", destName)
return nil
}

Expand Down Expand Up @@ -430,22 +436,26 @@ func ensureWinExt(destName string) string {
}

func parseRepository(args []string) (owner, repo, tag string, err error) {
helpErr := errors.New("repository must be in format: owner/repo[:tag]")
log.Debugf("parseRepository: %v", len(args))
helpErr := errors.New("repository format: owner/repo[:tag]")
log.Debugf("parseRepository %v: %v", len(args), args)
switch len(args) {
case 0:
return "", "", "", helpErr
case 1:
repository := args[0]
if strings.Contains(repository, ":") {
split := strings.Split(repository, ":")
repository = split[0]
tag = split[1]
} else if strings.Contains(repository, "@") {
split := strings.Split(repository, "@")
repository = split[0]
tag = split[1]
// Check for :tag @tag /tag
if idx := strings.IndexAny(args[0], ":@"); idx != -1 {
log.Debugf("idx: %v", idx)
repository = args[0][:idx]
tag = args[0][idx+1:]
} else if strings.Count(args[0], "/") == 2 {
split := strings.Split(args[0], "/")
if split[2] != "" {
repository = split[0] + "/" + split[1]
tag = split[2]
}
}
// Set owner/repo
split := strings.Split(repository, "/")
if len(split) != 2 {
return "", "", "", helpErr
Expand Down
4 changes: 2 additions & 2 deletions cmd/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ var pathCmd = &cobra.Command{
switch command {
case "a", "ad", "add":
// NOTE: Add output here and remove from AddDirToPath
added, ret, err := pathmgr.AddDirToPath(path, 1, 0)
added, err := pathmgr.AddDirToPath(path)
if err != nil {
log.Fatalf("pathmgr.AddDirToPath: %v", err)
}
log.Info("AddDirToPath", "added", added, "ret", ret, "err", err)
log.Info("AddDirToPath", "added", added)
case "r", "re", "rem", "remove":
log.Fatal("INOP: The remove command is not yet functional...")
case "c", "ch", "chk", "check":
Expand Down
2 changes: 1 addition & 1 deletion cmd/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var removeCmd = &cobra.Command{
if err := os.Remove(path); err != nil {
log.Fatalf("prompt error: %v", err)
}
styles.PrintKV("Removed:", name)
styles.PrintKV("Removed", name)
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var testCmd = &cobra.Command{
//}
//fmt.Print(strings.TrimLeft(out, "\n"))
//
//styles.PrintKV("Release URL:", release.GetHTMLURL())
//styles.PrintKV("Release URL", release.GetHTMLURL())
//return

homeDir, err := os.UserHomeDir()
Expand Down
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ Install using many formats:

```shell
ir owner repo
ir owner repo tag
ir owner/repo
ir owner repo tag
ir owner/repo tag
ir owner/repo/tag
ir owner/repo:tag
ir owner/repo@tag
```
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ require (
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.20 // indirect
github.com/mikelolasagasti/xz v1.0.1 // indirect
github.com/minio/minlz v1.0.1 // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
Expand All @@ -67,7 +67,7 @@ require (
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
go4.org v0.0.0-20260112195520-a5071408f32f // indirect
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a // indirect
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/mattn/go-runewidth v0.0.20 h1:WcT52H91ZUAwy8+HUkdM3THM6gXqXuLJi9O3rjcQQaQ=
github.com/mattn/go-runewidth v0.0.20/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/mholt/archives v0.1.5 h1:Fh2hl1j7VEhc6DZs2DLMgiBNChUux154a1G+2esNvzQ=
github.com/mholt/archives v0.1.5/go.mod h1:3TPMmBLPsgszL+1As5zECTuKwKvIfj6YcwWPpeTAXF4=
github.com/mikelolasagasti/xz v1.0.1 h1:Q2F2jX0RYJUG3+WsM+FJknv+6eVjsjXNDV0KJXZzkD0=
Expand Down Expand Up @@ -172,8 +172,8 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
go4.org v0.0.0-20260112195520-a5071408f32f h1:ziUVAjmTPwQMBmYR1tbdRFJPtTcQUI12fH9QQjfb0Sw=
go4.org v0.0.0-20260112195520-a5071408f32f/go.mod h1:ZRJnO5ZI4zAwMFp+dS1+V6J6MSyAowhRqAE+DPa1Xp0=
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a h1:ovFr6Z0MNmU7nH8VaX5xqw+05ST2uO1exVfZPVqRC5o=
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa h1:Zt3DZoOFFYkKhDT3v7Lm9FDMEV06GpzjG2jrqW+QTE0=
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
6 changes: 3 additions & 3 deletions internal/pathmgr/pathmgr_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/charmbracelet/log"
)

func AddDirToPath(dirPath string, pathType, addType int) (bool, int, error) {
log.Debug("AddDirToPath", "dirPath", dirPath, "pathType", pathType, "addType", addType)
return false, 0, fmt.Errorf("not yet implemented on unix")
func AddDirToPath(dirPath string) (bool, error) {
log.Debug("AddDirToPath", "dirPath", dirPath)
return false, fmt.Errorf("not yet implemented on unix")
}
6 changes: 3 additions & 3 deletions internal/pathmgr/pathmgr_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/charmbracelet/log"
)

func AddDirToPath(dirPath string, pathType, addType int) (bool, int, error) {
log.Debug("AddDirToPath", "dirPath", dirPath, "pathType", pathType, "addType", addType)
return false, 0, fmt.Errorf("not yet implemented on windows")
func AddDirToPath(dirPath string) (bool, error) {
log.Debug("AddDirToPath", "dirPath", dirPath)
return false, fmt.Errorf("not yet implemented on windows")
}
Loading