mirror of
https://github.com/ivabus/pantry
synced 2024-11-26 18:25:08 +03:00
parent
08a08a9807
commit
ab2ea4ca88
2 changed files with 72 additions and 0 deletions
44
projects/github.com/mop-tracker/mop/add-version-flag.patch
Normal file
44
projects/github.com/mop-tracker/mop/add-version-flag.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
From a7428e16d81ea5481ea6af434565f301cf8397e6 Mon Sep 17 00:00:00 2001
|
||||
From: Sanchit Ram Arvind <sanchitram@gmail.com>
|
||||
Date: Tue, 4 Apr 2023 22:43:45 -0400
|
||||
Subject: [PATCH] add-version-flag
|
||||
|
||||
---
|
||||
cmd/mop/main.go | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/cmd/mop/main.go b/cmd/mop/main.go
|
||||
index 4636339..e4c8157 100644
|
||||
--- a/cmd/mop/main.go
|
||||
+++ b/cmd/mop/main.go
|
||||
@@ -18,6 +18,11 @@ import (
|
||||
"github.com/nsf/termbox-go"
|
||||
)
|
||||
|
||||
+// Variable for current version
|
||||
+var (
|
||||
+ version string
|
||||
+)
|
||||
+
|
||||
// File name in user's home directory where we store the settings.
|
||||
const defaultProfile = `.moprc`
|
||||
|
||||
@@ -195,6 +200,15 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
+ var showVersion bool
|
||||
+ flag.BoolVar(&showVersion, "version", false, "prints mop version")
|
||||
+ flag.Parse()
|
||||
+
|
||||
+ if showVersion {
|
||||
+ fmt.Printf("mop-%s\n", version)
|
||||
+ os.Exit(0)
|
||||
+ }
|
||||
+
|
||||
profileName := flag.String("profile", path.Join(usr.HomeDir, defaultProfile), "path to profile")
|
||||
flag.Parse()
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
28
projects/github.com/mop-tracker/mop/package.yml
Normal file
28
projects/github.com/mop-tracker/mop/package.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
distributable:
|
||||
url: https://github.com/mop-tracker/mop/archive/refs/heads/master.tar.gz
|
||||
strip-components: 1
|
||||
|
||||
versions:
|
||||
- 2023.03.30
|
||||
|
||||
build:
|
||||
dependencies:
|
||||
go.dev: '*'
|
||||
gnu.org/patch: '*'
|
||||
script: |
|
||||
patch -p1 < props/add-version-flag.patch
|
||||
go mod download
|
||||
go build -ldflags="$LDFLAGS" -x -o ./bin/mop $PACKAGE
|
||||
mkdir -p "{{ prefix }}"/bin
|
||||
mv ./bin/mop "{{ prefix }}"/bin
|
||||
chmod +rx "{{ prefix }}"/bin/mop
|
||||
env:
|
||||
LDFLAGS: "-X main.version={{version}}"
|
||||
PACKAGE: ./cmd/mop
|
||||
|
||||
provides:
|
||||
- bin/mop
|
||||
|
||||
test:
|
||||
script: |
|
||||
test "$(mop --version)" = "mop-{{version}}"
|
Loading…
Reference in a new issue