Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f1877ef

Browse files
Roberto Soracmaglie
andauthoredSep 7, 2020
Reintroduce the --input-file flag for the upload command (#777)
* Remove deprecation from importFile param * Implement --input-file flag * Add comment in --input-file splitting step * Add e2e test for --input-x flags * Refine upload flags testing * Add --input-file file existence check * Use TrimSuffix instead of replace * Restore -i shorthand flag for --input-file and add CLI checkFlagsConflicts function * Improved build path and project name auto-detection This should make the upload command compatibile with all the reasonable usages. See #764 See #641 * Made UploadTest more resilient * upload: sketch is ignored if input-dir or input-file is specified There is no point in overriding the sketch name if the user explicitly give it via command line. * Update go-paths-helper to version 1.3.2 fixes EquivalentTo when used with abs paths * fix TestGetCommandLine * 100% coverage on detectSketchNameFromBuildPath function * Do not git-ignore all *.bin but just inside the client_example folder * slightly simplified function signature (cosmetic) Co-authored-by: Cristian Maglie <[email protected]>
1 parent 5045656 commit f1877ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+352
-97
lines changed
 

‎.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ venv
1515

1616
# gRPC client example folder
1717
/client_example/client_example
18-
*.bin
19-
*.elf
18+
/client_example/**/*.bin
19+
/client_example/**/*.elf
2020

2121
# Misc.
2222
.DS_Store

‎arduino/sketches/sketches.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"fmt"
2121

2222
"github.com/arduino/go-paths-helper"
23+
"github.com/pkg/errors"
2324
)
2425

2526
// Sketch is a sketch for Arduino
@@ -43,9 +44,17 @@ type BoardMetadata struct {
4344

4445
// NewSketchFromPath loads a sketch from the specified path
4546
func NewSketchFromPath(path *paths.Path) (*Sketch, error) {
47+
path, err := path.Abs()
48+
if err != nil {
49+
return nil, errors.Errorf("getting sketch path: %s", err)
50+
}
4651
if !path.IsDir() {
4752
path = path.Parent()
4853
}
54+
sketchFile := path.Join(path.Base() + ".ino")
55+
if !sketchFile.Exist() {
56+
return nil, errors.Errorf("no valid sketch found in %s: missing %s", path, sketchFile.Base())
57+
}
4958
sketch := &Sketch{
5059
FullPath: path,
5160
Name: path.Base(),

0 commit comments

Comments
 (0)
Please sign in to comment.