Skip to content

Add more self-explanatory usage message #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/arduino.cc/arduino-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,15 @@ var loggerFlag *string
var versionFlag *bool
var vidPidFlag *string

var Usage = func(){
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
fmt.Fprintf(os.Stderr, "\n\tarduino_builder -hardware <hardware_dir> -tools <tools_dir> -fqbn <family:arch:model> [options] sketch_to_Compile\n\n")
fmt.Fprintf(os.Stderr, "Available flags:\n")
flag.PrintDefaults()
}

func init() {
flag.Usage = Usage
Copy link
Author

@roncapat roncapat Jan 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to substitute the default flag.Usage() behaviour with a custom one (defined above), which declaration was taken directly from here, and edited as needed.

compileFlag = flag.Bool(FLAG_ACTION_COMPILE, false, "compiles the given sketch")
preprocessFlag = flag.Bool(FLAG_ACTION_PREPROCESS, false, "preprocess the given sketch")
dumpPrefsFlag = flag.Bool(FLAG_ACTION_DUMP_PREFS, false, "dumps build properties used when compiling")
Expand Down