Package Details: oh-my-posh 19.24.1-1

Git Clone URL: https://aur.archlinux.org/oh-my-posh.git (read-only, click to copy)
Package Base: oh-my-posh
Description: A prompt theme engine for any shell.
Upstream URL: https://github.com/JanDeDobbeleer/oh-my-posh
Keywords: oh-my-posh
Licenses: MIT
Submitter: wszqkzqk
Maintainer: wszqkzqk
Last Packager: wszqkzqk
Votes: 5
Popularity: 0.53
First Submitted: 2022-10-20 13:30 (UTC)
Last Updated: 2024-04-21 02:20 (UTC)

Dependencies (3)

Required by (1)

Sources (1)

Latest Comments

ZhangHua commented on 2023-08-07 09:36 (UTC)

You must call "./${pkgname}" in line 23-25, because oh-my-posh is not in the $PATH absolutely.

ZhangHua commented on 2023-08-06 12:25 (UTC)

It seems that you forget to generate completions such as oh-my-posh.sh, oh-my-posh.fish and _oh-my-posh. Which results that there will no required files found when calling package()

What's more, I think you may set build.Version to $pkgver instead v$pkgver. Using v$pkgver results that the version string used for checking updates is changed to vv18.2.5 instead v18.2.5.

Sacro commented on 2023-07-19 17:28 (UTC) (edited on 2023-07-19 17:29 (UTC) by Sacro)

Please can you generate and add completions? This does it.

diff --git a/PKGBUILD b/PKGBUILD
index dae4e03..7f20c0d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -19,7 +19,11 @@ build() {
     export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"

     cd "$pkgname-$pkgver/src"
-    go build
+    go build -o "$pkgname"
+
+    "${pkgname}" completion bash > "${pkgname}.sh"
+    "${pkgname}" completion fish > "${pkgname}.fish"
+    "${pkgname}" completion zsh > "_${pkgname}"
 }

 package() {
@@ -28,4 +32,8 @@ package() {
     install -Dm 644 "../COPYING" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
     install -d "${pkgdir}/usr/share/oh-my-posh/themes"
     install -m 644 ../themes/* -t "${pkgdir}/usr/share/oh-my-posh/themes"
+
+    install -Dm 644 "${pkgname}.sh" "${pkgdir}/usr/share/bash-completion/completions/${pkgname}"
+    install -Dm 644 "${pkgname}.fish" "${pkgdir}/usr/share/fish/completions/${pkgname}.fish"
+    install -Dm 644 "_${pkgname}" "${pkgdir}/usr/share/zsh/site-functions/_${pkgname}"
 }

ZhangHua commented on 2023-07-10 06:18 (UTC) (edited on 2023-07-10 06:19 (UTC) by ZhangHua)

Please consider adding -X github.com/jandedobbeleer/oh-my-posh/src/build.Version=v$pkgver -X github.com/jandedobbeleer/oh-my-posh/src/build.Date=$(date +%F) to -ldflags so we can print detailed info in oh-my-posh version --verbose command. However, this means that you need to move -ldflags=-linkmode=external in GOFLAGS variable to go build command as its params, because GOFLAGS does not support value with space.

You can use this patch to achieve this:

diff --git a/PKGBUILD b/PKGBUILD
index 570455b..18423fe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
 # Maintainer: wszqkzqk <wszqkzqk@qq.com>
 pkgname=oh-my-posh
 pkgver=17.7.0
-pkgrel=1
+pkgrel=2
 pkgdesc="A prompt theme engine for any shell."
 arch=('x86_64' 'armv7h' 'aarch64')
 url="https://github.com/JanDeDobbeleer/oh-my-posh"
@@ -16,10 +16,10 @@ build() {
     export CGO_CFLAGS="${CFLAGS}"
     export CGO_CXXFLAGS="${CXXFLAGS}"
     export CGO_LDFLAGS="${LDFLAGS}"
-    export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
+    export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"

     cd "$pkgname-$pkgver/src"
-    go build
+    go build -ldflags="-linkmode=external -X github.com/jandedobbeleer/oh-my-posh/src/build.Version=v$pkgver -X github.com/jandedobbeleer/oh-my-posh/src/build.Date=$(date +%F)"
 }

 package() {

TrialnError commented on 2023-01-06 18:41 (UTC)

Temporary fix for the name of the created binary:

@@ -22,7 +22,7 @@ build() {
 }
 package() {
     cd "$pkgname-$pkgver/src"
-    install -Dm 755 ./oh-my-posh -t "${pkgdir}/usr/bin/"
+    install -Dm 755 ./src -D "${pkgdir}/usr/bin/oh-my-posh"
     install -Dm 644 "../COPYING" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
     install -d "${pkgdir}/usr/share/oh-my-posh/themes"
     install -m 644 ../themes/* -t "${pkgdir}/usr/share/oh-my-posh/themes"

a821 commented on 2023-01-06 12:58 (UTC) (edited on 2023-01-07 12:56 (UTC) by a821)

Edit: fixed, thanks :-)

fails to build due to an error in line #25, because the binary is called src instead of oh-my-posh. Maybe an issue to raise upstream.