From ab2ea4ca88704f4e38d28567f75137c83e69522e Mon Sep 17 00:00:00 2001 From: Sanchit Ram Arvind Date: Tue, 4 Apr 2023 23:23:38 -0400 Subject: [PATCH] +mop-tracker (#1121) financial dashboard on terminal --- .../mop-tracker/mop/add-version-flag.patch | 44 +++++++++++++++++++ .../github.com/mop-tracker/mop/package.yml | 28 ++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 projects/github.com/mop-tracker/mop/add-version-flag.patch create mode 100644 projects/github.com/mop-tracker/mop/package.yml diff --git a/projects/github.com/mop-tracker/mop/add-version-flag.patch b/projects/github.com/mop-tracker/mop/add-version-flag.patch new file mode 100644 index 00000000..29cee6b6 --- /dev/null +++ b/projects/github.com/mop-tracker/mop/add-version-flag.patch @@ -0,0 +1,44 @@ +From a7428e16d81ea5481ea6af434565f301cf8397e6 Mon Sep 17 00:00:00 2001 +From: Sanchit Ram Arvind +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 + diff --git a/projects/github.com/mop-tracker/mop/package.yml b/projects/github.com/mop-tracker/mop/package.yml new file mode 100644 index 00000000..64c55ffd --- /dev/null +++ b/projects/github.com/mop-tracker/mop/package.yml @@ -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}}" \ No newline at end of file