Skip to content

Commit d5acf1e

Browse files
authored
Minor Updates (#31)
1 parent 4fd421b commit d5acf1e

13 files changed

Lines changed: 88 additions & 92 deletions

File tree

.golangci.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,4 @@ version: "2"
22
linters:
33
settings:
44
govet:
5-
# Disable all analyzers.
6-
# Default: false
7-
#disable-all: true
8-
# Enable analyzers by name.
9-
# Default: []
10-
#enable: []
11-
# Enable all analyzers.
12-
# Default: false
13-
#enable-all: true
14-
# Disable analyzers by name.
15-
# Default: []
165
disable: [printf]
17-
# Settings per analyzer.
18-
#settings:
19-
# # Analyzer name, run `go tool vet help` to see all analyzers.
20-
# #printf:
21-
# # # Comma-separated list of print function names to check.
22-
# # # Default: []
23-
# # funcs: []
24-
# #shadow:
25-
# # # Whether to be strict about shadowing; can be noisy.
26-
# # # Default: false
27-
# # #strict: true
28-
# #unusedresult:
29-
# # # Comma-separated list of functions whose results must be used.
30-
# # # Default: []
31-
# # #funcs: [pkg.MyFunc]
32-
# # # Comma-separated list of names of methods of type func() string whose results must be used.
33-
# # # Default: []
34-
# # #stringmethods: [MyMethod]

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Install Release
2222

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

114114
```shell
115115
ir owner repo
116-
ir owner repo tag
117116
ir owner/repo
117+
ir owner repo tag
118118
ir owner/repo tag
119+
ir owner/repo/tag
119120
ir owner/repo:tag
120121
ir owner/repo@tag
121122
```
@@ -208,7 +209,7 @@ If you run into any issues or need help getting started, please do one of the fo
208209

209210
[![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)
210211
[![Issues](https://img.shields.io/badge/issues-red?style=for-the-badge&logo=southwestairlines&logoColor=white)](https://github.com/smashedr/install-release/issues)
211-
[![Discussions](https://img.shields.io/badge/discussions-blue?style=for-the-badge&logo=theconversation&logoColor=white)](https://github.com/smashedr/install-release/discussions)
212+
[![Discussions](https://img.shields.io/badge/discussions-blue?style=for-the-badge&logo=livechat&logoColor=white)](https://github.com/smashedr/install-release/discussions)
212213
[![Discord](https://img.shields.io/badge/discord-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/wXy6m2X8wY)
213214

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

223224
For a full list of current projects visit: [https://cssnr.github.io/](https://cssnr.github.io/)
225+
226+
<a href="https://github.com/smashedr/install-release/stargazers">
227+
<picture>
228+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=smashedr/install-release&type=date&legend=top-left&theme=dark" />
229+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=smashedr/install-release&type=date&legend=top-left" />
230+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=smashedr/install-release&type=date&legend=top-left" />
231+
</picture>
232+
</a>

Taskfile.yml

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,23 @@ tasks:
1818

1919
lint:
2020
desc: Lint
21-
cmd: |
22-
prettier --check .
23-
yamllint -c .github/yamllint.yaml .
24-
golangci-lint run
25-
actionlint -shellcheck="-e SC2129"
26-
hadolint Dockerfile
21+
cmds:
22+
- prettier --check .
23+
- yamllint -c .github/yamllint.yaml .
24+
- golangci-lint run
25+
- actionlint -shellcheck="-e SC2129"
26+
- hadolint Dockerfile
27+
- task: pslint
28+
29+
pslint:
30+
platforms: [windows]
31+
cmd: powershell -Command "Invoke-ScriptAnalyzer -Path scripts -Recurse"
2732

2833
clean:
2934
desc: Clean All
30-
cmd: |
31-
rm -rf dist/client
32-
rm -rf out
35+
cmds:
36+
- rm -rf dist/client
37+
- rm -rf out
3338

3439
build:
3540
desc: GoReleaser Build
@@ -41,9 +46,9 @@ tasks:
4146

4247
docs:
4348
desc: Zensical Docs
44-
cmd: |
45-
rm -rf .cache
46-
zensical serve --open
49+
cmds:
50+
- rm -rf .cache
51+
- zensical serve --open
4752

4853
inno:
4954
aliases: [setup]
@@ -64,21 +69,21 @@ tasks:
6469
vars:
6570
TARGET_NAME: '{{.EXE}}{{if eq OS "windows"}}.exe{{end}}'
6671
TARGET_DIR: '${HOME}{{if eq OS "windows"}}\bin\{{else}}/bin/{{end}}{{.TARGET_NAME}}'
67-
cmd: |
68-
go build -o {{.TARGET_NAME}}
69-
echo "Name: {{.TARGET_NAME}}"
70-
mv "{{.TARGET_NAME}}" "{{.TARGET_DIR}}"
71-
echo "Path: {{.TARGET_DIR}}"
72-
which {{.TARGET_NAME}}
73-
{{.TARGET_NAME}} -V
72+
cmds:
73+
- go build -o "{{.TARGET_NAME}}"
74+
- echo "Name {{.TARGET_NAME}}"
75+
- mv "{{.TARGET_NAME}}" "{{.TARGET_DIR}}"
76+
- echo Path "{{.TARGET_DIR}}"
77+
- which "{{.TARGET_NAME}}"
78+
- "{{.TARGET_NAME}} -V"
7479

7580
vhs:*:
7681
desc: Create VHS Tape
7782
vars:
7883
TAPE_FILE: '{{index .MATCH 0 | default "demo"}}'
79-
cmd: |
80-
echo "Creating Tape - assets/{{.TAPE_FILE}}.tape"
81-
vhs "assets/{{.TAPE_FILE}}.tape"
84+
cmds:
85+
- echo "Creating Tape assets/{{.TAPE_FILE}}.tape"
86+
- vhs "assets/{{.TAPE_FILE}}.tape"
8287

8388
build:*:*:
8489
desc: Build OS:ARCH
@@ -91,6 +96,6 @@ tasks:
9196
enum: [darwin, linux, windows]
9297
- name: ARCH
9398
enum: [amd64, arm64, "386"]
94-
cmd: |
95-
echo "Building: {{.OS}} / {{.ARCH}}"
96-
GOOS={{.OS}} GOARCH={{.ARCH}} goreleaser build --snapshot --clean --single-target {{.CLI_ARGS}}
99+
cmds:
100+
- echo "Building {{.OS}} / {{.ARCH}}"
101+
- GOOS={{.OS}} GOARCH={{.ARCH}} goreleaser build --snapshot --clean --single-target {{.CLI_ARGS}}

cmd/info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ var infoCmd = &cobra.Command{
4949
log.Warn(err)
5050
}
5151

52-
styles.PrintKV("Executable:", executable)
53-
styles.PrintKV("Config Used:", viper.ConfigFileUsed())
54-
styles.PrintKV("Bin Path:", binPath)
52+
styles.PrintKV("Executable", executable)
53+
styles.PrintKV("Config Used", viper.ConfigFileUsed())
54+
styles.PrintKV("Bin Path", binPath)
5555

5656
fmt.Printf("To get package info, run:\n")
5757
fmt.Println(styles.Command.Render("ir info owner/repo"))

cmd/install.go

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func runInstall(cmd *cobra.Command, args []string) error { // NOSONAR
6262
tagDisplay = "latest"
6363
}
6464
}
65-
styles.PrintKV("Repository:", fmt.Sprintf("%s/%s:%s", owner, repo, tagDisplay))
65+
styles.PrintKV("Repository", fmt.Sprintf("%s/%s:%s", owner, repo, tagDisplay))
6666

6767
client := getClient()
6868

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

77-
//styles.PrintKV("Version:", fmt.Sprintf("%s (%s)", release.GetTagName(), release.GetName()))
77+
//styles.PrintKV("Version", fmt.Sprintf("%s (%s)", release.GetTagName(), release.GetName()))
7878
renderReleaseTable(release)
7979

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

115115
log.Infof("id: %v", asset.GetID())
116116
log.Infof("url: %v", asset.GetBrowserDownloadURL())
117-
styles.PrintKV("Asset Name:", asset.GetName())
117+
styles.PrintKV("Asset Name", asset.GetName())
118118

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

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

248-
styles.PrintKV("Installed:", destName)
254+
styles.PrintKV("Installed", destName)
249255
return nil
250256
}
251257

@@ -430,22 +436,26 @@ func ensureWinExt(destName string) string {
430436
}
431437

432438
func parseRepository(args []string) (owner, repo, tag string, err error) {
433-
helpErr := errors.New("repository must be in format: owner/repo[:tag]")
434-
log.Debugf("parseRepository: %v", len(args))
439+
helpErr := errors.New("repository format: owner/repo[:tag]")
440+
log.Debugf("parseRepository %v: %v", len(args), args)
435441
switch len(args) {
436442
case 0:
437443
return "", "", "", helpErr
438444
case 1:
439445
repository := args[0]
440-
if strings.Contains(repository, ":") {
441-
split := strings.Split(repository, ":")
442-
repository = split[0]
443-
tag = split[1]
444-
} else if strings.Contains(repository, "@") {
445-
split := strings.Split(repository, "@")
446-
repository = split[0]
447-
tag = split[1]
446+
// Check for :tag @tag /tag
447+
if idx := strings.IndexAny(args[0], ":@"); idx != -1 {
448+
log.Debugf("idx: %v", idx)
449+
repository = args[0][:idx]
450+
tag = args[0][idx+1:]
451+
} else if strings.Count(args[0], "/") == 2 {
452+
split := strings.Split(args[0], "/")
453+
if split[2] != "" {
454+
repository = split[0] + "/" + split[1]
455+
tag = split[2]
456+
}
448457
}
458+
// Set owner/repo
449459
split := strings.Split(repository, "/")
450460
if len(split) != 2 {
451461
return "", "", "", helpErr

cmd/path.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ var pathCmd = &cobra.Command{
3737
switch command {
3838
case "a", "ad", "add":
3939
// NOTE: Add output here and remove from AddDirToPath
40-
added, ret, err := pathmgr.AddDirToPath(path, 1, 0)
40+
added, err := pathmgr.AddDirToPath(path)
4141
if err != nil {
4242
log.Fatalf("pathmgr.AddDirToPath: %v", err)
4343
}
44-
log.Info("AddDirToPath", "added", added, "ret", ret, "err", err)
44+
log.Info("AddDirToPath", "added", added)
4545
case "r", "re", "rem", "remove":
4646
log.Fatal("INOP: The remove command is not yet functional...")
4747
case "c", "ch", "chk", "check":

cmd/remove.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var removeCmd = &cobra.Command{
6969
if err := os.Remove(path); err != nil {
7070
log.Fatalf("prompt error: %v", err)
7171
}
72-
styles.PrintKV("Removed:", name)
72+
styles.PrintKV("Removed", name)
7373
},
7474
}
7575

cmd/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var testCmd = &cobra.Command{
4242
//}
4343
//fmt.Print(strings.TrimLeft(out, "\n"))
4444
//
45-
//styles.PrintKV("Release URL:", release.GetHTMLURL())
45+
//styles.PrintKV("Release URL", release.GetHTMLURL())
4646
//return
4747

4848
homeDir, err := os.UserHomeDir()

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ Install using many formats:
7575

7676
```shell
7777
ir owner repo
78-
ir owner repo tag
7978
ir owner/repo
79+
ir owner repo tag
8080
ir owner/repo tag
81+
ir owner/repo/tag
8182
ir owner/repo:tag
8283
ir owner/repo@tag
8384
```

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
4747
github.com/mattn/go-isatty v0.0.20 // indirect
4848
github.com/mattn/go-localereader v0.0.1 // indirect
49-
github.com/mattn/go-runewidth v0.0.19 // indirect
49+
github.com/mattn/go-runewidth v0.0.20 // indirect
5050
github.com/mikelolasagasti/xz v1.0.1 // indirect
5151
github.com/minio/minlz v1.0.1 // indirect
5252
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
@@ -67,7 +67,7 @@ require (
6767
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
6868
go.yaml.in/yaml/v3 v3.0.4 // indirect
6969
go4.org v0.0.0-20260112195520-a5071408f32f // indirect
70-
golang.org/x/exp v0.0.0-20260212183809-81e46e3db34a // indirect
70+
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
7171
golang.org/x/sys v0.41.0 // indirect
7272
golang.org/x/text v0.34.0 // indirect
7373
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect

0 commit comments

Comments
 (0)