Merge "Add usage message to androidmk"
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@@ -15,6 +16,13 @@ import (
|
|||||||
bpparser "github.com/google/blueprint/parser"
|
bpparser "github.com/google/blueprint/parser"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var usage = func() {
|
||||||
|
fmt.Fprintf(os.Stderr, "usage: androidmk [flags] <inputFile>\n"+
|
||||||
|
"\nandroidmk parses <inputFile> as an Android.mk file and attempts to output an analogous Android.bp file (to standard out)\n")
|
||||||
|
flag.PrintDefaults()
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: non-expanded variables with expressions
|
// TODO: non-expanded variables with expressions
|
||||||
|
|
||||||
type bpFile struct {
|
type bpFile struct {
|
||||||
@@ -85,7 +93,13 @@ type conditional struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
b, err := ioutil.ReadFile(os.Args[1])
|
flag.Usage = usage
|
||||||
|
flag.Parse()
|
||||||
|
if len(flag.Args()) != 1 {
|
||||||
|
usage()
|
||||||
|
}
|
||||||
|
filePathToRead := flag.Arg(0)
|
||||||
|
b, err := ioutil.ReadFile(filePathToRead)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user