diff --git a/README.md b/README.md index 3f5328c..3cc4985 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,9 @@ Now trying to read it We've found a new hyperlink with ref http://google.com and the text google End of main ``` -You can also increase the log level and just dump a specific file. See [getstructure/main](getstructure/main.go) +You can also increase the log level (-logtostderr=true -v=0) and just dump a specific file(-file /tmp/new-file.docx). See [getstructure/main](getstructure/main.go) ``` -$ go build -o docxlib ./getstructure/ && ./docxlib -logtostderr=true -v=0 +$ go build -o docxlib ./getstructure/ && ./docxlib -logtostderr=true -v=0 -file /tmp/new-file.docx I0511 12:37:40.898493 18466 unpack.go:69] Relations: [...] I0511 12:37:40.898787 18466 unpack.go:47] Doc: [...] I0511 12:37:40.899330 18466 unpack.go:58] Paragraph [0xc000026d40 0xc000027d00 0xc000172340] diff --git a/getstructure/main.go b/getstructure/main.go index b1e5cec..47ff6eb 100644 --- a/getstructure/main.go +++ b/getstructure/main.go @@ -9,12 +9,16 @@ import ( "github.com/gonfva/docxlib" ) -const FILE_PATH = "/tmp/new-file.docx" +var fileLocation *string + +func init() { + fileLocation = flag.String("file", "/tmp/new-file.docx", "file location") + flag.Parse() +} func main() { - flag.Parse() //Now let's try to read the file - readFile, err := os.Open(FILE_PATH) + readFile, err := os.Open(*fileLocation) if err != nil { panic(err) }