Skip to content

Commit 1a222db

Browse files
Merge branch 'main' into preserve-user
2 parents 0dee889 + a4cb726 commit 1a222db

34 files changed

+175
-175
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- name: Tag version
3434
run: |
3535
VERSION=${GITHUB_REF##*/}
36+
VERSION=${VERSION#v}
3637
echo "VERSION=${VERSION}" >> $GITHUB_ENV
3738
echo "RELEASE_NAME=${{ env.PROJECT_NAME }}-${VERSION}-${{ matrix.os }}-${{ matrix.arch }}" >> $GITHUB_ENV
3839
env:
@@ -157,6 +158,7 @@ jobs:
157158
- name: Set environment variables
158159
run: |
159160
VERSION="${GITHUB_REF##*/}"
161+
VERSION="${VERSION#v}"
160162
echo "PACKAGE_FILENAME=${{ env.PROJECT_NAME }}-${VERSION}-${{ matrix.build }}.tar.gz" >>$GITHUB_ENV
161163
162164
- name: Checkout repository

Taskfile.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ tasks:
6565
vars:
6666
VERSION: "{{.VERSION }}"
6767
cmds:
68-
- cmd: go build -ldflags "-X main.Version={{.VERSION}}" -v -o ./build/arduino-flasher-cli .
68+
- cmd: go build -ldflags "-X main.Version={{.VERSION}}" -v -o ./build/arduino-flasher-cli ./cmd/arduino-flasher-cli/
6969
platforms: [linux, darwin]
70-
- cmd: go build -ldflags "-X main.Version={{.VERSION}}" -v -o ./build/arduino-flasher-cli.exe .
70+
- cmd: go build -ldflags "-X main.Version={{.VERSION}}" -v -o ./build/arduino-flasher-cli.exe ./cmd/arduino-flasher-cli/
7171
platforms: [windows]
7272

7373
build:artifacts:
7474
desc: Prepare the arduino-flasher-cli artifacts
7575
internal: true
7676
status:
77-
- test -f ./updater/artifacts/resources_darwin_amd64/qdl
78-
- test -f ./updater/artifacts/resources_darwin_arm64/qdl
79-
- test -f ./updater/artifacts/resources_linux_amd64/qdl
80-
- test -f ./updater/artifacts/resources_linux_arm64/qdl
81-
- test -f ./updater/artifacts/resources_windows_amd64/qdl.exe
82-
cmd: sh ./updater/artifacts/download_resources.sh
77+
- test -f ./internal/updater/artifacts/resources_darwin_amd64/qdl
78+
- test -f ./internal/updater/artifacts/resources_darwin_arm64/qdl
79+
- test -f ./internal/updater/artifacts/resources_linux_amd64/qdl
80+
- test -f ./internal/updater/artifacts/resources_linux_arm64/qdl
81+
- test -f ./internal/updater/artifacts/resources_windows_amd64/qdl.exe
82+
cmd: sh ./internal/updater/artifacts/download_resources.sh
8383

8484
release:
8585
desc: Create a tag on the current commit and push it to the remote to create the release

download.go renamed to cmd/arduino-flasher-cli/download/download.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,49 @@
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to [email protected].
1515

16-
package main
16+
package download
1717

1818
import (
19+
"context"
1920
"os"
2021

2122
"github.com/arduino/go-paths-helper"
2223
"github.com/spf13/cobra"
2324

24-
"github.com/arduino/arduino-flasher-cli/feedback"
25-
"github.com/arduino/arduino-flasher-cli/i18n"
26-
"github.com/arduino/arduino-flasher-cli/updater"
25+
"github.com/arduino/arduino-flasher-cli/cmd/feedback"
26+
"github.com/arduino/arduino-flasher-cli/cmd/i18n"
27+
"github.com/arduino/arduino-flasher-cli/internal/updater"
2728
)
2829

29-
func newDownloadCmd() *cobra.Command {
30+
func NewDownloadCmd() *cobra.Command {
3031
var destDir string
3132
cmd := &cobra.Command{
3233
Use: "download",
3334
Short: "Download a Linux image to the specified path",
3435
Args: cobra.ExactArgs(1),
3536
Example: " " + os.Args[0] + " download latest\n" +
37+
" " + os.Args[0] + " download 20251024-412\n" +
3638
" " + os.Args[0] + " download latest --dest-dir /tmp\n",
3739
Run: func(cmd *cobra.Command, args []string) {
38-
runDownloadCommand(args, destDir)
40+
runDownloadCommand(cmd.Context(), args, destDir)
3941
},
4042
}
4143
cmd.Flags().StringVar(&destDir, "dest-dir", ".", "Path to the directory in which the image will be downloaded")
4244

4345
return cmd
4446
}
4547

46-
func runDownloadCommand(args []string, destDir string) {
48+
func runDownloadCommand(ctx context.Context, args []string, destDir string) {
4749
targetVersion := args[0]
4850
downloadPath := paths.New(destDir)
4951
if !downloadPath.IsDir() {
50-
feedback.Fatal(i18n.Tr("error: %s is not a directory", destDir), feedback.ErrBadArgument)
52+
feedback.Fatal(i18n.Tr("error: %s is not a directory. Please, select an existing directory.", destDir), feedback.ErrBadArgument)
5153
}
5254

53-
client := updater.NewClient()
54-
_, _, err := updater.DownloadImage(client, targetVersion, nil, true, downloadPath)
55+
downloadPath, _, err := updater.DownloadImage(ctx, targetVersion, downloadPath)
5556
if err != nil {
5657
feedback.Fatal(i18n.Tr("error downloading the image: %v", err), feedback.ErrBadArgument)
5758
}
59+
pathAbs, _ := downloadPath.Abs()
60+
feedback.Print(i18n.Tr("\nDebian image successfully downloaded: %s", pathAbs.String()))
5861
}

drivers.go renamed to cmd/arduino-flasher-cli/drivers/drivers.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to [email protected].
1515

16-
package main
16+
package drivers
1717

1818
import (
1919
"github.com/spf13/cobra"
2020

21-
"github.com/arduino/arduino-flasher-cli/feedback"
22-
"github.com/arduino/arduino-flasher-cli/i18n"
21+
"github.com/arduino/arduino-flasher-cli/cmd/feedback"
22+
"github.com/arduino/arduino-flasher-cli/cmd/i18n"
2323
)
2424

25-
func newInstallDriversCmd() *cobra.Command {
25+
func NewInstallDriversCmd() *cobra.Command {
2626
cmd := &cobra.Command{
2727
Use: "install-drivers",
2828
Hidden: true,

drivers_others.go renamed to cmd/arduino-flasher-cli/drivers/drivers_others.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
//go:build !windows
1717

18-
package main
18+
package drivers
1919

2020
// installDrivers is a no-op on non-Windows platforms
2121
func installDrivers() error {

drivers_windows.go renamed to cmd/arduino-flasher-cli/drivers/drivers_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to [email protected].
1515

16-
package main
16+
package drivers
1717

1818
import (
1919
"embed"
@@ -23,7 +23,7 @@ import (
2323
"github.com/arduino/go-paths-helper"
2424
)
2525

26-
//go:embed drivers
26+
//go:embed src
2727
var drivers embed.FS
2828

2929
// installDrivers installs the Windows driver using dpinst.exe. This requires

drivers/dpinst-amd64.exe renamed to cmd/arduino-flasher-cli/drivers/src/dpinst-amd64.exe

File renamed without changes.

drivers/dpinst-x86.exe renamed to cmd/arduino-flasher-cli/drivers/src/dpinst-x86.exe

File renamed without changes.

drivers/unoq.cat renamed to cmd/arduino-flasher-cli/drivers/src/unoq.cat

File renamed without changes.

drivers/unoq.inf renamed to cmd/arduino-flasher-cli/drivers/src/unoq.inf

File renamed without changes.

0 commit comments

Comments
 (0)