diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..cacaead220b8216df707388a766af805ad4edada --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +webloc diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..93c21f0fbe7dab61ef71462ff096b914ed3fca7c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Erik Hedenström + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 9e0b786a1d46184fb11eb44702eda281b18c0e58..e4d34143b65ba53d92a226053ba0d3f088f8d7e4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ # webloc -Open webloc files on windows \ No newline at end of file +Open webloc files on windows + +## Installing + +go get -u gitlab.hedenstroem.com/go/webloc + + +## Setup on Windows + +Double-click on a .webloc file choose open with webloc.exe diff --git a/main.go b/main.go new file mode 100644 index 0000000000000000000000000000000000000000..608c0fa02a864493a1e6bf223f58f0dc013b0aa6 --- /dev/null +++ b/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "encoding/xml" + "fmt" + "io/ioutil" + "os" + + "github.com/pkg/browser" +) + +type Webloc struct { + URL string `xml:"dict>string"` +} + +func main() { + bytes, err := ioutil.ReadFile(os.Args[1]) + if err != nil { + fmt.Println("Error opening file:", err) + return + } + var webloc Webloc + xml.Unmarshal(bytes, &webloc) + browser.OpenURL(webloc.URL) +} \ No newline at end of file