Compare commits
20 Commits
39aada1849
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f3b309bbf | |||
| ea4062d45f | |||
| fd78267edc | |||
| 9333b41f4a | |||
| 0fcf1eb45d | |||
| 9840ded30f | |||
| 8b8fa29d48 | |||
| bc68c3ab60 | |||
| 02029a37d9 | |||
| 2fe7487c21 | |||
| 6f132eb589 | |||
| d2781c0247 | |||
| 2bd569d8f5 | |||
| 82f002d6e1 | |||
| e42fd43a9f | |||
| 87a06d219b | |||
| ac1700427f | |||
| 09b71a18cb | |||
| 0d2d34e3fb | |||
| 50f022a303 |
@@ -9,6 +9,7 @@ name: Cross-Compile Binaries
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'go.**'
|
||||
- 'meshbook/**'
|
||||
schedule:
|
||||
- cron: '0 0 * * 6'
|
||||
|
||||
@@ -23,14 +24,14 @@ jobs:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout and pull the code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set the Python programming language
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.13'
|
||||
python-version: '3.14'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install python dependencies
|
||||
@@ -57,13 +58,6 @@ jobs:
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
#mv /etc/apt/sources.list.d/microsoft-prod.list \
|
||||
# /etc/apt/sources.list.d/microsoft-prod.list.disabled
|
||||
|
||||
#until apt-get update; do
|
||||
# echo -e "-----\napt-get update failed, retrying in 1s...\n-----"
|
||||
# sleep 1s
|
||||
#done
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt-get install -y \
|
||||
@@ -83,15 +77,16 @@ jobs:
|
||||
- name: move files for upload
|
||||
run: |
|
||||
mv ./meshbook ./meshbook-dir
|
||||
mv ./dist/meshbook ./meshbook
|
||||
mkdir ./bin
|
||||
mv ./dist/meshbook ./bin/meshbook
|
||||
|
||||
- name: upload the building actifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: https://gitea.com/actions/gitea-upload-artifact@main
|
||||
with:
|
||||
name: package-linux64
|
||||
path: |
|
||||
./patchworks
|
||||
./meshbook
|
||||
./bin/meshbook
|
||||
retention-days: 7
|
||||
overwrite: true
|
||||
|
||||
@@ -101,20 +96,13 @@ jobs:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout and pull the code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set the Wine Windows Emulation program up
|
||||
# https://gitlab.winehq.org/wine/wine/-/wikis/Debian-Ubuntu
|
||||
run: |
|
||||
#mv /etc/apt/sources.list.d/microsoft-prod.list
|
||||
# /etc/apt/sources.list.d/microsoft-prod.list.disabled
|
||||
|
||||
#until apt-get update; do
|
||||
# echo -e "-----\napt-get update failed, retrying in 1s...\n-----"
|
||||
# sleep 1
|
||||
#done
|
||||
sudo apt-get update
|
||||
|
||||
mkdir -pm755 /etc/apt/keyrings
|
||||
@@ -123,10 +111,6 @@ jobs:
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/noble/winehq-noble.sources
|
||||
|
||||
#until apt-get update; do
|
||||
# echo -e "-----\napt-get update failed, retrying in 1s...\n-----"
|
||||
# sleep 1
|
||||
#done
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --install-recommends winehq-devel
|
||||
wine --version
|
||||
@@ -166,13 +150,6 @@ jobs:
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
#mv /etc/apt/sources.list.d/microsoft-prod.list \
|
||||
# /etc/apt/sources.list.d/microsoft-prod.list.disabled
|
||||
|
||||
#until apt-get update; do
|
||||
# echo -e "-----\napt-get update failed, retrying in 1s...\n-----"
|
||||
# sleep 1s
|
||||
#done
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt-get install -y \
|
||||
@@ -213,13 +190,15 @@ jobs:
|
||||
- name: move files for upload
|
||||
run: |
|
||||
mv ./meshbook ./meshbook-dir
|
||||
mv ./dist/meshbook.exe ./meshbook.exe
|
||||
mkdir ./bin
|
||||
mv ./dist/meshbook.exe ./bin/meshbook.exe
|
||||
|
||||
- name: upload the building actifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
uses: https://gitea.com/actions/gitea-upload-artifact@main
|
||||
with:
|
||||
name: package-win64
|
||||
path: |
|
||||
./*.exe
|
||||
./bin/*.exe
|
||||
retention-days: 7
|
||||
overwrite: true
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Check out the repository locally'
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: false
|
||||
@@ -45,4 +45,4 @@ jobs:
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.11.4
|
||||
version: v2.12.2
|
||||
@@ -2,10 +2,10 @@ module patchworks
|
||||
|
||||
go 1.25.0
|
||||
|
||||
require fyne.io/fyne/v2 v2.7.3
|
||||
require fyne.io/fyne/v2 v2.7.4
|
||||
|
||||
require (
|
||||
fyne.io/systray v1.12.0 // indirect
|
||||
fyne.io/systray v1.12.1 // indirect
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/fredbi/uri v1.1.1 // indirect
|
||||
@@ -16,25 +16,27 @@ require (
|
||||
github.com/fyne-io/oksvg v0.2.0 // indirect
|
||||
github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 // indirect
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a // indirect
|
||||
github.com/go-text/render v0.2.0 // indirect
|
||||
github.com/go-text/typesetting v0.3.3 // indirect
|
||||
github.com/go-text/render v0.2.1 // indirect
|
||||
github.com/go-text/typesetting v0.3.4 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/hack-pad/go-indexeddb v0.3.2 // indirect
|
||||
github.com/hack-pad/safejs v0.1.0 // indirect
|
||||
github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade // indirect
|
||||
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.17 // indirect
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
||||
github.com/nicksnyder/go-i18n/v2 v2.5.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/rymdport/portal v0.4.2 // indirect
|
||||
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect
|
||||
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect
|
||||
github.com/stretchr/testify v1.11.1 // indirect
|
||||
github.com/yuin/goldmark v1.7.8 // indirect
|
||||
golang.org/x/image v0.24.0 // indirect
|
||||
golang.org/x/net v0.35.0 // indirect
|
||||
golang.org/x/sys v0.30.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
golang.org/x/image v0.38.0 // indirect
|
||||
golang.org/x/net v0.38.0 // indirect
|
||||
golang.org/x/sys v0.31.0 // indirect
|
||||
golang.org/x/text v0.35.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
fyne.io/fyne/v2 v2.7.3 h1:xBT/iYbdnNHONWO38fZMBrVBiJG8rV/Jypmy4tVfRWE=
|
||||
fyne.io/fyne/v2 v2.7.3/go.mod h1:gu+dlIcZWSzKZmnrY8Fbnj2Hirabv2ek+AKsfQ2bBlw=
|
||||
fyne.io/fyne/v2 v2.7.4 h1:OVCI5mT+Onb2kA4wlmGA5pLCqKik9f4NDb5jiR1OMTc=
|
||||
fyne.io/fyne/v2 v2.7.4/go.mod h1:ZD1mmhBY75mSa97IXl3MPlICd1uNHfCXYh5hKIlVOII=
|
||||
fyne.io/systray v1.12.0 h1:CA1Kk0e2zwFlxtc02L3QFSiIbxJ/P0n582YrZHT7aTM=
|
||||
fyne.io/systray v1.12.0/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs=
|
||||
fyne.io/systray v1.12.1 h1:ygBD6aZXwiOmZoY5N+ukbH9pih0Kq6fYgVeMYbr5skQ=
|
||||
fyne.io/systray v1.12.1/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs=
|
||||
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
||||
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
@@ -27,8 +31,12 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a h1:vxnBhFDDT+
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20240506104042-037f3cc74f2a/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-text/render v0.2.0 h1:LBYoTmp5jYiJ4NPqDc2pz17MLmA3wHw1dZSVGcOdeAc=
|
||||
github.com/go-text/render v0.2.0/go.mod h1:CkiqfukRGKJA5vZZISkjSYrcdtgKQWRa2HIzvwNN5SU=
|
||||
github.com/go-text/render v0.2.1 h1:qwHhxqGUjjg4L0XyJWj7M7bpY75NZM+kBpv2Yfw5mcg=
|
||||
github.com/go-text/render v0.2.1/go.mod h1:HCCAq8MUlm/WRcXshBb4K/n+IkjeXQ1c2Ba+yICSm0A=
|
||||
github.com/go-text/typesetting v0.3.3 h1:ihGNJU9KzdK2QRDy1Bm7FT5RFQoYb+3n3EIhI/4eaQc=
|
||||
github.com/go-text/typesetting v0.3.3/go.mod h1:vIRUT25mLQaSh4C8H/lIsKppQz/Gdb8Pu/tNwpi52ts=
|
||||
github.com/go-text/typesetting v0.3.4 h1:YYurUOtEb9kGSOz4uE3k4OpBGsp1dDL8+fjCeaFamAU=
|
||||
github.com/go-text/typesetting v0.3.4/go.mod h1:4qZCQphq4KSgGTAeI0uMEkVbROgfah8BuyF5LRYr7XY=
|
||||
github.com/go-text/typesetting-utils v0.0.0-20250618110550-c820a94c77b8 h1:4KCscI9qYWMGTuz6BpJtbUSRzcBrUSSE0ENMJbNSrFs=
|
||||
github.com/go-text/typesetting-utils v0.0.0-20250618110550-c820a94c77b8/go.mod h1:3/62I4La/HBRX9TcTpBj4eipLiwzf+vhI+7whTc9V7o=
|
||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||
@@ -45,6 +53,8 @@ github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 h1:YLvr1eE6cdCqjOe9
|
||||
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/mattn/go-runewidth v0.0.17 h1:78v8ZlW0bP43XfmAfPsdXcoNCelfMHsDmd/pkENfrjQ=
|
||||
github.com/mattn/go-runewidth v0.0.17/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||
github.com/nicksnyder/go-i18n/v2 v2.5.1 h1:IxtPxYsR9Gp60cGXjfuR/llTqV8aYMsC472zD0D1vHk=
|
||||
@@ -55,6 +65,8 @@ github.com/pkg/profile v1.7.0 h1:hnbDkaNWPCLMO9wGLdBFTIZvzDrDfBM2072E1S9gJkA=
|
||||
github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rymdport/portal v0.4.2 h1:7jKRSemwlTyVHHrTGgQg7gmNPJs88xkbKcIL3NlcmSU=
|
||||
github.com/rymdport/portal v0.4.2/go.mod h1:kFF4jslnJ8pD5uCi17brj/ODlfIidOxlgUDTO5ncnC4=
|
||||
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c h1:km8GpoQut05eY3GiYWEedbTT0qnSxrCjsVbb7yKY1KE=
|
||||
@@ -65,14 +77,14 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
|
||||
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
|
||||
golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8=
|
||||
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE=
|
||||
golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
|
||||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
|
||||
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
||||
+1
-1
Submodule meshbook updated: 8ae6b728b5...3c8fc54d76
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"local>daanselen/renovate-config"
|
||||
]
|
||||
}
|
||||
+3
-2
@@ -35,9 +35,10 @@ func main() {
|
||||
|
||||
targEntry := widget.NewEntry()
|
||||
var book string
|
||||
var silent bool
|
||||
|
||||
inputContainer := draw.MakeInput(targEntry, &book)
|
||||
footerContainer := draw.MakeFooter(targEntry, &book, app)
|
||||
inputContainer := draw.MakeInput(targEntry, &book, &silent)
|
||||
footerContainer := draw.MakeFooter(targEntry, &book, &silent, app)
|
||||
|
||||
center := container.NewBorder(
|
||||
nil, // top
|
||||
|
||||
@@ -13,15 +13,24 @@ import (
|
||||
tasks "patchworks/src/modules/tasks"
|
||||
)
|
||||
|
||||
func MakeInput(targEntry *widget.Entry, book *string) *fyne.Container {
|
||||
func MakeInput(targEntry *widget.Entry, book *string, silent *bool) *fyne.Container {
|
||||
availBooks, err := tasks.ListAvailableBooks()
|
||||
if err != nil {
|
||||
log.Println("failed to read available books on disk")
|
||||
}
|
||||
|
||||
silentCheck := widget.NewCheck("Silent (Return Only JSON Data)", func(checked bool) {
|
||||
if checked {
|
||||
*silent = true
|
||||
} else {
|
||||
*silent = false
|
||||
}
|
||||
})
|
||||
|
||||
targetBox := container.NewVBox(
|
||||
widget.NewLabel("MeshCentral Target Group"),
|
||||
targEntry,
|
||||
silentCheck,
|
||||
widget.NewLabel(""),
|
||||
canvas.NewLine(color.Gray{Y: 128}),
|
||||
)
|
||||
@@ -55,7 +64,7 @@ func MakeInput(targEntry *widget.Entry, book *string) *fyne.Container {
|
||||
return inputBox
|
||||
}
|
||||
|
||||
func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Container {
|
||||
func MakeFooter(targEntry *widget.Entry, book *string, silent *bool, app fyne.App) *fyne.Container {
|
||||
var result string
|
||||
textEntry := widget.NewMultiLineEntry()
|
||||
|
||||
@@ -89,7 +98,7 @@ func MakeFooter(targEntry *widget.Entry, book *string, app fyne.App) *fyne.Conta
|
||||
log.Println("kicking off goroutine")
|
||||
actionBtn.Disable()
|
||||
go func() {
|
||||
ok, result = runner.RunMeshbook(path, *book, targEntry.Text)
|
||||
ok, result = runner.RunMeshbook(path, *book, *silent, targEntry.Text)
|
||||
if !ok {
|
||||
log.Println("assuming failed state")
|
||||
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package runner
|
||||
|
||||
import (
|
||||
@@ -9,7 +6,6 @@ import (
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var ansi = regexp.MustCompile(`\x1b\[[0-9;]*m`)
|
||||
@@ -49,29 +45,38 @@ func FindMeshbookBinary() (bool, string) {
|
||||
}
|
||||
}
|
||||
|
||||
func RunMeshbook(binPath, bookPath, targGroup string) (bool, string) {
|
||||
func RunMeshbook(binPath, bookPath string, silent bool, targGroup string) (bool, string) {
|
||||
// Meshbook argument compilation
|
||||
var args []string
|
||||
if len(bookPath) == 0 {
|
||||
args = []string{"--help"}
|
||||
} else {
|
||||
args = []string{"--nograce", "--indent", "-mb", bookPath, "--group", targGroup}
|
||||
}
|
||||
log.Printf("running with parameters: %v", args)
|
||||
|
||||
cmd := exec.Command(binPath, args...)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||
HideWindow: true,
|
||||
if silent {
|
||||
args = append(args, "--silent")
|
||||
}
|
||||
|
||||
// Display what we are about to be running
|
||||
log.Printf("running with parameters: %v", args)
|
||||
|
||||
// Actually spawn the process
|
||||
cmd := exec.Command(binPath, args...)
|
||||
|
||||
// Capture stdout & stderr
|
||||
outputData, err := cmd.CombinedOutput()
|
||||
cleanData := ansi.ReplaceAllString(string(outputData), "")
|
||||
|
||||
log.Println("evaluating returned state")
|
||||
if err != nil {
|
||||
log.Printf("something went wrong when running the command: %v", err)
|
||||
log.Printf("captured output: %s", cleanData)
|
||||
|
||||
return false, cleanData
|
||||
} else {
|
||||
log.Printf("captured output: %s", cleanData)
|
||||
|
||||
return true, cleanData
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package runner
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
var ansi = regexp.MustCompile(`\x1b\[[0-9;]*m`)
|
||||
|
||||
func FindMeshbookBinary() (bool, string) {
|
||||
var osBin string
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
osBin = "meshbook.exe"
|
||||
case "linux":
|
||||
osBin = "meshbook"
|
||||
default:
|
||||
log.Println("undefined operating system")
|
||||
}
|
||||
|
||||
log.Println("going to search for:", osBin)
|
||||
|
||||
binaryFound := false
|
||||
var binaryPath string
|
||||
for _, f := range []string{("./" + osBin), ("./bin/" + osBin)} {
|
||||
objInfo, err := os.Stat(f)
|
||||
|
||||
if err == nil && objInfo.Mode().IsRegular() {
|
||||
binaryFound = true
|
||||
binaryPath = f
|
||||
log.Printf("found binary at %s", f)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if binaryFound {
|
||||
return true, binaryPath
|
||||
} else {
|
||||
log.Println("binary not found!")
|
||||
return false, ""
|
||||
}
|
||||
}
|
||||
|
||||
func RunMeshbook(binPath, bookPath, targGroup string) (bool, string) {
|
||||
var args []string
|
||||
if len(bookPath) == 0 {
|
||||
args = []string{"--help"}
|
||||
} else {
|
||||
args = []string{"--nograce", "--indent", "-mb", bookPath, "--group", targGroup}
|
||||
}
|
||||
log.Printf("running with parameters: %v", args)
|
||||
|
||||
cmd := exec.Command(binPath, args...)
|
||||
|
||||
outputData, err := cmd.CombinedOutput()
|
||||
cleanData := ansi.ReplaceAllString(string(outputData), "")
|
||||
|
||||
if err != nil {
|
||||
log.Printf("something went wrong when running the command: %v", err)
|
||||
log.Printf("captured output: %s", cleanData)
|
||||
|
||||
return false, cleanData
|
||||
} else {
|
||||
return true, cleanData
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user