File tree Expand file tree Collapse file tree 15 files changed +173
-240
lines changed Expand file tree Collapse file tree 15 files changed +173
-240
lines changed Original file line number Diff line number Diff line change 9
9
build :
10
10
name : Build and release
11
11
runs-on : ubuntu-latest
12
- strategy :
13
- matrix :
14
- goos : [windows]
15
- goarch : ["386", amd64]
16
- exclude :
17
- - goos : darwin
18
- goarch : " 386"
19
12
20
13
steps :
21
-
22
14
- name : Set up Go
23
- uses : actions/setup-go@v2
15
+ uses : actions/setup-go@v3
24
16
with :
25
- go-version : ^1.19
17
+ go-version : ^1.20
26
18
27
19
- name : Check out code into the Go module directory
28
- uses : actions/checkout@v2
29
-
30
- - name : Build executable
31
- run : go build -v -ldflags="-X 'main.versionString=${{ github.event.release.tag_name }}'" .
32
- env :
33
- GOARCH : ${{ matrix.goarch }}
34
- GOOS : ${{ matrix.goos }}
35
-
36
- - name : Create distribution archive
37
- run : go run -v ./scripts/dist
20
+ uses : actions/checkout@v3
21
+ with :
22
+ fetch-depth : 0
38
23
39
- - name : Upload binary to release
40
- uses : svenstaro/upload-release- action@v2
24
+ - name : Run GoReleaser
25
+ uses : goreleaser/goreleaser- action@v4
41
26
with :
42
- file : dist/dist.zip
43
- asset_name : batch-rename-${{ matrix.goos }}-${{ matrix.goarch }}.zip
44
- overwrite : true
27
+ version : latest
28
+ args : release --clean
29
+ env :
30
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -10,16 +10,16 @@ jobs:
10
10
steps :
11
11
12
12
- name : Set up Go
13
- uses : actions/setup-go@v2
13
+ uses : actions/setup-go@v3
14
14
with :
15
- go-version : ^1.19
15
+ go-version : ^1.20
16
16
id : go
17
17
18
18
- name : Check out code into the Go module directory
19
- uses : actions/checkout@v2
19
+ uses : actions/checkout@v3
20
20
21
21
- name : Build
22
- run : go build -v .
22
+ run : go build -v -ldflags="-X 'main.version=${{ github.event.release.tag_name }}'" .
23
23
24
24
- name : Test
25
- run : go test -v .
25
+ run : go test -v -ldflags="-X 'main.version=${{ github.event.release.tag_name }}'" .
Original file line number Diff line number Diff line change @@ -70,4 +70,4 @@ $RECYCLE.BIN/
70
70
71
71
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
72
72
73
- / dist /
73
+ dist /
Original file line number Diff line number Diff line change
1
+ before :
2
+ hooks :
3
+ # You may remove this if you don't use go modules.
4
+ - go mod tidy
5
+ # you may remove this if you don't need go generate.
6
+ # - go generate ./...
7
+ builds :
8
+ - env :
9
+ - CGO_ENABLED=0
10
+ goos :
11
+ - linux
12
+ - windows
13
+ - darwin
14
+
15
+ archives :
16
+ - format : tar.gz
17
+ # this name template makes the OS and Arch compatible with the results of uname.
18
+ name_template : >-
19
+ {{ .ProjectName }}_
20
+ {{- title .Os }}_
21
+ {{- if eq .Arch "amd64" }}x86_64
22
+ {{- else if eq .Arch "386" }}i386
23
+ {{- else }}{{ .Arch }}{{ end }}
24
+ {{- if .Arm }}v{{ .Arm }}{{ end }}
25
+ # use zip for windows archives
26
+ format_overrides :
27
+ - goos : windows
28
+ format : zip
29
+ files :
30
+ - LICENSE
31
+ - README.md
32
+ - screenshots/*
33
+ checksum :
34
+ name_template : ' checksums.txt'
35
+ snapshot :
36
+ name_template : " {{ incpatch .Version }}-dev+{{ .ShortCommit }}"
37
+ changelog :
38
+ sort : asc
39
+ filters :
40
+ exclude :
41
+ - ' ^docs:'
42
+ - ' ^test:'
Original file line number Diff line number Diff line change
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version" : " 0.2.0" ,
6
+ "configurations" : [
7
+ {
8
+ "name" : " Launch Package" ,
9
+ "type" : " go" ,
10
+ "request" : " launch" ,
11
+ "mode" : " auto" ,
12
+ "program" : " ${workspaceFolder}"
13
+ }
14
+ ]
15
+ }
Original file line number Diff line number Diff line change 3
3
" Dadido" ,
4
4
" GOARCH" ,
5
5
" goversion" ,
6
+ " incpatch" ,
6
7
" ldflags" ,
8
+ " skratchdot" ,
7
9
" svenstaro" ,
8
10
" Vogel" ,
9
11
" wangyoucao"
Original file line number Diff line number Diff line change @@ -19,3 +19,13 @@ There are multiple ways to use this tool:
19
19
- Download the compiled binary, then move and execute it into the directory you want to rename files in.
20
20
- Download the compiled binary, and move it to any directory that is in your ` path ` environment variable. Afterwards you can run ` batch-rename ` from inside any directory.
21
21
- Use ` go install github.com/Dadido3/batch-rename ` . Afterwards you can run ` batch-rename ` from inside any directory.
22
+ - Build it yourself from source, see below.
23
+
24
+ ## Building
25
+
26
+ This software uses GoReleaser to automatically build and upload artifacts to GitHub.
27
+ Make sure to [ install GoReleaser] ( https://goreleaser.com/install/ ) .
28
+
29
+ - To build for your current platform use ` goreleaser build --single-target --clean ` . Or ` goreleaser build --single-target --snapshot --clean ` if you have modified the repository.
30
+ - To simulate the release process, use ` goreleaser --skip-publish --auto-snapshot --clean ` .
31
+ - To build for your current platform and without GoReleaser, use ` go build ` . This will not include the version information.
Original file line number Diff line number Diff line change 1
1
module github.com/Dadido3/batch-rename
2
2
3
- go 1.19
3
+ go 1.20
4
4
5
- require (
6
- github.com/coreos/go-semver v0.3.0
7
- golang.org/x/exp v0.0.0-20221031165847-c99f073a8326
8
- )
5
+ require github.com/Masterminds/semver/v3 v3.2.0
9
6
10
- require gopkg.in/yaml.v2 v2.4.0 // indirect
7
+ require github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
Original file line number Diff line number Diff line change 1
- github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM =
2
- github.com/coreos/go-semver v0.3.0 /go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk =
3
- golang.org/x/exp v0.0.0-20221031165847-c99f073a8326 h1:QfTh0HpN6hlw6D3vu8DAwC8pBIwikq0AI1evdm+FksE =
4
- golang.org/x/exp v0.0.0-20221031165847-c99f073a8326 /go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc =
5
- gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 /go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0 =
6
- gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY =
7
- gopkg.in/yaml.v2 v2.4.0 /go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ =
1
+ github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g =
2
+ github.com/Masterminds/semver/v3 v3.2.0 /go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ =
3
+ github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA =
4
+ github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 /go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog =
Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ import (
11
11
"log"
12
12
"os"
13
13
"path/filepath"
14
+
15
+ "github.com/skratchdot/open-golang/open"
14
16
)
15
17
16
18
func main () {
17
- log .Printf ("Started batch-rename v %v" , version )
19
+ log .Printf ("Started batch-rename %v" , Version )
18
20
19
21
rootDir := "."
20
22
@@ -57,7 +59,11 @@ func main() {
57
59
log .Panicf ("Failed to create temporary text file: %v" , err )
58
60
}
59
61
60
- if err := openWithDefault (filePath ); err != nil {
62
+ /*if err := openWithDefault(filePath); err != nil {
63
+ log.Panicf("Failed to open temporary text file: %v", err)
64
+ }*/
65
+
66
+ if err := open .Run (filePath ); err != nil {
61
67
log .Panicf ("Failed to open temporary text file: %v" , err )
62
68
}
63
69
You can’t perform that action at this time.
0 commit comments