From f99ab94b37f395ae2ae255c4c8f3f2e832c3c7df Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 2 Mar 2023 04:02:13 +0000
Subject: [PATCH 01/10] Bump github.com/essentialkaos/ek/v12 from 12.60.0 to
12.60.1
Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.60.0 to 12.60.1.
- [Release notes](https://github.com/essentialkaos/ek/releases)
- [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md)
- [Commits](https://github.com/essentialkaos/ek/compare/v12.60.0...v12.60.1)
---
updated-dependencies:
- dependency-name: github.com/essentialkaos/ek/v12
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
go.mod | 4 ++--
go.sum | 42 +++++++++++++++++++++++++++++++-----------
2 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/go.mod b/go.mod
index 444dfd8..73626c1 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.17
require (
github.com/essentialkaos/depsy v1.0.0
- github.com/essentialkaos/ek/v12 v12.60.0
+ github.com/essentialkaos/ek/v12 v12.60.1
)
-require golang.org/x/sys v0.4.0 // indirect
+require golang.org/x/sys v0.5.0 // indirect
diff --git a/go.sum b/go.sum
index 66c521f..af6e3f9 100644
--- a/go.sum
+++ b/go.sum
@@ -3,30 +3,50 @@ github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrb
github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8=
github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc=
github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM=
-github.com/essentialkaos/ek/v12 v12.60.0 h1:Z0wGjnSAyJLHkbhlO27E/GfRqNFD11zPotEha7ygOzg=
-github.com/essentialkaos/ek/v12 v12.60.0/go.mod h1:QFEIBoGPE5ezTV08JYWlWLL5t8fwcdOe3/e7bhTJNW0=
+github.com/essentialkaos/ek/v12 v12.60.1 h1:8soxFFOK5ryGxjrlcc6tAHdeVoCI5paIpXYqh+CTrMQ=
+github.com/essentialkaos/ek/v12 v12.60.1/go.mod h1:aDym0Lf/AFZJ37hJhJ+JAw2AeQQAwcYksjSC5lDNWh4=
github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
+github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
-github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
-golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
-golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
+github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
-golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
-golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
From e91f15fb6c1d26c23c37018e2606136104ed5002 Mon Sep 17 00:00:00 2001
From: Anton Novojilov
Date: Thu, 2 Mar 2023 13:02:49 +0300
Subject: [PATCH 02/10] Dependencies update
---
go.mod | 2 +-
go.sum | 42 ------------------------------------------
2 files changed, 1 insertion(+), 43 deletions(-)
diff --git a/go.mod b/go.mod
index 73626c1..991f87d 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/essentialkaos/bop
-go 1.17
+go 1.18
require (
github.com/essentialkaos/depsy v1.0.0
diff --git a/go.sum b/go.sum
index af6e3f9..af2c081 100644
--- a/go.sum
+++ b/go.sum
@@ -1,52 +1,10 @@
-github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0=
-github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8=
github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc=
github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM=
github.com/essentialkaos/ek/v12 v12.60.1 h1:8soxFFOK5ryGxjrlcc6tAHdeVoCI5paIpXYqh+CTrMQ=
github.com/essentialkaos/ek/v12 v12.60.1/go.mod h1:aDym0Lf/AFZJ37hJhJ+JAw2AeQQAwcYksjSC5lDNWh4=
-github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI=
-github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
-github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
-github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
-github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
-github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
-github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
-github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
-golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
-golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
-golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
-golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
-golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
-golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
-golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
From ca575652a78d4ff64dc1c58f7683ff3699be747e Mon Sep 17 00:00:00 2001
From: Anton Novojilov
Date: Wed, 8 Mar 2023 23:18:30 +0300
Subject: [PATCH 03/10] Code refactoring
---
.github/workflows/ci.yml | 22 ++++++----
bop.go | 2 +-
cli/cli.go | 79 ++++++++++++++++++++++--------------
cli/support/support.go | 4 +-
cli/support/support_linux.go | 28 +++++++++----
go.mod | 4 +-
go.sum | 10 ++---
7 files changed, 93 insertions(+), 56 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9e75af8..19555a8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,19 +7,31 @@ on:
branches: [master]
schedule:
- cron: '30 12 */15 * *'
+ workflow_dispatch:
+ inputs:
+ force_run:
+ description: 'Force workflow run'
+ required: true
+ type: choice
+ options: [yes, no]
+
+permissions:
+ actions: read
+ contents: read
+ statuses: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
+env:
+ SRC_DIR: src/github.com/${{ github.repository }}
+
jobs:
Go:
name: Go
runs-on: ubuntu-latest
- env:
- SRC_DIR: src/github.com/${{ github.repository }}
-
strategy:
matrix:
go: [ '1.19.x', '1.20.x' ]
@@ -49,10 +61,6 @@ jobs:
needs: Go
- env:
- SRC_DIR: src/github.com/${{ github.repository }}
- GO111MODULE: auto
-
steps:
- name: Set up Go
uses: actions/setup-go@v3
diff --git a/bop.go b/bop.go
index 427da24..3820681 100644
--- a/bop.go
+++ b/bop.go
@@ -27,5 +27,5 @@ var gitrev string
// ////////////////////////////////////////////////////////////////////////////////// //
func main() {
- CLI.Init(gitrev, gomod)
+ CLI.Run(gitrev, gomod)
}
diff --git a/cli/cli.go b/cli/cli.go
index 9b3a76b..9f34247 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -38,7 +38,7 @@ import (
// App info
const (
APP = "bop"
- VER = "1.2.1"
+ VER = "1.2.2"
DESC = "Utility for generating formal bibop tests for RPM packages"
)
@@ -73,35 +73,33 @@ var optMap = options.Map{
// ////////////////////////////////////////////////////////////////////////////////// //
-// Init is main function
-func Init(gitRev string, gomod []byte) {
+// Run is main utility function
+func Run(gitRev string, gomod []byte) {
+ preConfigureUI()
+
args, errs := options.Parse(optMap)
if len(errs) != 0 {
- for _, err := range errs {
- printError(err.Error())
- }
-
+ printError(errs[0].Error())
os.Exit(1)
}
- if options.GetB(OPT_NO_COLOR) {
- fmtc.DisableColors = true
- }
+ configureUI()
switch {
case options.Has(OPT_COMPLETION):
- os.Exit(genCompletion())
+ os.Exit(printCompletion())
case options.Has(OPT_GENERATE_MAN):
- os.Exit(genMan())
+ printMan()
+ os.Exit(0)
case options.GetB(OPT_VER):
- showAbout(gitRev)
+ genAbout(gitRev).Print()
os.Exit(0)
case options.GetB(OPT_VERB_VER):
- support.ShowSupportInfo(APP, VER, gitRev, gomod)
+ support.Print(APP, VER, gitRev, gomod)
os.Exit(0)
case options.GetB(OPT_HELP) || len(args) < 2:
- showUsage()
+ genUsage().Print()
os.Exit(0)
}
@@ -113,6 +111,37 @@ func Init(gitRev string, gomod []byte) {
processFiles(name, files)
}
+// preConfigureUI preconfigures UI based on information about user terminal
+func preConfigureUI() {
+ term := os.Getenv("TERM")
+
+ fmtc.DisableColors = true
+
+ if term != "" {
+ switch {
+ case strings.Contains(term, "xterm"),
+ strings.Contains(term, "color"),
+ term == "screen":
+ fmtc.DisableColors = false
+ }
+ }
+
+ if !fsutil.IsCharacterDevice("/dev/stdout") && os.Getenv("FAKETTY") == "" {
+ fmtc.DisableColors = true
+ }
+
+ if os.Getenv("NO_COLOR") != "" {
+ fmtc.DisableColors = true
+ }
+}
+
+// configureUI configures user interface
+func configureUI() {
+ if options.GetB(OPT_NO_COLOR) {
+ fmtc.DisableColors = true
+ }
+}
+
// checkSystem checks system
func checkSystem() {
if env.Which("rpm") == "" {
@@ -208,18 +237,8 @@ func printErrorAndExit(f string, a ...interface{}) {
// ////////////////////////////////////////////////////////////////////////////////// //
-// showUsage prints usage info
-func showUsage() {
- genUsage().Render()
-}
-
-// showAbout prints info about version
-func showAbout(gitRev string) {
- genAbout(gitRev).Render()
-}
-
-// genCompletion generates completion for different shells
-func genCompletion() int {
+// printCompletion prints completion for given shell
+func printCompletion() int {
info := genUsage()
switch options.GetS(OPT_COMPLETION) {
@@ -236,16 +255,14 @@ func genCompletion() int {
return 0
}
-// genMan generates man page
-func genMan() int {
+// printMan prints man page
+func printMan() {
fmt.Println(
man.Generate(
genUsage(),
genAbout(""),
),
)
-
- return 0
}
// genUsage generates usage info
diff --git a/cli/support/support.go b/cli/support/support.go
index 29cfc12..9374af0 100644
--- a/cli/support/support.go
+++ b/cli/support/support.go
@@ -34,9 +34,9 @@ type Pkgs []Pkg
// ////////////////////////////////////////////////////////////////////////////////// //
-// ShowSupportInfo prints verbose info about application, system, dependencies and
+// Print prints verbose info about application, system, dependencies and
// important environment
-func ShowSupportInfo(app, ver, gitRev string, gomod []byte) {
+func Print(app, ver, gitRev string, gomod []byte) {
pkgs := collectEnvInfo()
fmtutil.SeparatorTitleColorTag = "{s-}"
diff --git a/cli/support/support_linux.go b/cli/support/support_linux.go
index 94f3da7..eb1354c 100644
--- a/cli/support/support_linux.go
+++ b/cli/support/support_linux.go
@@ -83,16 +83,28 @@ func collectEnvInfo() Pkgs {
}
}
-// getPackageVersion returns package name from rpm database
-func getPackageInfo(name string) Pkg {
- switch {
- case isDEBBased():
- return getDEBPackageInfo(name)
- case isRPMBased():
- return getRPMPackageInfo(name)
+// getPackageVersion returns package name and version from package manager database
+func getPackageInfo(names ...string) Pkg {
+ var info Pkg
+
+ if len(names) == 0 {
+ return Pkg{}
+ }
+
+ for _, name := range names {
+ switch {
+ case isDEBBased():
+ info = getDEBPackageInfo(name)
+ case isRPMBased():
+ info = getRPMPackageInfo(name)
+ }
+
+ if info.Version != "" {
+ return info
+ }
}
- return Pkg{name, ""}
+ return Pkg{names[0], ""}
}
// isDEBBased returns true if is DEB-based distro
diff --git a/go.mod b/go.mod
index 991f87d..7e3b72d 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.18
require (
github.com/essentialkaos/depsy v1.0.0
- github.com/essentialkaos/ek/v12 v12.60.1
+ github.com/essentialkaos/ek/v12 v12.61.0
)
-require golang.org/x/sys v0.5.0 // indirect
+require golang.org/x/sys v0.6.0 // indirect
diff --git a/go.sum b/go.sum
index af2c081..c469d0e 100644
--- a/go.sum
+++ b/go.sum
@@ -1,10 +1,10 @@
-github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrbPUc0=
+github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc=
github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM=
-github.com/essentialkaos/ek/v12 v12.60.1 h1:8soxFFOK5ryGxjrlcc6tAHdeVoCI5paIpXYqh+CTrMQ=
-github.com/essentialkaos/ek/v12 v12.60.1/go.mod h1:aDym0Lf/AFZJ37hJhJ+JAw2AeQQAwcYksjSC5lDNWh4=
+github.com/essentialkaos/ek/v12 v12.61.0 h1:8cmtVy/0FqUuWJVQNTnaeFxpQSiPWAxPc6j2EIUAEpA=
+github.com/essentialkaos/ek/v12 v12.61.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
-golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
-golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
From fac3c92a532ab0c7c5c99a65205e2033bfea87b9 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 10 Mar 2023 04:01:12 +0000
Subject: [PATCH 04/10] Bump github.com/essentialkaos/ek/v12 from 12.61.0 to
12.62.0
Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.61.0 to 12.62.0.
- [Release notes](https://github.com/essentialkaos/ek/releases)
- [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md)
- [Commits](https://github.com/essentialkaos/ek/compare/v12.61.0...v12.62.0)
---
updated-dependencies:
- dependency-name: github.com/essentialkaos/ek/v12
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index 7e3b72d..084e88c 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.18
require (
github.com/essentialkaos/depsy v1.0.0
- github.com/essentialkaos/ek/v12 v12.61.0
+ github.com/essentialkaos/ek/v12 v12.62.0
)
require golang.org/x/sys v0.6.0 // indirect
diff --git a/go.sum b/go.sum
index c469d0e..6b648f7 100644
--- a/go.sum
+++ b/go.sum
@@ -1,8 +1,8 @@
github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc=
github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM=
-github.com/essentialkaos/ek/v12 v12.61.0 h1:8cmtVy/0FqUuWJVQNTnaeFxpQSiPWAxPc6j2EIUAEpA=
-github.com/essentialkaos/ek/v12 v12.61.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs=
+github.com/essentialkaos/ek/v12 v12.62.0 h1:A+pnMGbSz2apjEjlHU3EQ6Uqam85GTryVPhzcLfY8o4=
+github.com/essentialkaos/ek/v12 v12.62.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
From ce24c799fa057a2e0a98e29a107073d36ef8e749 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 16 Mar 2023 04:00:28 +0000
Subject: [PATCH 05/10] Bump github.com/essentialkaos/ek/v12 from 12.62.0 to
12.63.0
Bumps [github.com/essentialkaos/ek/v12](https://github.com/essentialkaos/ek) from 12.62.0 to 12.63.0.
- [Release notes](https://github.com/essentialkaos/ek/releases)
- [Changelog](https://github.com/essentialkaos/ek/blob/master/CHANGELOG.md)
- [Commits](https://github.com/essentialkaos/ek/compare/v12.62.0...v12.63.0)
---
updated-dependencies:
- dependency-name: github.com/essentialkaos/ek/v12
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index 084e88c..0174c97 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.18
require (
github.com/essentialkaos/depsy v1.0.0
- github.com/essentialkaos/ek/v12 v12.62.0
+ github.com/essentialkaos/ek/v12 v12.63.0
)
require golang.org/x/sys v0.6.0 // indirect
diff --git a/go.sum b/go.sum
index 6b648f7..a0cb15a 100644
--- a/go.sum
+++ b/go.sum
@@ -1,8 +1,8 @@
github.com/essentialkaos/check v1.4.0 h1:kWdFxu9odCxUqo1NNFNJmguGrDHgwi3A8daXX1nkuKk=
github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc=
github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM=
-github.com/essentialkaos/ek/v12 v12.62.0 h1:A+pnMGbSz2apjEjlHU3EQ6Uqam85GTryVPhzcLfY8o4=
-github.com/essentialkaos/ek/v12 v12.62.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs=
+github.com/essentialkaos/ek/v12 v12.63.0 h1:9yaEu5W3bx//9y52ShqYCoFDKOcwEdrnvgSkUYyatgI=
+github.com/essentialkaos/ek/v12 v12.63.0/go.mod h1:9MlSuHpewu7OZ9tM9dLFHvoA8dflBIUPCA0Ctt97wRs=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
From 2defe0bf2d56fd7257bc81278a8b8fea59faa1e5 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 16 Mar 2023 05:07:01 +0000
Subject: [PATCH 06/10] Bump actions/setup-go from 3 to 4
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3...v4)
---
updated-dependencies:
- dependency-name: actions/setup-go
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot]
---
.github/workflows/ci.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 19555a8..d80057f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -38,7 +38,7 @@ jobs:
steps:
- name: Set up Go
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
@@ -63,7 +63,7 @@ jobs:
steps:
- name: Set up Go
- uses: actions/setup-go@v3
+ uses: actions/setup-go@v4
with:
go-version: '1.19.x'
From dc2d48795b19d48c1246279f05c9b93c3d39de01 Mon Sep 17 00:00:00 2001
From: Anton Novojilov
Date: Thu, 23 Mar 2023 21:45:13 +0300
Subject: [PATCH 07/10] Improve container wrapper
---
README.md | 24 ++++++++++++------------
bop-docker => bop-container | 24 ++++++++++++++++++++++--
2 files changed, 34 insertions(+), 14 deletions(-)
rename bop-docker => bop-container (82%)
diff --git a/README.md b/README.md
index fec9f57..75a7ef9 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
-Installation • Docker support • Command-line completion • Man documentation • Usage • Build Status • Contributing • License
+Installation • Command-line completion • Man documentation • Usage • Build Status • Contributing • License
@@ -20,8 +20,8 @@
To build the `bop` from scratch, make sure you have a working Go 1.18+ workspace (_[instructions](https://golang.org/doc/install)_), then:
-```
-go install github.com/essentialkaos/bop
+```bash
+go install github.com/essentialkaos/bop@latest
```
#### Prebuilt binaries
@@ -32,15 +32,15 @@ You can download prebuilt binaries for Linux from [EK Apps Repository](https://a
bash <(curl -fsSL https://apps.kaos.st/get) bop
```
-### Docker support
+#### Container image
-Official `bop` images available on [Docker Hub](https://kaos.sh/d/bop) and [GitHub Container Registry](https://kaos.sh/p/bop). Install the latest version of Docker, then:
+Official `bop` images available on [GitHub Container Registry](https://kaos.sh/p/bop) and [Docker Hub](https://kaos.sh/d/bop). Install the latest version of Podman or Docker, then:
```bash
-curl -#L -o bop-docker https://kaos.sh/bop/bop-docker
-chmod +x bop-docker
-sudo mv bop-docker /usr/bin/
-bop-docker test-name package.rpm
+curl -#L -o bop-container https://kaos.sh/bop/bop-container
+chmod +x bop-container
+sudo mv bop-container /usr/bin/bop
+bop test-name package.rpm
```
### Command-line completion
@@ -48,19 +48,19 @@ bop-docker test-name package.rpm
You can generate completion for `bash`, `zsh` or `fish` shell.
Bash:
-```
+```bash
sudo bop --completion=bash 1> /etc/bash_completion.d/bop
```
ZSH:
-```
+```bash
sudo bop --completion=zsh 1> /usr/share/zsh/site-functions/bop
```
Fish:
-```
+```bash
sudo bop --completion=fish 1> /usr/share/fish/vendor_completions.d/bop.fish
```
diff --git a/bop-docker b/bop-container
similarity index 82%
rename from bop-docker
rename to bop-container
index be10beb..3793df1 100644
--- a/bop-docker
+++ b/bop-container
@@ -43,6 +43,10 @@ BOP_IMAGE="${IMAGE:-$IMAGE_GH}"
################################################################################
+engine=""
+
+################################################################################
+
# Main func
#
# *: All unparsed arguments passed to the script
@@ -50,7 +54,9 @@ BOP_IMAGE="${IMAGE:-$IMAGE_GH}"
# Code: No
# Echo: No
main() {
- if ! hasApp "docker" ; then
+ engine=$(getContainerEngine)
+
+ if [[ -z "$engine" ]] ; then
error "You must install Docker first"
exit 1
fi
@@ -72,11 +78,25 @@ run() {
cwd=$(pwd)
# shellcheck disable=SC2086,SC2048
- docker run --rm -it -v "${cwd}:/bop" "$BOP_IMAGE" $*
+ $engine run --rm -it -v "${cwd}:/bop" "$BOP_IMAGE" $*
return $?
}
+# Get used container engine
+#
+# Code: No
+# Echo: Engine name (String)
+getContainerEngine() {
+ if hasApp "docker" ; then
+ echo "docker"
+ fi
+
+ if hasApp "podman" ; then
+ echo "podman"
+ fi
+}
+
# Checks if given app is installed
#
# 1: Binray name (String)
From 7c9bc3947983e813ed7104b86242faef744123d6 Mon Sep 17 00:00:00 2001
From: Anton Novojilov
Date: Thu, 23 Mar 2023 21:45:58 +0300
Subject: [PATCH 08/10] Regenerate Makefile with the latest version of
gomakegen
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 126ace5..7aca3ea 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
################################################################################
-# This Makefile generated by GoMakeGen 2.1.0 using next command:
+# This Makefile generated by GoMakeGen 2.2.0 using next command:
# gomakegen --mod .
#
# More info: https://kaos.sh/gomakegen
@@ -94,6 +94,6 @@ help: ## Show this info
| sed 's/ifdef //' \
| awk 'BEGIN {FS = " .*?## "}; {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}'
@echo -e ''
- @echo -e '\033[90mGenerated by GoMakeGen 2.1.0\033[0m\n'
+ @echo -e '\033[90mGenerated by GoMakeGen 2.2.0\033[0m\n'
################################################################################
From 25e8d92b49a4728db59d901753ba3b6156dbf5f8 Mon Sep 17 00:00:00 2001
From: Anton Novojilov
Date: Thu, 23 Mar 2023 21:53:15 +0300
Subject: [PATCH 09/10] Update CI workflow
---
.github/workflows/ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d80057f..9e8cbc2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -95,7 +95,7 @@ jobs:
- name: Check scripts with Shellcheck
uses: essentialkaos/shellcheck-action@v1
with:
- files: bop-docker
+ files: bop-container
Hadolint:
name: Hadolint
From 1b10724fa9fe54b711bea3857f19acfa18ae025c Mon Sep 17 00:00:00 2001
From: Anton Novojilov
Date: Thu, 23 Mar 2023 22:59:47 +0300
Subject: [PATCH 10/10] Improve container wrapper
---
bop-container | 0
1 file changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 bop-container
diff --git a/bop-container b/bop-container
old mode 100644
new mode 100755